--
This commit is contained in:
@@ -10,7 +10,7 @@ The Area Manager is the final approver; there is no General Manager stage.
|
||||
|
||||
from dataclasses import dataclass
|
||||
|
||||
from app.common.enums import EDITABLE_STATUSES, DCRStatus, Role, WorkflowAction
|
||||
from app.common.enums import EDITABLE_STATUSES, FIELD_ROLES, DCRStatus, Role, WorkflowAction
|
||||
from app.common.exceptions import ForbiddenError, InvalidStateTransitionError
|
||||
|
||||
|
||||
@@ -62,7 +62,8 @@ def assert_transition(status: DCRStatus, action: WorkflowAction, role: Role) ->
|
||||
),
|
||||
},
|
||||
)
|
||||
if transition.allowed_role != role:
|
||||
# An SFE files and submits reports exactly as an MR does.
|
||||
if transition.allowed_role != (Role.MR if role in FIELD_ROLES else role):
|
||||
raise ForbiddenError(
|
||||
f"Role {role.value} may not {action.value.lower()} this report",
|
||||
{"required_role": transition.allowed_role.value, "your_role": role.value},
|
||||
|
||||
Reference in New Issue
Block a user