Skip to content

Commit

Permalink
Test fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
edwh committed Dec 19, 2023
1 parent d2b9322 commit 31a1ca6
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions app/Helpers/Fixometer.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,34 @@ public static function userHasDeletePartyPermission($partyId, $userId = null)
return false;
}

public static function userCanApproveEvent($eventId, $userId = null, $groupId = null)
{
if (is_null($userId)) {
$userId = Auth::user()->id;
}
$user = User::find($userId);

if (self::hasRole($user, 'Administrator')) {
return true;
}

if (self::hasRole($user, 'NetworkCoordinator')) {
if ($groupId) {
$group = Group::find($groupId);
} else {
$group = Party::find($eventId)->theGroup;
}

foreach ($group->networks as $network) {
if ($network->coordinators->contains($user)) {
return true;
}
}
}

return false;
}

public static function userHasEditEventsDevicesPermission($partyId, $userId = null)
{
if (is_null($userId)) {
Expand Down

0 comments on commit 31a1ca6

Please sign in to comment.