@@ 55-77 (lines=23) @@ | ||
52 | ]; |
|
53 | } |
|
54 | ||
55 | public function pageListAction(Player $me) |
|
56 | { |
|
57 | if (!$me->isValid()) { |
|
58 | throw new ForbiddenException('Please log in to view this page.'); |
|
59 | } |
|
60 | ||
61 | if (!$this->isEditorFor(Page::class, $me)) { |
|
62 | throw new ForbiddenException('Contact a site administrator if you feel you should have access to this page.'); |
|
63 | } |
|
64 | ||
65 | $pages = Page::getQueryBuilder() |
|
66 | ->where('status')->notEquals('deleted') |
|
67 | ->getModels(true) |
|
68 | ; |
|
69 | ||
70 | return [ |
|
71 | 'pages' => $pages, |
|
72 | 'canCreate' => $me->hasPermission(Page::CREATE_PERMISSION), |
|
73 | 'canEdit' => $me->hasPermission(Page::EDIT_PERMISSION), |
|
74 | 'canDelete' => $me->hasPermission(Page::SOFT_DELETE_PERMISSION), |
|
75 | 'canWipe' => $me->hasPermission(Page::HARD_DELETE_PERMISSION), |
|
76 | ]; |
|
77 | } |
|
78 | ||
79 | public function roleListAction(Player $me) |
|
80 | { |
|
@@ 79-101 (lines=23) @@ | ||
76 | ]; |
|
77 | } |
|
78 | ||
79 | public function roleListAction(Player $me) |
|
80 | { |
|
81 | if (!$me->isValid()) { |
|
82 | throw new ForbiddenException('Please log in to view this page.'); |
|
83 | } |
|
84 | ||
85 | if (!$this->isEditorFor(Role::class, $me)) { |
|
86 | throw new ForbiddenException('Contact a site administrator if you feel you should have access to this page.'); |
|
87 | } |
|
88 | ||
89 | $roles = Role::getQueryBuilder() |
|
90 | ->sortBy('display_order') |
|
91 | ->getModels($fast = true) |
|
92 | ; |
|
93 | ||
94 | return [ |
|
95 | 'roles' => $roles, |
|
96 | 'canCreate' => $me->hasPermission(Role::CREATE_PERMISSION), |
|
97 | 'canEdit' => $me->hasPermission(Role::EDIT_PERMISSION), |
|
98 | 'canDelete' => $me->hasPermission(Role::SOFT_DELETE_PERMISSION), |
|
99 | 'canWipe' => $me->hasPermission(Role::HARD_DELETE_PERMISSION), |
|
100 | ]; |
|
101 | } |
|
102 | ||
103 | public function modelsAction(Player $me) |
|
104 | { |