src/Middleware/Authentication.php 1 location
|
@@ 78-86 (lines=9) @@
|
75 |
|
* @param UserVO $user |
76 |
|
* @throws MethodNotAllowedException |
77 |
|
*/ |
78 |
|
protected function checkForRole(Route $route, UserVO $user) |
79 |
|
{ |
80 |
|
if ($route->hasDefault('_role')) { |
81 |
|
$role = $route->getDefault('_role'); |
82 |
|
if (!in_array($role, $user->roles)) { |
83 |
|
throw new MethodNotAllowedException([], sprintf('Need role %s', $role)); |
84 |
|
} |
85 |
|
} |
86 |
|
} |
87 |
|
|
88 |
|
/** |
89 |
|
* @param int $userId |
src/Middleware/TokenAuthentication.php 1 location
|
@@ 78-86 (lines=9) @@
|
75 |
|
* @param UserVO $user |
76 |
|
* @throws MethodNotAllowedException |
77 |
|
*/ |
78 |
|
protected function checkForRole(Route $route, UserVO $user) |
79 |
|
{ |
80 |
|
if ($route->hasDefault('_role')) { |
81 |
|
$role = $route->getDefault('_role'); |
82 |
|
if (!in_array($role, $user->roles)) { |
83 |
|
throw new MethodNotAllowedException([], sprintf('Need role %s', $role)); |
84 |
|
} |
85 |
|
} |
86 |
|
} |
87 |
|
|
88 |
|
/** |
89 |
|
* @param int $userId |