]> git.localhorst.tv Git - alttp.git/commitdiff
remove absurd admin permissions
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Wed, 6 Apr 2022 11:40:23 +0000 (13:40 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Wed, 6 Apr 2022 11:40:23 +0000 (13:40 +0200)
app/Policies/ParticipantPolicy.php
app/Policies/ProtocolPolicy.php
app/Policies/RoundPolicy.php
app/Policies/TournamentPolicy.php
resources/js/helpers/permissions.js

index 8622d12de3c9e3909abe2ef8f02345a9300c9da4..fb86b73b6e6202edfbed46e2095eaf6b395f49ab 100644 (file)
@@ -18,7 +18,7 @@ class ParticipantPolicy
         */
        public function viewAny(User $user)
        {
-               return $user->isAdmin();
+               return true;
        }
 
        /**
@@ -30,7 +30,7 @@ class ParticipantPolicy
         */
        public function view(User $user, Participant $participant)
        {
-               return $user->isAdmin();
+               return true;
        }
 
        /**
@@ -53,7 +53,7 @@ class ParticipantPolicy
         */
        public function update(User $user, Participant $participant)
        {
-               return $user->isAdmin();
+               return false;
        }
 
        /**
index 186fe09f7bb9fc3f546aadaf42270f9781ad192f..689e0c26a166de2cac44c4617fbd611453f7eae9 100644 (file)
@@ -18,7 +18,7 @@ class ProtocolPolicy
         */
        public function viewAny(User $user)
        {
-               return $user->role === 'admin';
+               return false;
        }
 
        /**
@@ -30,7 +30,7 @@ class ProtocolPolicy
         */
        public function view(User $user, Protocol $protocol)
        {
-               return $user->role === 'admin';
+               return $user->isTournamentCrew($protocol->tournament);
        }
 
        /**
index f9f2d461bd76ff0b425f1a4f8b3dc6c688e45178..ec71a890802fa21d7caf5e81a458daf89a170cf0 100644 (file)
@@ -41,7 +41,7 @@ class RoundPolicy
         */
        public function create(User $user)
        {
-               return $user->role === 'admin';
+               return false;
        }
 
        /**
@@ -53,7 +53,7 @@ class RoundPolicy
         */
        public function update(User $user, Round $round)
        {
-               return $user->role === 'admin';
+               return false;
        }
 
        /**
@@ -118,7 +118,7 @@ class RoundPolicy
         */
        public function setSeed(User $user, Round $round)
        {
-               return !$round->locked && ($user->isAdmin() || $user->isRunner($round->tournament) || $user->isTournamentAdmin($round->tournament));
+               return !$round->locked && ($user->isRunner($round->tournament) || $user->isTournamentAdmin($round->tournament));
        }
 
        /**
@@ -130,7 +130,7 @@ class RoundPolicy
         */
        public function lock(User $user, Round $round)
        {
-               return !$round->tournament->locked && ($user->isAdmin() || $user->isTournamentAdmin($round->tournament));
+               return !$round->tournament->locked && ($user->isTournamentAdmin($round->tournament));
        }
 
        /**
index 66ab1f6b0fffba669aa205c367d87376a6026ba6..5942b7f7979c8ff215275b9e6a83d6853e8624b7 100644 (file)
@@ -41,7 +41,7 @@ class TournamentPolicy
         */
        public function create(User $user)
        {
-               return $user->role === 'admin';
+               return $user->isAdmin();
        }
 
        /**
@@ -53,7 +53,7 @@ class TournamentPolicy
         */
        public function update(User $user, Tournament $tournament)
        {
-               return $user->role === 'admin';
+               return $user->isTournamentAdmin($tournament);
        }
 
        /**
@@ -101,7 +101,7 @@ class TournamentPolicy
         */
        public function addRound(User $user, Tournament $tournament)
        {
-               return !$tournament->locked && ($user->isAdmin() || $user->isRunner($tournament) || $user->isTournamentAdmin($tournament));
+               return !$tournament->locked && ($user->isRunner($tournament) || $user->isTournamentAdmin($tournament));
        }
 
        /**
@@ -113,7 +113,7 @@ class TournamentPolicy
         */
        public function viewProtocol(User $user, Tournament $tournament)
        {
-               return $user->isAdmin() || $user->isTournamentCrew($tournament);
+               return $user->isTournamentCrew($tournament);
        }
 
 }
index 2ff823a955143dc166d4169b263a1d87890b5a61..8b8c596100270d6c32c4e2b2ff08d2220e96ba08 100644 (file)
@@ -37,17 +37,17 @@ export const hasFinished = (user, round) =>
 
 export const mayAddRounds = (user, tournament) =>
        !tournament.locked &&
-               (isAdmin(user) || isRunner(user, tournament) || isTournamentAdmin(user, tournament));
+               (isRunner(user, tournament) || isTournamentAdmin(user, tournament));
 
 export const mayLockRound = (user, tournament) =>
-       !tournament.locked && (isAdmin(user) || isTournamentAdmin(user, tournament));
+       !tournament.locked && isTournamentAdmin(user, tournament);
 
 export const maySetSeed = (user, tournament, round) =>
        !round.locked &&
-               (isAdmin(user) || isRunner(user, tournament) || isTournamentAdmin(user, tournament));
+               (isRunner(user, tournament) || isTournamentAdmin(user, tournament));
 
 export const mayViewProtocol = (user, tournament) =>
-       isAdmin(user) || isTournamentCrew(user, tournament);
+       isTournamentCrew(user, tournament);
 
 export const maySeeResults = (user, tournament, round) =>
        round.locked ||
@@ -59,7 +59,7 @@ export const maySeeResults = (user, tournament, round) =>
 // Users
 
 export const mayEditNickname = (user, subject) =>
-       isAdmin(user) || isSameUser(user, subject);
+       isSameUser(user, subject);
 
 export const mayEditStreamLink = (user, subject) =>
-       isAdmin(user) || isSameUser(user, subject);
+       isSameUser(user, subject);