diff --git a/app/Domain/ACL/Permission.php b/app/Domain/ACL/Permission.php index a8a4a57..e16f6c3 100644 --- a/app/Domain/ACL/Permission.php +++ b/app/Domain/ACL/Permission.php @@ -13,7 +13,7 @@ enum Permission: string case StudyDownload = 'study_download'; case StudyDelete = 'study_delete'; case StudyArchive = 'study_archive'; - case ReportCreate = 'report_create'; + case ReportEdit = 'report_edit'; case ReportDictate = 'report_dictate'; case ReportDownload = 'report_download'; case StudyNotesCreate = 'study_notes_create'; diff --git a/app/Services/Workflow/Manager.php b/app/Services/Workflow/Manager.php index 85f451d..55c5e4f 100644 --- a/app/Services/Workflow/Manager.php +++ b/app/Services/Workflow/Manager.php @@ -82,5 +82,13 @@ public function canReportDownload(): bool return $this->activeStudy(fn () => $this->study->report_status >= ReportStatus::Finalized); } + public function canReportEdit(): bool + { + return $this->activeStudy(fn () => $this->study->is_locked === false && + $this->study->report_status <= ReportStatus::Preliminary && + $this->study->assigned_physician_id === $this->user->id + ); + } + public function __construct(private readonly Study $study) {} } diff --git a/database/seeders/RoleSeeder.php b/database/seeders/RoleSeeder.php index dbb4cc2..6c8f142 100644 --- a/database/seeders/RoleSeeder.php +++ b/database/seeders/RoleSeeder.php @@ -25,7 +25,7 @@ public function run(): void } $rad->givePermissionTo([ - Permission::ReportCreate, + Permission::ReportEdit, Permission::ReportDownload, Permission::StudyDownload, Permission::StudyMetadataView, diff --git a/resources/views/staff/studies/index.blade.php b/resources/views/staff/studies/index.blade.php index 2049f64..f4fdf99 100644 --- a/resources/views/staff/studies/index.blade.php +++ b/resources/views/staff/studies/index.blade.php @@ -144,7 +144,7 @@ class="d-flex justify-content-between align-items-start border-end pb-4 pb-sm-0 Reported - @can(\App\Domain\ACL\Permission::ReportCreate) + @can(\App\Domain\ACL\Permission::ReportEdit) TXT @endcan