@@ -43,10 +43,10 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | private $module; |
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * @var Api |
|
| 48 | - */ |
|
| 49 | - private $api; |
|
| 46 | + /** |
|
| 47 | + * @var Api |
|
| 48 | + */ |
|
| 49 | + private $api; |
|
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | 52 | * @var User |
@@ -56,17 +56,17 @@ discard block |
||
| 56 | 56 | /** @var TokenStorageInterface */ |
| 57 | 57 | private $token_storage; |
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * AccessRights constructor. |
|
| 61 | - * @param ContainerInterface $container |
|
| 62 | - * @param RouterInterface $router |
|
| 63 | - * @param SessionInterface $session |
|
| 64 | - * @param RequestStack $request |
|
| 65 | - * @param TokenStorageInterface $tokenStorage |
|
| 66 | - * @param Globals $globals |
|
| 67 | - * @param ModuleService $module |
|
| 68 | - * @param Api $api |
|
| 69 | - */ |
|
| 59 | + /** |
|
| 60 | + * AccessRights constructor. |
|
| 61 | + * @param ContainerInterface $container |
|
| 62 | + * @param RouterInterface $router |
|
| 63 | + * @param SessionInterface $session |
|
| 64 | + * @param RequestStack $request |
|
| 65 | + * @param TokenStorageInterface $tokenStorage |
|
| 66 | + * @param Globals $globals |
|
| 67 | + * @param ModuleService $module |
|
| 68 | + * @param Api $api |
|
| 69 | + */ |
|
| 70 | 70 | public function __construct(ContainerInterface $container, RouterInterface $router, SessionInterface $session, RequestStack $request, TokenStorageInterface $tokenStorage, Globals $globals, ModuleService $module, Api $api) |
| 71 | 71 | { |
| 72 | 72 | $this->container = $container; |
@@ -78,8 +78,8 @@ discard block |
||
| 78 | 78 | $this->api = $api; |
| 79 | 79 | $this->token_storage = $tokenStorage; |
| 80 | 80 | if ($this->token_storage->getToken() && is_object($this->token_storage->getToken()->getUser()) && $this->token_storage->getToken()->getUser()->getUser()) { |
| 81 | - $this->user = $this->token_storage->getToken()->getUser()->getUser(); |
|
| 82 | - } |
|
| 81 | + $this->user = $this->token_storage->getToken()->getUser()->getUser(); |
|
| 82 | + } |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | public function onKernelController() |
@@ -120,14 +120,14 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | throw new AccessDeniedException("No access"); |
| 122 | 122 | } else if ($api && strpos($route, "login") === false && strpos($route, "register") === false) { |
| 123 | - if ($this->api->userIslogged($this->request->getCurrentRequest()->get("infos"), $this->request->getCurrentRequest()->get("token")) === false) { |
|
| 124 | - throw new AccessDeniedException("User is not connected"); |
|
| 125 | - } |
|
| 126 | - } |
|
| 123 | + if ($this->api->userIslogged($this->request->getCurrentRequest()->get("infos"), $this->request->getCurrentRequest()->get("token")) === false) { |
|
| 124 | + throw new AccessDeniedException("User is not connected"); |
|
| 125 | + } |
|
| 126 | + } |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /** |
| 130 | - * function that allow to test a right directly in the view |
|
| 130 | + * function that allow to test a right directly in the view |
|
| 131 | 131 | * @param string $right |
| 132 | 132 | * @return bool |
| 133 | 133 | */ |
@@ -138,9 +138,9 @@ discard block |
||
| 138 | 138 | |
| 139 | 139 | $all_rights = array_merge($user_rights, $list_rights); |
| 140 | 140 | |
| 141 | - if (in_array("*", $all_rights)) { |
|
| 142 | - return true; |
|
| 143 | - } |
|
| 141 | + if (in_array("*", $all_rights)) { |
|
| 142 | + return true; |
|
| 143 | + } |
|
| 144 | 144 | |
| 145 | 145 | if (in_array($right, $all_rights)) { |
| 146 | 146 | return true; |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | /** |
| 153 | - * test if route_right is found in users rights |
|
| 153 | + * test if route_right is found in users rights |
|
| 154 | 154 | * @param array $route_right |
| 155 | 155 | * @return bool |
| 156 | 156 | */ |
@@ -162,8 +162,8 @@ discard block |
||
| 162 | 162 | $all_rights = array_merge($user_rights, $list_rights); |
| 163 | 163 | |
| 164 | 164 | if (in_array("*", $all_rights)) { |
| 165 | - return true; |
|
| 166 | - } |
|
| 165 | + return true; |
|
| 166 | + } |
|
| 167 | 167 | |
| 168 | 168 | foreach ($all_rights as $right) { |
| 169 | 169 | if (in_array($right, $route_right)) { |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | /** |
| 178 | - * function that search if the right contain an url or more |
|
| 178 | + * function that search if the right contain an url or more |
|
| 179 | 179 | * @param $needle |
| 180 | 180 | * @param $haystack |
| 181 | 181 | * @return bool|mixed |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | /** |
| 202 | - * function that retun a array that contain all user rights or empty array if no right found |
|
| 202 | + * function that retun a array that contain all user rights or empty array if no right found |
|
| 203 | 203 | * @return array |
| 204 | 204 | */ |
| 205 | 205 | private function getUserRights(): array |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | /** |
| 217 | - * function that retun a array that contain all rights of rattached list right of the current user |
|
| 217 | + * function that retun a array that contain all rights of rattached list right of the current user |
|
| 218 | 218 | * @return array |
| 219 | 219 | */ |
| 220 | 220 | private function getRightsListOfUser(): array |