X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=resources%2Fjs%2Fhelpers%2Fpermissions.js;h=d7613256d8c2f8e2a569bd2f75514799a818cfb8;hb=537b998e8059c56e3a20ee2a89d42c3bbfbb80b8;hp=cde0d05d7fd293f7114b6d7553ffb1144a9ffaa6;hpb=3a774bb649734fc3a2135ec1b52cef9a049880ee;p=alttp.git diff --git a/resources/js/helpers/permissions.js b/resources/js/helpers/permissions.js index cde0d05..d761325 100644 --- a/resources/js/helpers/permissions.js +++ b/resources/js/helpers/permissions.js @@ -58,6 +58,15 @@ export const mayApply = (user, tournament) => user && tournament && tournament.accept_applications && !isRunner(user, tournament) && !isApplicant(user, tournament); +export const mayHandleApplications = (user, tournament) => + tournament && tournament.accept_applications && isTournamentAdmin(user, tournament); + +export const mayReportResult = (user, tournament) => { + if (!user || !tournament) return false; + if (tournament.type === 'open-async') return true; + return isRunner(user, tournament); +}; + export const mayLockRound = (user, tournament) => !tournament.locked && isTournamentAdmin(user, tournament); @@ -65,6 +74,9 @@ export const maySetSeed = (user, tournament, round) => !round.locked && (isRunner(user, tournament) || isTournamentAdmin(user, tournament)); +export const mayUpdateTournament = (user, tournament) => + isAdmin(user) || isTournamentAdmin(user, tournament); + export const mayViewProtocol = (user, tournament) => isTournamentCrew(user, tournament); @@ -72,7 +84,6 @@ export const maySeeResults = (user, tournament, round) => round.locked || hasFinished(user, round) || isTournamentMonitor(user, tournament) || - (isTournamentAdmin(user, tournament) && !isRunner(user, tournament)) || Round.isComplete(tournament, round); // Users