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:
@@ -13,7 +13,8 @@ def init_statistics_routes(app):
|
||||
@app.route('/statistics')
|
||||
@login_required
|
||||
def statistics():
|
||||
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'))
|
||||
|
||||
Reference in New Issue
Block a user