Controller/AdminNodeController.php 1 location
|
@@ 87-102 (lines=16) @@
|
| 84 |
|
], null, $request); |
| 85 |
|
} |
| 86 |
|
|
| 87 |
|
protected function checkRolesCMS(array $role) |
| 88 |
|
{ |
| 89 |
|
$user = $this->getUser(); |
| 90 |
|
|
| 91 |
|
if (!$user) { |
| 92 |
|
throw new NotFoundHttpException(sprintf('unable to find user')); |
| 93 |
|
} |
| 94 |
|
|
| 95 |
|
$userRole = $user->getRoles()[0]; |
| 96 |
|
|
| 97 |
|
if (!array_key_exists('role', $role) || in_array($userRole, $role['role'])) { |
| 98 |
|
return true; |
| 99 |
|
} |
| 100 |
|
|
| 101 |
|
return false; |
| 102 |
|
} |
| 103 |
|
} |
| 104 |
|
|
Controller/AdminBlockController.php 1 location
|
@@ 72-85 (lines=14) @@
|
| 69 |
|
* |
| 70 |
|
* Check role define in different parameter of block or content_types cms.yml |
| 71 |
|
*/ |
| 72 |
|
protected function checkRolesCMS(array $role) |
| 73 |
|
{ |
| 74 |
|
$user = $this->getUser(); |
| 75 |
|
|
| 76 |
|
if (!$user) { |
| 77 |
|
throw new NotFoundHttpException(sprintf('unable to find user')); |
| 78 |
|
} |
| 79 |
|
|
| 80 |
|
if (!array_key_exists('role', $role) || in_array($user->getRoles()[0], $role['role'])) { |
| 81 |
|
return true; |
| 82 |
|
} |
| 83 |
|
|
| 84 |
|
return false; |
| 85 |
|
} |
| 86 |
|
|
| 87 |
|
/** |
| 88 |
|
* Get content in cms.yml and set in $_cmsParameter. |