From: Daniel Karbach Date: Wed, 30 Mar 2022 11:58:41 +0000 (+0200) Subject: remove nonsensical admin permissions X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=7691214484ff6130ab0cdc9a1920941711443cea;p=alttp.git remove nonsensical admin permissions --- diff --git a/app/Policies/RoundPolicy.php b/app/Policies/RoundPolicy.php index c1a1a48..c02d374 100644 --- a/app/Policies/RoundPolicy.php +++ b/app/Policies/RoundPolicy.php @@ -101,7 +101,7 @@ class RoundPolicy */ public function setSeed(User $user, Round $round) { - return $user->isAdmin() || (!$round->locked && ($user->isRunner($round->tournament) || $user->isTournamentAdmin($round->tournament))); + return !$round->locked && ($user->isAdmin() || $user->isRunner($round->tournament) || $user->isTournamentAdmin($round->tournament)); } /** @@ -113,7 +113,7 @@ class RoundPolicy */ public function lock(User $user, Round $round) { - return $user->isAdmin() || $user->isTournamentAdmin($round->tournament); + return !$round->tournament->locked && ($user->isAdmin() || $user->isTournamentAdmin($round->tournament)); } /** diff --git a/app/Policies/TournamentPolicy.php b/app/Policies/TournamentPolicy.php index 72b5dcb..66ab1f6 100644 --- a/app/Policies/TournamentPolicy.php +++ b/app/Policies/TournamentPolicy.php @@ -101,7 +101,7 @@ class TournamentPolicy */ public function addRound(User $user, Tournament $tournament) { - return $user->isAdmin() || (!$tournament->locked && ($user->isRunner($tournament) || $user->isTournamentAdmin($tournament))); + return !$tournament->locked && ($user->isAdmin() || $user->isRunner($tournament) || $user->isTournamentAdmin($tournament)); } /** diff --git a/resources/js/helpers/permissions.js b/resources/js/helpers/permissions.js index 566c2d8..b33f1c3 100644 --- a/resources/js/helpers/permissions.js +++ b/resources/js/helpers/permissions.js @@ -36,15 +36,15 @@ export const hasFinished = (user, round) => round.results.find(r => r.user_id == user.id && r.has_finished); export const mayAddRounds = (user, tournament) => - isAdmin(user) || (!tournament.locked && - (isRunner(user, tournament) || isTournamentAdmin(user, tournament))); + !tournament.locked && + (isAdmin(user) || isRunner(user, tournament) || isTournamentAdmin(user, tournament)); export const mayLockRound = (user, tournament) => - isAdmin(user) || (!tournament.locked && isTournamentAdmin(user, tournament)); + !tournament.locked && (isAdmin(user) || isTournamentAdmin(user, tournament)); export const maySetSeed = (user, tournament, round) => - isAdmin(user) || (!round.locked && - (isRunner(user, tournament) || isTournamentAdmin(user, tournament))); + !round.locked && + (isAdmin(user) || isRunner(user, tournament) || isTournamentAdmin(user, tournament)); export const mayViewProtocol = (user, tournament) => isAdmin(user) || isTournamentCrew(user, tournament);