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