Aug 7 - Update: add external inspector
This commit is contained in:
@@ -189,7 +189,8 @@ def _active_inspectors():
|
||||
"""Users who can be assigned inspections (inspector-capable roles)."""
|
||||
return User.query.filter(
|
||||
User.active.is_(True),
|
||||
User.role.in_(['inspector', 'project_manager', 'director', 'admin']),
|
||||
User.role.in_(['inspector', 'external_inspector', 'project_manager',
|
||||
'director', 'admin']),
|
||||
).order_by(User.full_name, User.username).all()
|
||||
|
||||
|
||||
@@ -356,7 +357,7 @@ def index():
|
||||
|
||||
base = InspectionSchedule.query
|
||||
# Inspectors see only their own assignments; managers see everything.
|
||||
if current_user.role == 'inspector':
|
||||
if current_user.is_inspector:
|
||||
base = base.filter(InspectionSchedule.inspector_id == current_user.id)
|
||||
|
||||
# Counts are computed on the same scoped query, so the badges match what the
|
||||
@@ -645,7 +646,7 @@ def start(schedule_id):
|
||||
abort(404)
|
||||
if current_user.role == 'customer':
|
||||
abort(403)
|
||||
if current_user.role == 'inspector' and schedule.inspector_id != current_user.id:
|
||||
if current_user.is_inspector and schedule.inspector_id != current_user.id:
|
||||
abort(403)
|
||||
|
||||
if not schedule.active:
|
||||
|
||||
Reference in New Issue
Block a user