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:
@@ -17,7 +17,8 @@ def init_work_order_routes(app):
|
||||
@app.route('/dispatch', methods=['GET', 'POST'])
|
||||
@login_required
|
||||
def dispatch():
|
||||
if current_user.role not in ['装维员', '统计员']:
|
||||
allowed_roles = ['装维员', '统计员', '管理员', 'admin']
|
||||
if current_user.role not in allowed_roles and current_user.name != 'Admin':
|
||||
flash('您没有权限访问此页面')
|
||||
return redirect(url_for('statistics'))
|
||||
|
||||
@@ -283,7 +284,8 @@ def init_work_order_routes(app):
|
||||
@app.route('/receive/<string:work_order_id>', methods=['GET', 'POST'])
|
||||
@login_required
|
||||
def receive_detail(work_order_id):
|
||||
if current_user.role not in ['装维员', '统计员']:
|
||||
allowed_roles = ['装维员', '统计员', '管理员', 'admin']
|
||||
if current_user.role not in allowed_roles and current_user.name != 'Admin':
|
||||
flash('您没有权限访问此页面')
|
||||
return redirect(url_for('statistics'))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user