src/Http/Middleware/AuthorizeRoutePermission.php 1 location
|
@@ 89-100 (lines=12) @@
|
| 86 |
|
$redirect = array_get($this->route->getAction(), 'anomaly.module.users::redirect'); |
| 87 |
|
$message = array_get($this->route->getAction(), 'anomaly.module.users::message'); |
| 88 |
|
|
| 89 |
|
if ($permission && !$this->authorizer->authorizeAny((array)$permission)) { |
| 90 |
|
|
| 91 |
|
if ($message) { |
| 92 |
|
$this->messages->error($message); |
| 93 |
|
} |
| 94 |
|
|
| 95 |
|
if ($redirect) { |
| 96 |
|
return $this->redirect->to($redirect); |
| 97 |
|
} |
| 98 |
|
|
| 99 |
|
abort(403); |
| 100 |
|
} |
| 101 |
|
|
| 102 |
|
return $next($request); |
| 103 |
|
} |
src/Http/Middleware/AuthorizeRouteRoles.php 1 location
|
@@ 86-97 (lines=12) @@
|
| 83 |
|
$redirect = array_get($this->route->getAction(), 'anomaly.module.users::redirect'); |
| 84 |
|
$message = array_get($this->route->getAction(), 'anomaly.module.users::message'); |
| 85 |
|
|
| 86 |
|
if ($role && (!$user || !$user->hasAnyRole((array)$role))) { |
| 87 |
|
|
| 88 |
|
if ($message) { |
| 89 |
|
$this->messages->error($message); |
| 90 |
|
} |
| 91 |
|
|
| 92 |
|
if ($redirect) { |
| 93 |
|
return $this->redirect->to($redirect); |
| 94 |
|
} |
| 95 |
|
|
| 96 |
|
abort(403); |
| 97 |
|
} |
| 98 |
|
|
| 99 |
|
return $next($request); |
| 100 |
|
} |