Jul 20 - Update The Scheduled inspection's Start button on the Dashboard, only for Assignee

This commit is contained in:
2026-07-20 17:18:30 -04:00
parent 08b9f088a8
commit 18e9090780
4 changed files with 13 additions and 11 deletions
+7 -5
View File
@@ -4,7 +4,9 @@ app/routes/scheduled_inspections.py
Planned / recurring inspection assignments (phase36).
Management (list/new/edit/delete) : admin, director, project_manager
Start (execute the planned inspection): the assigned inspector, or admin/director/pm
Start (execute the planned inspection): the assigned inspector ONLY (the person
who must do it) — not managers. A manager
who needs to run it assigns it to themselves.
Cron reminders : POST /run?token=DIGEST_SECRET (no login)
Fulfillment (marking a schedule done and rolling recurring ones forward) happens
@@ -224,11 +226,11 @@ def start(schedule_id):
sched = db.session.get(ScheduledInspection, schedule_id)
if sched is None:
abort(404)
if current_user.role == 'customer':
abort(403)
# Only the assigned inspector, or a manager, may start it.
if current_user.role == 'inspector' and sched.inspector_id != current_user.id:
# Only the assigned inspector may start it — this inspection is theirs to do.
# Managers (admin/director/pm) manage the schedule but do not start it for
# someone else; if a manager needs to do the inspection, assign it to them.
if not sched.inspector_id or sched.inspector_id != current_user.id:
abort(403)
if not sched.active: