Jul 15 - Add Auditor user role

This commit is contained in:
2026-07-15 13:47:59 -04:00
parent df547eefc2
commit fcb959900f
26 changed files with 152 additions and 56 deletions
+24 -2
View File
@@ -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.
+1
View File
@@ -55,6 +55,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
+1
View File
@@ -546,6 +546,7 @@ def notify_by_matrix(
'director': 'director',
'inspector': 'inspector',
'project_manager': 'project_manager',
'auditor': 'auditor',
'customer': 'customer',
}