Skip to content

Commit

Permalink
Fixed facility controller permissions for visiting senior staff
Browse files Browse the repository at this point in the history
  • Loading branch information
BMWENING committed Jul 5, 2024
1 parent 6f5a2df commit ca406fe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/Http/Controllers/API/v2/FacilityController.php
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ function deleteRoster(
return response()->api(
generate_error("Missing staff CID (by)"), 400);
} else {
if ($request->has('by') && (!User::find($request->by) || User::find($request->by)->facility != $facility->id)) {
if ($request->has('by') && (!User::find($request->by) || !RoleHelper::isSeniorStaff($request->by, $facility->id, false))) {
return response()->api(
generate_error("Invalid staff CID"), 400);
}
Expand Down Expand Up @@ -1201,7 +1201,7 @@ function putTransfer(
return response()->api(
generate_error("Missing staff CID (by)"), 400);
} else {
if ($request->has('by') && (!User::find($request->by) || User::find($request->by)->facility != $facility->id)) {
if ($request->has('by') && (!User::find($request->by) || !RoleHelper::isSeniorStaff($request->by, $facility->id, false))) {
return response()->api(
generate_error("Invalid staff CID"), 400);
}
Expand Down

0 comments on commit ca406fe

Please sign in to comment.