Skip to content

Commit

Permalink
Update the ProgramPolicy
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin Ullyott <[email protected]>
  • Loading branch information
Orrison committed Oct 21, 2024
1 parent 0030321 commit df7bc9f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app-modules/student-data-model/src/Policies/ProgramPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function viewAny(Authenticatable $authenticatable): Response

public function view(Authenticatable $authenticatable, Program $program): Response
{
if ($authenticatable->canAny('program.*.view', "student_record_manager.{$program->id}.view")) {
if ($authenticatable->canAny("program.{$program->id}.view", 'student_record_manager.*.view')) {
return Response::allow();
}

Expand All @@ -71,31 +71,31 @@ public function create(Authenticatable $authenticatable): Response
public function update(Authenticatable $authenticatable, Program $program): Response
{
return $authenticatable->canOrElse(
abilities: "student_record_manager.{$program->id}.update",
abilities: 'student_record_manager.*.update',
denyResponse: 'Programs cannot be updated.'
);
}

public function delete(Authenticatable $authenticatable, Program $program): Response
{
return $authenticatable->canOrElse(
abilities: "student_record_manager.{$program->id}.delete",
abilities: 'student_record_manager.*.delete',
denyResponse: 'Programs cannot be deleted.'
);
}

public function restore(Authenticatable $authenticatable, Program $program): Response
{
return $authenticatable->canOrElse(
abilities: "student_record_manager.{$program->id}.restore",
abilities: 'student_record_manager.*.restore',
denyResponse: 'Programs cannot be restored.'
);
}

public function forceDelete(Authenticatable $authenticatable, Program $program): Response
{
return $authenticatable->canOrElse(
abilities: "student_record_manager.{$program->id}.force-delete",
abilities: 'student_record_manager.*.force-delete',
denyResponse: 'Programs cannot be force deleted.'
);
}
Expand Down

0 comments on commit df7bc9f

Please sign in to comment.