]> git.localhorst.tv Git - alttp.git/commitdiff
add admin subclass
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Mon, 20 Feb 2023 18:33:37 +0000 (19:33 +0100)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Mon, 20 Feb 2023 18:33:37 +0000 (19:33 +0100)
app/Http/Controllers/EpisodeController.php
app/Models/User.php

index b59ea18cbc501265265e94626aabd97996bab9c5..c20ad64f63dec5fce037507aa29e68e11bd4015b 100644 (file)
@@ -25,7 +25,7 @@ class EpisodeController extends Controller
                        ->where('events.visible', '=', true)
                        ->orderBy('episodes.start')
                        ->limit(1000);
-               if ($request->user() && $request->user()->isAdmin()) {
+               if ($request->user() && $request->user()->isPrivileged()) {
                        $episodes = $episodes->with('crew');
                } else {
                        $episodes = $episodes->with([
index fb21113b39497f7f9a68f4fd81d837d755386cb3..201361e68534eb869f94a1c3e50dc61140552a6b 100644 (file)
@@ -44,6 +44,10 @@ class User extends Authenticatable
                return $this->role === 'admin';
        }
 
+       public function isPrivileged() {
+               return $this->role === 'special' || $this->isAdmin();
+       }
+
        public function isApplicant(Tournament $tournament) {
                foreach ($tournament->applications as $applicant) {
                        if ($applicant->user_id == $this->id) {