@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | return $this->active_roles |
168 | 168 | ->pluck('permissions') |
169 | 169 | ->flatten() |
170 | - ->unique(function (Permission $permission) { |
|
170 | + ->unique(function(Permission $permission) { |
|
171 | 171 | return $permission->getKey(); |
172 | 172 | }); |
173 | 173 | } |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | */ |
235 | 235 | public function may($ability) |
236 | 236 | { |
237 | - return $this->permissions->filter(function (Permission $permission) use ($ability) { |
|
237 | + return $this->permissions->filter(function(Permission $permission) use ($ability) { |
|
238 | 238 | return $permission->hasAbility($ability); |
239 | 239 | })->isNotEmpty(); |
240 | 240 | } |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | ? $permissions |
254 | 254 | : $this->newCollection($permissions); |
255 | 255 | |
256 | - $failed = $permissions->reject(function ($permission) { |
|
256 | + $failed = $permissions->reject(function($permission) { |
|
257 | 257 | return $this->may($permission); |
258 | 258 | })->values(); |
259 | 259 |
@@ -187,8 +187,9 @@ |
||
187 | 187 | */ |
188 | 188 | public function scopeFilterByAuthenticatedUser(Builder $query, User $user) |
189 | 189 | { |
190 | - if ($user->isSuperAdmin()) |
|
191 | - return $query; |
|
190 | + if ($user->isSuperAdmin()) { |
|
191 | + return $query; |
|
192 | + } |
|
192 | 193 | |
193 | 194 | return $query->where('is_admin', '!=', true); |
194 | 195 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public function getActiveRolesAttribute() |
43 | 43 | { |
44 | - return $this->roles->filter(function (Role $role) { |
|
44 | + return $this->roles->filter(function(Role $role) { |
|
45 | 45 | return $role->isActive(); |
46 | 46 | }); |
47 | 47 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | { |
93 | 93 | $roles = is_array($roles) ? collect($roles) : $roles; |
94 | 94 | |
95 | - $failed = $roles->reject(function ($role) { |
|
95 | + $failed = $roles->reject(function($role) { |
|
96 | 96 | return $this->hasRoleKey($role); |
97 | 97 | })->values(); |
98 | 98 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function hasRoleKey(string $key): bool |
110 | 110 | { |
111 | - return $this->active_roles->filter(function (Role $role) use ($key) { |
|
111 | + return $this->active_roles->filter(function(Role $role) use ($key) { |
|
112 | 112 | return $role->hasKey($key); |
113 | 113 | })->isNotEmpty(); |
114 | 114 | } |
@@ -148,8 +148,9 @@ discard block |
||
148 | 148 | */ |
149 | 149 | public function show(AuthenticatedUser $user, User $model = null) |
150 | 150 | { |
151 | - if ($model && $model->isSuperAdmin() && ! $user->isSuperAdmin()) |
|
152 | - return false; |
|
151 | + if ($model && $model->isSuperAdmin() && ! $user->isSuperAdmin()) { |
|
152 | + return false; |
|
153 | + } |
|
153 | 154 | } |
154 | 155 | |
155 | 156 | /** |
@@ -187,11 +188,13 @@ discard block |
||
187 | 188 | */ |
188 | 189 | public function activate(AuthenticatedUser $user, User $model = null) |
189 | 190 | { |
190 | - if ($user->is($model)) |
|
191 | - return false; |
|
191 | + if ($user->is($model)) { |
|
192 | + return false; |
|
193 | + } |
|
192 | 194 | |
193 | - if ( ! is_null($model) && $model->isSuperAdmin()) |
|
194 | - return false; |
|
195 | + if ( ! is_null($model) && $model->isSuperAdmin()) { |
|
196 | + return false; |
|
197 | + } |
|
195 | 198 | } |
196 | 199 | |
197 | 200 | /** |
@@ -204,11 +207,13 @@ discard block |
||
204 | 207 | */ |
205 | 208 | public function delete(AuthenticatedUser $user, User $model = null) |
206 | 209 | { |
207 | - if ($user->is($model)) |
|
208 | - return false; |
|
210 | + if ($user->is($model)) { |
|
211 | + return false; |
|
212 | + } |
|
209 | 213 | |
210 | - if ( ! is_null($model)) |
|
211 | - return $model->isDeletable(); |
|
214 | + if ( ! is_null($model)) { |
|
215 | + return $model->isDeletable(); |
|
216 | + } |
|
212 | 217 | } |
213 | 218 | |
214 | 219 | /** |
@@ -221,8 +226,9 @@ discard block |
||
221 | 226 | */ |
222 | 227 | public function forceDelete(AuthenticatedUser $user, User $model = null) |
223 | 228 | { |
224 | - if ( ! is_null($model)) |
|
225 | - return $model->isDeletable(); |
|
229 | + if ( ! is_null($model)) { |
|
230 | + return $model->isDeletable(); |
|
231 | + } |
|
226 | 232 | } |
227 | 233 | |
228 | 234 | /** |
@@ -235,8 +241,9 @@ discard block |
||
235 | 241 | */ |
236 | 242 | public function restore(AuthenticatedUser $user, User $model = null) |
237 | 243 | { |
238 | - if ( ! is_null($model)) |
|
239 | - return $model->trashed(); |
|
244 | + if ( ! is_null($model)) { |
|
245 | + return $model->trashed(); |
|
246 | + } |
|
240 | 247 | } |
241 | 248 | |
242 | 249 | /** |
@@ -249,8 +256,9 @@ discard block |
||
249 | 256 | */ |
250 | 257 | public function impersonate(AuthenticatedUser $user, User $model) |
251 | 258 | { |
252 | - if ($model->isAdmin()) |
|
253 | - return false; |
|
259 | + if ($model->isAdmin()) { |
|
260 | + return false; |
|
261 | + } |
|
254 | 262 | |
255 | 263 | return $user->isNot($model); |
256 | 264 | } |
@@ -126,8 +126,9 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public function show(AuthenticatedUser $user, Role $model = null) |
128 | 128 | { |
129 | - if ($model && $model->key === Role::ADMINISTRATOR && ! $user->isSuperAdmin()) |
|
130 | - return false; |
|
129 | + if ($model && $model->key === Role::ADMINISTRATOR && ! $user->isSuperAdmin()) { |
|
130 | + return false; |
|
131 | + } |
|
131 | 132 | } |
132 | 133 | |
133 | 134 | /** |
@@ -165,8 +166,9 @@ discard block |
||
165 | 166 | */ |
166 | 167 | public function activate(AuthenticatedUser $user, Role $model = null) |
167 | 168 | { |
168 | - if (static::isRoleLocked($model)) |
|
169 | - return false; |
|
169 | + if (static::isRoleLocked($model)) { |
|
170 | + return false; |
|
171 | + } |
|
170 | 172 | } |
171 | 173 | |
172 | 174 | /** |
@@ -179,8 +181,9 @@ discard block |
||
179 | 181 | */ |
180 | 182 | public function delete(AuthenticatedUser $user, Role $model = null) |
181 | 183 | { |
182 | - if ( ! is_null($model)) |
|
183 | - return $model->isDeletable(); |
|
184 | + if ( ! is_null($model)) { |
|
185 | + return $model->isDeletable(); |
|
186 | + } |
|
184 | 187 | } |
185 | 188 | |
186 | 189 | /** |
@@ -194,11 +197,13 @@ discard block |
||
194 | 197 | */ |
195 | 198 | public function detachUser(AuthenticatedUser $user, Role $model = null, User $related = null) |
196 | 199 | { |
197 | - if (static::isRoleLocked($model)) |
|
198 | - return false; |
|
200 | + if (static::isRoleLocked($model)) { |
|
201 | + return false; |
|
202 | + } |
|
199 | 203 | |
200 | - if ( ! $user->isAdmin() && $related->isAdmin()) |
|
201 | - return false; |
|
204 | + if ( ! $user->isAdmin() && $related->isAdmin()) { |
|
205 | + return false; |
|
206 | + } |
|
202 | 207 | } |
203 | 208 | |
204 | 209 | /** |
@@ -212,8 +217,9 @@ discard block |
||
212 | 217 | */ |
213 | 218 | public function detachPermission(AuthenticatedUser $user, Role $model = null, Permission $related = null) |
214 | 219 | { |
215 | - if (static::isRoleLocked($model)) |
|
216 | - return false; |
|
220 | + if (static::isRoleLocked($model)) { |
|
221 | + return false; |
|
222 | + } |
|
217 | 223 | } |
218 | 224 | |
219 | 225 | /* ----------------------------------------------------------------- |
@@ -109,7 +109,8 @@ |
||
109 | 109 | */ |
110 | 110 | public function detachRole(AuthenticatedUser $user, Permission $model = null, Role $related = null) |
111 | 111 | { |
112 | - if ( ! is_null($related)) |
|
113 | - return ! $related->isLocked(); |
|
112 | + if ( ! is_null($related)) { |
|
113 | + return ! $related->isLocked(); |
|
114 | + } |
|
114 | 115 | } |
115 | 116 | } |
@@ -62,7 +62,7 @@ |
||
62 | 62 | return ! Auth::makeModel('role') |
63 | 63 | ->newQuery() |
64 | 64 | ->where('key', Auth::slugRoleKey($value)) |
65 | - ->unless(is_null($this->ignored), function (Builder $query) { |
|
65 | + ->unless(is_null($this->ignored), function(Builder $query) { |
|
66 | 66 | return $query->where('id', '!=', $this->ignored); |
67 | 67 | }) |
68 | 68 | ->exists(); |
@@ -28,20 +28,20 @@ |
||
28 | 28 | $this->prefix('profile')->name('profile.')->middleware(['password.confirm'])->group(function () { |
29 | 29 | // admin::auth.profile.index |
30 | 30 | $this->get('/', [ProfileController::class, 'index']) |
31 | - ->name('index'); |
|
31 | + ->name('index'); |
|
32 | 32 | |
33 | 33 | // Account |
34 | 34 | $this->prefix('account')->name('account.')->group(function () { |
35 | 35 | // admin::auth.profile.account.update |
36 | 36 | $this->put('update', [ProfileController::class, 'updateAccount']) |
37 | - ->name('update'); |
|
37 | + ->name('update'); |
|
38 | 38 | }); |
39 | 39 | |
40 | 40 | // Password |
41 | 41 | $this->prefix('password')->name('password.')->group(function () { |
42 | 42 | // admin::auth.profile.password.update |
43 | 43 | $this->put('update', [ProfileController::class, 'updatePassword']) |
44 | - ->name('update'); |
|
44 | + ->name('update'); |
|
45 | 45 | }); |
46 | 46 | }); |
47 | 47 | }); |
@@ -24,21 +24,21 @@ |
||
24 | 24 | */ |
25 | 25 | public function map(): void |
26 | 26 | { |
27 | - $this->adminGroup(function () { |
|
28 | - $this->prefix('profile')->name('profile.')->middleware(['password.confirm'])->group(function () { |
|
27 | + $this->adminGroup(function() { |
|
28 | + $this->prefix('profile')->name('profile.')->middleware(['password.confirm'])->group(function() { |
|
29 | 29 | // admin::auth.profile.index |
30 | 30 | $this->get('/', [ProfileController::class, 'index']) |
31 | 31 | ->name('index'); |
32 | 32 | |
33 | 33 | // Account |
34 | - $this->prefix('account')->name('account.')->group(function () { |
|
34 | + $this->prefix('account')->name('account.')->group(function() { |
|
35 | 35 | // admin::auth.profile.account.update |
36 | 36 | $this->put('update', [ProfileController::class, 'updateAccount']) |
37 | 37 | ->name('update'); |
38 | 38 | }); |
39 | 39 | |
40 | 40 | // Password |
41 | - $this->prefix('password')->name('password.')->group(function () { |
|
41 | + $this->prefix('password')->name('password.')->group(function() { |
|
42 | 42 | // admin::auth.profile.password.update |
43 | 43 | $this->put('update', [ProfileController::class, 'updatePassword']) |
44 | 44 | ->name('update'); |
@@ -39,7 +39,7 @@ |
||
39 | 39 | $this->prefix('{'.self::ROLE_WILDCARD.'}')->group(function () { |
40 | 40 | // admin::auth.permissions.roles.detach |
41 | 41 | $this->delete('detach', [RolesController::class, 'detach']) |
42 | - ->name('detach'); |
|
42 | + ->name('detach'); |
|
43 | 43 | }); |
44 | 44 | }); |
45 | 45 | } |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function map(): void |
37 | 37 | { |
38 | - $this->prefix('roles')->name('roles.')->group(function () { |
|
39 | - $this->prefix('{'.self::ROLE_WILDCARD.'}')->group(function () { |
|
38 | + $this->prefix('roles')->name('roles.')->group(function() { |
|
39 | + $this->prefix('{'.self::ROLE_WILDCARD.'}')->group(function() { |
|
40 | 40 | // admin::auth.permissions.roles.detach |
41 | 41 | $this->delete('detach', [RolesController::class, 'detach']) |
42 | 42 | ->name('detach'); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function bindings(PermissionsRepository $repo): void |
53 | 53 | { |
54 | - $this->bind(self::ROLE_WILDCARD, function (string $uuid, Route $route) use ($repo) { |
|
54 | + $this->bind(self::ROLE_WILDCARD, function(string $uuid, Route $route) use ($repo) { |
|
55 | 55 | /** @var \Arcanesoft\Foundation\Auth\Models\Permission $permission */ |
56 | 56 | $permission = $route->parameter(PermissionsRoutes::PERMISSION_WILDCARD); |
57 | 57 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $this->name('password-resets.')->prefix('password-resets')->group(function () { |
30 | 30 | // admin::authorization.password-resets.index |
31 | 31 | $this->get('/', [PasswordResetsController::class, 'index']) |
32 | - ->name('index'); |
|
32 | + ->name('index'); |
|
33 | 33 | |
34 | 34 | $this->dataTableGroup(function () { |
35 | 35 | // admin::auth.password-resets.datatables.index |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | // admin::authorization.password-resets.metrics |
41 | 41 | $this->get('metrics', [PasswordResetsController::class, 'metrics']) |
42 | - ->name('metrics'); |
|
42 | + ->name('metrics'); |
|
43 | 43 | }); |
44 | 44 | }); |
45 | 45 | } |
@@ -25,13 +25,13 @@ |
||
25 | 25 | */ |
26 | 26 | public function map(): void |
27 | 27 | { |
28 | - $this->adminGroup(function () { |
|
29 | - $this->name('password-resets.')->prefix('password-resets')->group(function () { |
|
28 | + $this->adminGroup(function() { |
|
29 | + $this->name('password-resets.')->prefix('password-resets')->group(function() { |
|
30 | 30 | // admin::authorization.password-resets.index |
31 | 31 | $this->get('/', [PasswordResetsController::class, 'index']) |
32 | 32 | ->name('index'); |
33 | 33 | |
34 | - $this->dataTableGroup(function () { |
|
34 | + $this->dataTableGroup(function() { |
|
35 | 35 | // admin::auth.password-resets.datatables.index |
36 | 36 | $this->get('/', [PasswordResetsDataTablesController::class, 'index']) |
37 | 37 | ->name('index'); |