X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FPolicies%2FTournamentPolicy.php;h=f58eee76dc12be424ddf5c26f89d49a57a80d676;hb=43da6b2ec78774e7b045a09c68af39717b5f5dbc;hp=5942b7f7979c8ff215275b9e6a83d6853e8624b7;hpb=eca3f0074e6f9e882b91893e554ce249e25338de;p=alttp.git diff --git a/app/Policies/TournamentPolicy.php b/app/Policies/TournamentPolicy.php index 5942b7f..f58eee7 100644 --- a/app/Policies/TournamentPolicy.php +++ b/app/Policies/TournamentPolicy.php @@ -53,7 +53,7 @@ class TournamentPolicy */ public function update(User $user, Tournament $tournament) { - return $user->isTournamentAdmin($tournament); + return $user->isAdmin() || $user->isTournamentAdmin($tournament); } /** @@ -104,6 +104,18 @@ class TournamentPolicy return !$tournament->locked && ($user->isRunner($tournament) || $user->isTournamentAdmin($tournament)); } + /** + * Determine whether the user can apply to participate. + * + * @param \App\Models\User $user + * @param \App\Models\Tournament $tournament + * @return \Illuminate\Auth\Access\Response|bool + */ + public function apply(User $user, Tournament $tournament) + { + return $tournament->accept_applications && !$user->isRunner($tournament) && !$user->isApplicant($tournament); + } + /** * Determine whether the user can view the tournament protocol. *