@@ -50,16 +50,16 @@ discard block |
||
| 50 | 50 | /** @var TokenStorageInterface */ |
| 51 | 51 | private $token_storage; |
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * AccessRights constructor. |
|
| 55 | - * @param ContainerInterface $container |
|
| 56 | - * @param RouterInterface $router |
|
| 57 | - * @param SessionInterface $session |
|
| 58 | - * @param RequestStack $request |
|
| 59 | - * @param TokenStorageInterface $tokenStorage |
|
| 60 | - * @param Globals $globals |
|
| 61 | - * @param ModuleService $module |
|
| 62 | - */ |
|
| 53 | + /** |
|
| 54 | + * AccessRights constructor. |
|
| 55 | + * @param ContainerInterface $container |
|
| 56 | + * @param RouterInterface $router |
|
| 57 | + * @param SessionInterface $session |
|
| 58 | + * @param RequestStack $request |
|
| 59 | + * @param TokenStorageInterface $tokenStorage |
|
| 60 | + * @param Globals $globals |
|
| 61 | + * @param ModuleService $module |
|
| 62 | + */ |
|
| 63 | 63 | public function __construct(ContainerInterface $container, RouterInterface $router, SessionInterface $session, RequestStack $request, TokenStorageInterface $tokenStorage, Globals $globals, ModuleService $module) |
| 64 | 64 | { |
| 65 | 65 | $this->container = $container; |
@@ -70,8 +70,8 @@ discard block |
||
| 70 | 70 | $this->module = $module; |
| 71 | 71 | $this->token_storage = $tokenStorage; |
| 72 | 72 | if ($this->token_storage->getToken()->getUser() && is_object($this->token_storage->getToken()->getUser()) && $this->token_storage->getToken()->getUser()->getUser()) { |
| 73 | - $this->user = $this->token_storage->getToken()->getUser()->getUser(); |
|
| 74 | - } |
|
| 73 | + $this->user = $this->token_storage->getToken()->getUser()->getUser(); |
|
| 74 | + } |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | public function onKernelController() |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
| 118 | - * function that allow to test a right directly in the view |
|
| 118 | + * function that allow to test a right directly in the view |
|
| 119 | 119 | * @param string $right |
| 120 | 120 | * @return bool |
| 121 | 121 | */ |
@@ -126,9 +126,9 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | $all_rights = array_merge($user_rights, $list_rights); |
| 128 | 128 | |
| 129 | - if (in_array("*", $all_rights)) { |
|
| 130 | - return true; |
|
| 131 | - } |
|
| 129 | + if (in_array("*", $all_rights)) { |
|
| 130 | + return true; |
|
| 131 | + } |
|
| 132 | 132 | |
| 133 | 133 | if (in_array($right, $all_rights)) { |
| 134 | 134 | return true; |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /** |
| 141 | - * test if route_right is found in users rights |
|
| 141 | + * test if route_right is found in users rights |
|
| 142 | 142 | * @param array $route_right |
| 143 | 143 | * @return bool |
| 144 | 144 | */ |
@@ -150,8 +150,8 @@ discard block |
||
| 150 | 150 | $all_rights = array_merge($user_rights, $list_rights); |
| 151 | 151 | |
| 152 | 152 | if (in_array("*", $all_rights)) { |
| 153 | - return true; |
|
| 154 | - } |
|
| 153 | + return true; |
|
| 154 | + } |
|
| 155 | 155 | |
| 156 | 156 | foreach ($all_rights as $right) { |
| 157 | 157 | if (in_array($right, $route_right)) { |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | /** |
| 166 | - * function that search if the right contain an url or more |
|
| 166 | + * function that search if the right contain an url or more |
|
| 167 | 167 | * @param $needle |
| 168 | 168 | * @param $haystack |
| 169 | 169 | * @return bool|mixed |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | /** |
| 190 | - * function that retun a array that contain all user rights or empty array if no right found |
|
| 190 | + * function that retun a array that contain all user rights or empty array if no right found |
|
| 191 | 191 | * @return array |
| 192 | 192 | */ |
| 193 | 193 | private function getUserRights(): array |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | /** |
| 205 | - * function that retun a array that contain all rights of rattached list right of the current user |
|
| 205 | + * function that retun a array that contain all rights of rattached list right of the current user |
|
| 206 | 206 | * @return array |
| 207 | 207 | */ |
| 208 | 208 | private function getRightsListOfUser(): array |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | $this->globals = $globals; |
| 70 | 70 | $this->module = $module; |
| 71 | 71 | $this->token_storage = $tokenStorage; |
| 72 | - if ($this->token_storage->getToken()->getUser() && is_object($this->token_storage->getToken()->getUser()) && $this->token_storage->getToken()->getUser()->getUser()) { |
|
| 72 | + if ($this->token_storage->getToken()->getUser() && is_object($this->token_storage->getToken()->getUser()) && $this->token_storage->getToken()->getUser()->getUser()) { |
|
| 73 | 73 | $this->user = $this->token_storage->getToken()->getUser()->getUser(); |
| 74 | 74 | } |
| 75 | 75 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | $ribs_admin_rights = json_decode(file_get_contents($this->globals->getBaseBundlePath() . "/Resources/json/ribsadmin_rights.json")); |
| 90 | 90 | $modules_rights = $this->module->getModuleRights(); |
| 91 | - $ribs_admin_rights = (object)array_merge((array)$ribs_admin_rights, (array)$modules_rights); |
|
| 91 | + $ribs_admin_rights = (object) array_merge((array) $ribs_admin_rights, (array) $modules_rights); |
|
| 92 | 92 | |
| 93 | 93 | if ($admin_page == "ribsadmin" && $api !== "api" && strpos($route, "login") === false && strpos($route, "register") === false) { |
| 94 | 94 | //redirection if user not connected |