Jul 16 - Fill the gaps between Single-tenant mode and Multi-tenant mode
This commit is contained in:
+24
-2
@@ -54,17 +54,39 @@ def supervisor_required(f):
|
||||
return decorated_function
|
||||
|
||||
def project_manager_required(f):
|
||||
"""Grants access to admin, director, and project_manager roles."""
|
||||
"""Grants access to admin, director, project_manager, and auditor roles.
|
||||
|
||||
Auditor mirrors Project Manager for all baseline access, so it is included
|
||||
here alongside project_manager.
|
||||
"""
|
||||
@wraps(f)
|
||||
def decorated_function(*args, **kwargs):
|
||||
if not current_user.is_authenticated or current_user.role not in [
|
||||
'admin', 'director', 'project_manager'
|
||||
'admin', 'director', 'project_manager', 'auditor'
|
||||
]:
|
||||
flash('Project Manager access required.', 'danger')
|
||||
return redirect(url_for('dashboard.index'))
|
||||
return f(*args, **kwargs)
|
||||
return decorated_function
|
||||
|
||||
def issue_manager_required(f):
|
||||
"""Grants access to admin, director, and auditor roles.
|
||||
|
||||
Used for issue-management powers that go beyond the Project Manager
|
||||
baseline (verification and the verification queue). Deliberately does NOT
|
||||
include project_manager, and does NOT grant issue deletion — delete stays
|
||||
on @supervisor_required (admin/director only).
|
||||
"""
|
||||
@wraps(f)
|
||||
def decorated_function(*args, **kwargs):
|
||||
if not current_user.is_authenticated or current_user.role not in [
|
||||
'admin', 'director', 'auditor'
|
||||
]:
|
||||
flash('Issue management access required.', 'danger')
|
||||
return redirect(url_for('dashboard.index'))
|
||||
return f(*args, **kwargs)
|
||||
return decorated_function
|
||||
|
||||
def customer_required(f):
|
||||
"""Restricts access to customer-role users only.
|
||||
|
||||
|
||||
@@ -92,6 +92,7 @@ class UserForm(FlaskForm):
|
||||
('director', 'Director'),
|
||||
('inspector', 'Inspector'),
|
||||
('project_manager', 'Project Manager'),
|
||||
('auditor', 'Auditor'),
|
||||
# 'customer' is intentionally excluded — customer accounts are managed via /customers
|
||||
], validators=[Optional()])
|
||||
# NOTE: Optional() here because directors submit no role value (the field is
|
||||
|
||||
@@ -546,6 +546,7 @@ def notify_by_matrix(
|
||||
'director': 'director',
|
||||
'inspector': 'inspector',
|
||||
'project_manager': 'project_manager',
|
||||
'auditor': 'auditor',
|
||||
'customer': 'customer',
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user