@@ -12,11 +12,11 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | private $container; |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * GuidAwareListener constructor. |
|
| 17 | - * @param ContainerInterface $container |
|
| 18 | - */ |
|
| 19 | - public function __construct(ContainerInterface $container) |
|
| 15 | + /** |
|
| 16 | + * GuidAwareListener constructor. |
|
| 17 | + * @param ContainerInterface $container |
|
| 18 | + */ |
|
| 19 | + public function __construct(ContainerInterface $container) |
|
| 20 | 20 | { |
| 21 | 21 | $this->container = $container; |
| 22 | 22 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | - * method that return all infos needed in access right management page |
|
| 25 | + * method that return all infos needed in access right management page |
|
| 26 | 26 | * @return array |
| 27 | 27 | */ |
| 28 | 28 | public function getAllInfosModules() |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | - * function that return all modules rights |
|
| 47 | + * function that return all modules rights |
|
| 48 | 48 | * @return object |
| 49 | 49 | */ |
| 50 | 50 | public function getModuleRights() |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | foreach ($modules as $module) { |
| 37 | 37 | $modules_data[] = [ |
| 38 | 38 | "name" => $module->getTitle(), |
| 39 | - "rights" => (array)json_decode(file_get_contents($this->globals->getBaseBundlePath($module->getPackageName()) . "/Resources/json/ribsadmin_rights.json")) |
|
| 39 | + "rights" => (array) json_decode(file_get_contents($this->globals->getBaseBundlePath($module->getPackageName()) . "/Resources/json/ribsadmin_rights.json")) |
|
| 40 | 40 | ]; |
| 41 | 41 | } |
| 42 | 42 | |
@@ -59,6 +59,6 @@ discard block |
||
| 59 | 59 | $rights[] = json_decode(file_get_contents($this->globals->getBaseBundlePath($module->getPackageName()) . "/Resources/json/ribsadmin_rights.json")); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - return (object)$rights; |
|
| 62 | + return (object) $rights; |
|
| 63 | 63 | } |
| 64 | 64 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | - * this method is used to test jwt and if the user is ok else send false |
|
| 35 | + * this method is used to test jwt and if the user is ok else send false |
|
| 36 | 36 | * @param string $infos_jwt |
| 37 | 37 | * @param string $token |
| 38 | 38 | * @return Account|bool |
@@ -58,12 +58,12 @@ discard block |
||
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * method that return the token for a user |
|
| 63 | - * @param Account $account |
|
| 64 | - * @return string |
|
| 65 | - * @throws \Exception |
|
| 66 | - */ |
|
| 61 | + /** |
|
| 62 | + * method that return the token for a user |
|
| 63 | + * @param Account $account |
|
| 64 | + * @return string |
|
| 65 | + * @throws \Exception |
|
| 66 | + */ |
|
| 67 | 67 | public function getToken(Account $account): string |
| 68 | 68 | { |
| 69 | 69 | $token = $account->getToken(); |
@@ -76,12 +76,12 @@ discard block |
||
| 76 | 76 | return $token; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - /** |
|
| 80 | - * method that set a toek for the user |
|
| 81 | - * @param Account $account |
|
| 82 | - * @return string |
|
| 83 | - * @throws \Exception |
|
| 84 | - */ |
|
| 79 | + /** |
|
| 80 | + * method that set a toek for the user |
|
| 81 | + * @param Account $account |
|
| 82 | + * @return string |
|
| 83 | + * @throws \Exception |
|
| 84 | + */ |
|
| 85 | 85 | public function setToken(Account $account): string |
| 86 | 86 | { |
| 87 | 87 | $token = $this->generateToken(); |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
| 101 | - * generate a token for api |
|
| 101 | + * generate a token for api |
|
| 102 | 102 | * @param int $length |
| 103 | 103 | * @return string |
| 104 | 104 | */ |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | /** |
| 109 | - * function that allow to test a right directly in the view |
|
| 109 | + * function that allow to test a right directly in the view |
|
| 110 | 110 | * @param string $right |
| 111 | 111 | * @return bool |
| 112 | 112 | */ |
@@ -117,9 +117,9 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | $all_rights = array_merge($user_rights, $list_rights); |
| 119 | 119 | |
| 120 | - if (in_array("*", $all_rights)) { |
|
| 121 | - return true; |
|
| 122 | - } |
|
| 120 | + if (in_array("*", $all_rights)) { |
|
| 121 | + return true; |
|
| 122 | + } |
|
| 123 | 123 | |
| 124 | 124 | if (in_array($right, $all_rights)) { |
| 125 | 125 | return true; |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
| 132 | - * test if route_right is found in users rights |
|
| 132 | + * test if route_right is found in users rights |
|
| 133 | 133 | * @param array $route_right |
| 134 | 134 | * @return bool |
| 135 | 135 | */ |
@@ -141,8 +141,8 @@ discard block |
||
| 141 | 141 | $all_rights = array_merge($user_rights, $list_rights); |
| 142 | 142 | |
| 143 | 143 | if (in_array("*", $all_rights)) { |
| 144 | - return true; |
|
| 145 | - } |
|
| 144 | + return true; |
|
| 145 | + } |
|
| 146 | 146 | |
| 147 | 147 | foreach ($all_rights as $right) { |
| 148 | 148 | if (in_array($right, $route_right)) { |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | /** |
| 157 | - * function that search if the right contain an url or more |
|
| 157 | + * function that search if the right contain an url or more |
|
| 158 | 158 | * @param $needle |
| 159 | 159 | * @param $haystack |
| 160 | 160 | * @return bool|mixed |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | /** |
| 181 | - * function that retun a array that contain all user rights or empty array if no right found |
|
| 181 | + * function that retun a array that contain all user rights or empty array if no right found |
|
| 182 | 182 | * @return array |
| 183 | 183 | */ |
| 184 | 184 | private function getUserRights(): array |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | /** |
| 196 | - * function that retun a array that contain all rights of rattached list right of the current user |
|
| 196 | + * function that retun a array that contain all rights of rattached list right of the current user |
|
| 197 | 197 | * @return array |
| 198 | 198 | */ |
| 199 | 199 | private function getRightsListOfUser(): array |
@@ -79,7 +79,7 @@ |
||
| 79 | 79 | |
| 80 | 80 | $ribs_admin_rights = json_decode(file_get_contents($this->globals->getBaseBundlePath() . "/Resources/json/ribsadmin_rights.json")); |
| 81 | 81 | $modules_rights = $this->module->getModuleRights(); |
| 82 | - $ribs_admin_rights = (object)array_merge((array)$ribs_admin_rights, (array)$modules_rights); |
|
| 82 | + $ribs_admin_rights = (object) array_merge((array) $ribs_admin_rights, (array) $modules_rights); |
|
| 83 | 83 | |
| 84 | 84 | if ($admin_page == "ribsadmin" && $api !== "api" && strpos($route, "login") === false && strpos($route, "register") === false) { |
| 85 | 85 | //redirection if user not connected |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | class Jwt |
| 8 | 8 | { |
| 9 | 9 | /** |
| 10 | - * encode an array in jwt |
|
| 10 | + * encode an array in jwt |
|
| 11 | 11 | * @param array $values |
| 12 | 12 | * @param string $token |
| 13 | 13 | * @return string |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | - * encode a jwt in array |
|
| 21 | + * encode a jwt in array |
|
| 22 | 22 | * @param string $encoded_json |
| 23 | 23 | * @param string $token |
| 24 | 24 | * @return bool|object |
@@ -11,11 +11,11 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | private $container; |
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * Globals constructor. |
|
| 16 | - * @param ContainerInterface $container |
|
| 17 | - */ |
|
| 18 | - public function __construct(ContainerInterface $container) |
|
| 14 | + /** |
|
| 15 | + * Globals constructor. |
|
| 16 | + * @param ContainerInterface $container |
|
| 17 | + */ |
|
| 18 | + public function __construct(ContainerInterface $container) |
|
| 19 | 19 | { |
| 20 | 20 | $this->container = $container; |
| 21 | 21 | } |
@@ -51,9 +51,9 @@ |
||
| 51 | 51 | $dev_mode = $this->container->getParameter("ribs_admin")["dev_mode"]; |
| 52 | 52 | |
| 53 | 53 | if ($dev_mode === true) { |
| 54 | - $package = "lib/".$this->getPackageDevName($package); |
|
| 54 | + $package = "lib/" . $this->getPackageDevName($package); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - return implode("/", $path)."/../../" . $package; |
|
| 57 | + return implode("/", $path) . "/../../" . $package; |
|
| 58 | 58 | } |
| 59 | 59 | } |
@@ -33,13 +33,13 @@ discard block |
||
| 33 | 33 | ]); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * @Route("/accounts/create/", name="ribsadmin_accounts_create") |
|
| 38 | - * @Route("/accounts/edit/{guid}", name="ribsadmin_accounts_edit") |
|
| 39 | - * @param Request $request |
|
| 40 | - * @param string|null $guid |
|
| 41 | - * @return Response |
|
| 42 | - */ |
|
| 36 | + /** |
|
| 37 | + * @Route("/accounts/create/", name="ribsadmin_accounts_create") |
|
| 38 | + * @Route("/accounts/edit/{guid}", name="ribsadmin_accounts_edit") |
|
| 39 | + * @param Request $request |
|
| 40 | + * @param string|null $guid |
|
| 41 | + * @return Response |
|
| 42 | + */ |
|
| 43 | 43 | public function editUserAction(Request $request, string $guid = null): Response |
| 44 | 44 | { |
| 45 | 45 | $em = $this->getDoctrine()->getManager(); |
@@ -47,11 +47,11 @@ discard block |
||
| 47 | 47 | if ($guid === null) { |
| 48 | 48 | $account = new Account(); |
| 49 | 49 | $old_password = null; |
| 50 | - $user = null; |
|
| 50 | + $user = null; |
|
| 51 | 51 | } else { |
| 52 | 52 | $user = $em->getRepository(User::class)->findOneBy(["guid" => $guid]); |
| 53 | 53 | $account = $em->getRepository(Account::class)->findOneBy(["user" => $user->getId()]); |
| 54 | - $old_password = $account->getPassword(); |
|
| 54 | + $old_password = $account->getPassword(); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | $form = $this->createForm("PiouPiou\RibsAdminBundle\Form\Account", $account); |
@@ -71,15 +71,15 @@ discard block |
||
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | if (!$account_exist) { |
| 74 | - if ($guid === null) { |
|
| 75 | - $temp_password = $this->get("security.password_encoder")->encodePassword($data, $form->get("password")->getData()); |
|
| 76 | - $data->setPassword($temp_password); |
|
| 77 | - } else if ($form->get("password")->getData()) { |
|
| 78 | - $temp_password = $this->get("security.password_encoder")->encodePassword($data, $form->get("password")->getData()); |
|
| 79 | - $data->setPassword($temp_password); |
|
| 80 | - } else { |
|
| 81 | - $data->setPassword($old_password); |
|
| 82 | - } |
|
| 74 | + if ($guid === null) { |
|
| 75 | + $temp_password = $this->get("security.password_encoder")->encodePassword($data, $form->get("password")->getData()); |
|
| 76 | + $data->setPassword($temp_password); |
|
| 77 | + } else if ($form->get("password")->getData()) { |
|
| 78 | + $temp_password = $this->get("security.password_encoder")->encodePassword($data, $form->get("password")->getData()); |
|
| 79 | + $data->setPassword($temp_password); |
|
| 80 | + } else { |
|
| 81 | + $data->setPassword($old_password); |
|
| 82 | + } |
|
| 83 | 83 | |
| 84 | 84 | $em->persist($data); |
| 85 | 85 | $em->flush(); |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | return $this->render("@RibsAdmin/accounts/edit.html.twig", [ |
| 103 | 103 | "form" => $form->createView(), |
| 104 | - "user" => $user |
|
| 104 | + "user" => $user |
|
| 105 | 105 | ]); |
| 106 | 106 | } |
| 107 | 107 | //-------------------------------------------- END DISPLAY VIEWS -----------------------------------------------------------// |
@@ -8,11 +8,11 @@ |
||
| 8 | 8 | |
| 9 | 9 | class PageController extends Controller |
| 10 | 10 | { |
| 11 | - /** |
|
| 12 | - * method to show index page of content management |
|
| 13 | - * @Route("/contents", name="ribsadmin_contents") |
|
| 14 | - * @return Response |
|
| 15 | - */ |
|
| 11 | + /** |
|
| 12 | + * method to show index page of content management |
|
| 13 | + * @Route("/contents", name="ribsadmin_contents") |
|
| 14 | + * @return Response |
|
| 15 | + */ |
|
| 16 | 16 | public function indexAction(): Response |
| 17 | 17 | { |
| 18 | 18 | $navigation = $this->getDoctrine()->getManager()->getRepository("RibsAdminBundle:Navigation")->findAllNavigationPage(); |
@@ -9,11 +9,11 @@ |
||
| 9 | 9 | |
| 10 | 10 | class RenderPageController extends Controller |
| 11 | 11 | { |
| 12 | - /** |
|
| 13 | - * @Route("/page/{url}", name="page", requirements={"url" = "[a-zA-Z0-9\-\_\/]*"}) |
|
| 14 | - * @param string $url |
|
| 15 | - * @return Response |
|
| 16 | - */ |
|
| 12 | + /** |
|
| 13 | + * @Route("/page/{url}", name="page", requirements={"url" = "[a-zA-Z0-9\-\_\/]*"}) |
|
| 14 | + * @param string $url |
|
| 15 | + * @return Response |
|
| 16 | + */ |
|
| 17 | 17 | public function renderPageAction(string $url): Response |
| 18 | 18 | { |
| 19 | 19 | $em = $this->getDoctrine()->getManager(); |