]> git.localhorst.tv Git - alttp.git/commitdiff
remove nonsensical admin permissions
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Wed, 30 Mar 2022 11:58:41 +0000 (13:58 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Wed, 30 Mar 2022 11:58:41 +0000 (13:58 +0200)
app/Policies/RoundPolicy.php
app/Policies/TournamentPolicy.php
resources/js/helpers/permissions.js

index c1a1a4845beb157e0ddcc50547ced4d28b440531..c02d374450facecd0ab239da1aef5430b5238953 100644 (file)
@@ -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));
        }
 
        /**
index 72b5dcba3131dfe9ae53c4f4c463fef6f34ec7da..66ab1f6b0fffba669aa205c367d87376a6026ba6 100644 (file)
@@ -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));
        }
 
        /**
index 566c2d85f04602913192aad67e7c6670d80648ea..b33f1c3b9889c4e8ba45702f9d1610b2921a1ad7 100644 (file)
@@ -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);