Aug 6 - Add external inspector role
This commit is contained in:
+8
-1
@@ -8,6 +8,8 @@ Facility-scoping utilities for the Janitorial QC portal.
|
||||
|
||||
get_inspector_scope(user) -> list[int] | None
|
||||
Facility IDs an inspector may access via InspectorAssignment rows.
|
||||
Applies to BOTH 'inspector' (internal) and 'external_inspector'
|
||||
(customer / third-party) — see User.INSPECTOR_ROLES.
|
||||
Returns [] (empty list) when the inspector has no contract assignments,
|
||||
meaning they see nothing (strict mode).
|
||||
|
||||
@@ -90,7 +92,12 @@ def get_inspector_scope(user) -> list[int] | None:
|
||||
None
|
||||
Returned for non-inspector roles, indicating unrestricted access.
|
||||
"""
|
||||
if user.role != 'inspector':
|
||||
# phase49: covers BOTH 'inspector' and 'external_inspector'. An external
|
||||
# (customer / third-party) inspector is scoped by exactly the same
|
||||
# InspectorAssignment rows — the contracts an admin grants them.
|
||||
from app.models.user import User
|
||||
|
||||
if user.role not in User.INSPECTOR_ROLES:
|
||||
return None
|
||||
|
||||
from app.models.inspector_assignment import InspectorAssignment
|
||||
|
||||
Reference in New Issue
Block a user