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:
+2
-1
@@ -14,7 +14,8 @@ def init_device_routes(app):
|
||||
@app.route('/sync_offline_devices', methods=['POST'])
|
||||
@login_required
|
||||
def sync_offline_devices():
|
||||
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} 尝试同步离线设备')
|
||||
return jsonify({'success': False, 'message': '没有权限执行此操作'})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user