Enhance user role management and access control in the application. Added user management link in the navigation for admins. Updated login flow to redirect to Casdoor for authentication. Improved logging for user actions and unauthorized access attempts. Adjusted role checks across various views to include '管理员' and 'admin' for access permissions.

This commit is contained in:
2025-12-10 15:53:17 +08:00
parent bb39314940
commit 0bb323bbff
24 changed files with 1285 additions and 61 deletions
+2 -1
View File
@@ -9,7 +9,8 @@ def init_dashboard_routes(app):
@app.route('/dashboard')
@login_required
def dashboard():
if current_user.role not in ['装维员', '统计员']:
allowed_roles = ['装维员', '统计员', '管理员', 'admin']
if current_user.role not in allowed_roles and current_user.name != 'Admin':
app.logger.warning(f'未授权访问:用户 {current_user.name} 尝试访问仪表盘页面')
flash('您没有权限访问此页面')
return redirect(url_for('login'))