@@ -10,35 +10,35 @@ |
||
10 | 10 | |
11 | 11 | class AutocompleteType extends AbstractType |
12 | 12 | { |
13 | - /** |
|
14 | - * @param FormBuilderInterface $builder |
|
15 | - * @param array $options |
|
16 | - */ |
|
17 | - public function buildForm(FormBuilderInterface $builder, array $options) |
|
18 | - { |
|
19 | - $builder |
|
20 | - ->add($options["autocomplete_name"], TextType::class, [ |
|
21 | - "label" => false, |
|
22 | - "attr" => [ |
|
23 | - "class" => "input-autocomplete", |
|
24 | - "data-url" => $options["data_url"], |
|
25 | - "autocomplete" => "off" |
|
26 | - ], |
|
27 | - "mapped" => false |
|
28 | - ]) |
|
29 | - ->add($options["autocomplete_name"] . "_id", HiddenType::class, [ |
|
30 | - "mapped" => false |
|
31 | - ]); |
|
32 | - } |
|
13 | + /** |
|
14 | + * @param FormBuilderInterface $builder |
|
15 | + * @param array $options |
|
16 | + */ |
|
17 | + public function buildForm(FormBuilderInterface $builder, array $options) |
|
18 | + { |
|
19 | + $builder |
|
20 | + ->add($options["autocomplete_name"], TextType::class, [ |
|
21 | + "label" => false, |
|
22 | + "attr" => [ |
|
23 | + "class" => "input-autocomplete", |
|
24 | + "data-url" => $options["data_url"], |
|
25 | + "autocomplete" => "off" |
|
26 | + ], |
|
27 | + "mapped" => false |
|
28 | + ]) |
|
29 | + ->add($options["autocomplete_name"] . "_id", HiddenType::class, [ |
|
30 | + "mapped" => false |
|
31 | + ]); |
|
32 | + } |
|
33 | 33 | |
34 | - /** |
|
35 | - * @param OptionsResolver $resolver |
|
36 | - */ |
|
37 | - public function configureOptions(OptionsResolver $resolver) |
|
38 | - { |
|
39 | - $resolver->setDefaults([ |
|
40 | - "autocomplete_name" => null, |
|
41 | - "data_url" => null, |
|
42 | - ]); |
|
43 | - } |
|
34 | + /** |
|
35 | + * @param OptionsResolver $resolver |
|
36 | + */ |
|
37 | + public function configureOptions(OptionsResolver $resolver) |
|
38 | + { |
|
39 | + $resolver->setDefaults([ |
|
40 | + "autocomplete_name" => null, |
|
41 | + "data_url" => null, |
|
42 | + ]); |
|
43 | + } |
|
44 | 44 | } |
@@ -34,10 +34,10 @@ discard block |
||
34 | 34 | $this->tokenStorage = $tokenStorage; |
35 | 35 | } |
36 | 36 | |
37 | - /** |
|
38 | - * @param FormBuilderInterface $builder |
|
39 | - * @param array $options |
|
40 | - */ |
|
37 | + /** |
|
38 | + * @param FormBuilderInterface $builder |
|
39 | + * @param array $options |
|
40 | + */ |
|
41 | 41 | public function buildForm(FormBuilderInterface $builder, array $options) |
42 | 42 | { |
43 | 43 | $access_rights_lists = $this->em->getRepository(\PiouPiou\RibsAdminBundle\Entity\AccessRight::class)->findAll(); |
@@ -70,9 +70,9 @@ discard block |
||
70 | 70 | ]); |
71 | 71 | } |
72 | 72 | |
73 | - /** |
|
74 | - * @param OptionsResolver $resolver |
|
75 | - */ |
|
73 | + /** |
|
74 | + * @param OptionsResolver $resolver |
|
75 | + */ |
|
76 | 76 | public function configureOptions(OptionsResolver $resolver) |
77 | 77 | { |
78 | 78 | $resolver->setDefaults([ |
@@ -10,10 +10,10 @@ discard block |
||
10 | 10 | |
11 | 11 | class AccessRight extends AbstractType |
12 | 12 | { |
13 | - /** |
|
14 | - * @param FormBuilderInterface $builder |
|
15 | - * @param array $options |
|
16 | - */ |
|
13 | + /** |
|
14 | + * @param FormBuilderInterface $builder |
|
15 | + * @param array $options |
|
16 | + */ |
|
17 | 17 | public function buildForm(FormBuilderInterface $builder, array $options) |
18 | 18 | { |
19 | 19 | $builder |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | ]); |
29 | 29 | } |
30 | 30 | |
31 | - /** |
|
32 | - * @param OptionsResolver $resolver |
|
33 | - */ |
|
31 | + /** |
|
32 | + * @param OptionsResolver $resolver |
|
33 | + */ |
|
34 | 34 | public function configureOptions(OptionsResolver $resolver) |
35 | 35 | { |
36 | 36 | $resolver->setDefaults([ |
@@ -7,21 +7,21 @@ |
||
7 | 7 | |
8 | 8 | class AccountRepository extends EntityRepository |
9 | 9 | { |
10 | - /** |
|
11 | - * function that return a list of all users that are not archived and different of current account |
|
12 | - * @param User $current_account |
|
13 | - * @param bool $archived |
|
14 | - * @return array |
|
15 | - */ |
|
16 | - public function findAllUserArchived(User $current_account, bool $archived = false): array |
|
17 | - { |
|
18 | - $query = $this->getEntityManager()->createQuery("SELECT fu FROM RibsAdminBundle:Account fu |
|
10 | + /** |
|
11 | + * function that return a list of all users that are not archived and different of current account |
|
12 | + * @param User $current_account |
|
13 | + * @param bool $archived |
|
14 | + * @return array |
|
15 | + */ |
|
16 | + public function findAllUserArchived(User $current_account, bool $archived = false): array |
|
17 | + { |
|
18 | + $query = $this->getEntityManager()->createQuery("SELECT fu FROM RibsAdminBundle:Account fu |
|
19 | 19 | JOIN RibsAdminBundle:User u WITH fu.user = u |
20 | 20 | WHERE u.archived = :archived and u != :current_account |
21 | 21 | ") |
22 | - ->setParameter("archived", $archived) |
|
23 | - ->setParameter("current_account", $current_account); |
|
22 | + ->setParameter("archived", $archived) |
|
23 | + ->setParameter("current_account", $current_account); |
|
24 | 24 | |
25 | - return $query->getResult(); |
|
26 | - } |
|
25 | + return $query->getResult(); |
|
26 | + } |
|
27 | 27 | } |
@@ -7,38 +7,38 @@ |
||
7 | 7 | |
8 | 8 | class NavigationRepository extends EntityRepository |
9 | 9 | { |
10 | - /** |
|
11 | - * function that return all navigation links of pages and modules |
|
12 | - * @return array |
|
13 | - * @throws DBALException |
|
14 | - */ |
|
15 | - public function findAllNavigation(): array |
|
16 | - { |
|
17 | - $query = $this->getEntityManager()->getConnection()->prepare("SELECT p.url, p.title, p.title_tag FROM navigation n |
|
10 | + /** |
|
11 | + * function that return all navigation links of pages and modules |
|
12 | + * @return array |
|
13 | + * @throws DBALException |
|
14 | + */ |
|
15 | + public function findAllNavigation(): array |
|
16 | + { |
|
17 | + $query = $this->getEntityManager()->getConnection()->prepare("SELECT p.url, p.title, p.title_tag FROM navigation n |
|
18 | 18 | LEFT JOIN page p ON n.id_page = p.id AND p.displayed = 1 |
19 | 19 | LEFT JOIN module m ON n.id_module = m.id AND m.displayed = 1 |
20 | 20 | ORDER BY n.order ASC |
21 | 21 | "); |
22 | 22 | |
23 | - $query->execute(); |
|
23 | + $query->execute(); |
|
24 | 24 | |
25 | - return $query->fetchAll(\PDO::FETCH_ASSOC); |
|
26 | - } |
|
25 | + return $query->fetchAll(\PDO::FETCH_ASSOC); |
|
26 | + } |
|
27 | 27 | |
28 | - /** |
|
29 | - * function that return all navigation links of pages |
|
30 | - * @return array |
|
31 | - * @throws DBALException |
|
32 | - */ |
|
33 | - public function findAllNavigationPage(): array |
|
34 | - { |
|
35 | - $query = $this->getEntityManager()->getConnection()->prepare("SELECT p.url, p.title, p.title_tag FROM navigation n |
|
28 | + /** |
|
29 | + * function that return all navigation links of pages |
|
30 | + * @return array |
|
31 | + * @throws DBALException |
|
32 | + */ |
|
33 | + public function findAllNavigationPage(): array |
|
34 | + { |
|
35 | + $query = $this->getEntityManager()->getConnection()->prepare("SELECT p.url, p.title, p.title_tag FROM navigation n |
|
36 | 36 | INNER JOIN page p ON n.id_page = p.id AND p.displayed = 1 |
37 | 37 | ORDER BY n.order ASC |
38 | 38 | "); |
39 | 39 | |
40 | - $query->execute(); |
|
40 | + $query->execute(); |
|
41 | 41 | |
42 | - return $query->fetchAll(\PDO::FETCH_ASSOC); |
|
43 | - } |
|
42 | + return $query->fetchAll(\PDO::FETCH_ASSOC); |
|
43 | + } |
|
44 | 44 | } |
@@ -8,33 +8,33 @@ |
||
8 | 8 | |
9 | 9 | class AccessRightRepository extends EntityRepository |
10 | 10 | { |
11 | - /** |
|
12 | - * function that delete all user which are in a list of rights |
|
13 | - * @param AccessRight $access_right |
|
14 | - * @throws DBALException |
|
15 | - */ |
|
16 | - public function deleteAllUsersList(AccessRight $access_right) |
|
17 | - { |
|
18 | - $query = $this->getEntityManager()->getConnection()->prepare("UPDATE user SET id_access_right = NULL WHERE |
|
11 | + /** |
|
12 | + * function that delete all user which are in a list of rights |
|
13 | + * @param AccessRight $access_right |
|
14 | + * @throws DBALException |
|
15 | + */ |
|
16 | + public function deleteAllUsersList(AccessRight $access_right) |
|
17 | + { |
|
18 | + $query = $this->getEntityManager()->getConnection()->prepare("UPDATE user SET id_access_right = NULL WHERE |
|
19 | 19 | id_access_right = :id_access_right |
20 | 20 | "); |
21 | - $query->bindValue("id_access_right", $access_right->getId()); |
|
22 | - $query->execute(); |
|
23 | - } |
|
21 | + $query->bindValue("id_access_right", $access_right->getId()); |
|
22 | + $query->execute(); |
|
23 | + } |
|
24 | 24 | |
25 | - /** |
|
26 | - * function that add a user in an access right list |
|
27 | - * @param int $access_right_id |
|
28 | - * @param string $guid_admin |
|
29 | - * @throws DBALException |
|
30 | - */ |
|
31 | - public function setAccessRightListUser(int $access_right_id, string $guid_admin) |
|
32 | - { |
|
33 | - $query = $this->getEntityManager()->getConnection()->prepare("UPDATE user SET id_access_right = :id_access_right WHERE |
|
25 | + /** |
|
26 | + * function that add a user in an access right list |
|
27 | + * @param int $access_right_id |
|
28 | + * @param string $guid_admin |
|
29 | + * @throws DBALException |
|
30 | + */ |
|
31 | + public function setAccessRightListUser(int $access_right_id, string $guid_admin) |
|
32 | + { |
|
33 | + $query = $this->getEntityManager()->getConnection()->prepare("UPDATE user SET id_access_right = :id_access_right WHERE |
|
34 | 34 | guid = :guid_user |
35 | 35 | "); |
36 | - $query->bindValue("id_access_right", $access_right_id, \PDO::PARAM_INT); |
|
37 | - $query->bindValue("guid_user", $guid_admin, \PDO::PARAM_STR); |
|
38 | - $query->execute(); |
|
39 | - } |
|
36 | + $query->bindValue("id_access_right", $access_right_id, \PDO::PARAM_INT); |
|
37 | + $query->bindValue("guid_user", $guid_admin, \PDO::PARAM_STR); |
|
38 | + $query->execute(); |
|
39 | + } |
|
40 | 40 | } |
@@ -16,156 +16,156 @@ |
||
16 | 16 | */ |
17 | 17 | class AccountToken |
18 | 18 | { |
19 | - use GuidTrait; |
|
20 | - |
|
21 | - /** |
|
22 | - * @ORM\Id |
|
23 | - * @ORM\Column(type="integer") |
|
24 | - * @ORM\GeneratedValue(strategy="AUTO") |
|
25 | - */ |
|
26 | - protected $id; |
|
27 | - |
|
28 | - /** |
|
29 | - * @ORM\Column(type="string", length=200) |
|
30 | - */ |
|
31 | - protected $token; |
|
32 | - |
|
33 | - /** |
|
34 | - * @ORM\Column(type="datetime", nullable=true) |
|
35 | - */ |
|
36 | - protected $endToken; |
|
37 | - |
|
38 | - /** |
|
39 | - * @ORM\Column(type="string", length=200) |
|
40 | - */ |
|
41 | - protected $userAgent; |
|
42 | - |
|
43 | - /** |
|
44 | - * @ORM\Column(type="string", length=200) |
|
45 | - */ |
|
46 | - protected $ip; |
|
47 | - |
|
48 | - /** |
|
49 | - * @ORM\ManyToOne(targetEntity="Account", inversedBy="tokens") |
|
50 | - * @ORM\JoinColumn(name="account_id", referencedColumnName="id", nullable=false) |
|
51 | - */ |
|
52 | - protected $account; |
|
53 | - |
|
54 | - /** |
|
55 | - * @return mixed |
|
56 | - */ |
|
57 | - public function getId() |
|
58 | - { |
|
59 | - return $this->id; |
|
60 | - } |
|
61 | - |
|
62 | - /** |
|
63 | - * @param mixed $id |
|
64 | - * @return AccountToken |
|
65 | - */ |
|
66 | - public function setId($id) |
|
67 | - { |
|
68 | - $this->id = $id; |
|
69 | - |
|
70 | - return $this; |
|
71 | - } |
|
72 | - |
|
73 | - /** |
|
74 | - * @return mixed |
|
75 | - */ |
|
76 | - public function getToken() |
|
77 | - { |
|
78 | - return $this->token; |
|
79 | - } |
|
80 | - |
|
81 | - /** |
|
82 | - * @param mixed $token |
|
83 | - * @return AccountToken |
|
84 | - */ |
|
85 | - public function setToken($token) |
|
86 | - { |
|
87 | - $this->token = $token; |
|
88 | - |
|
89 | - return $this; |
|
90 | - } |
|
91 | - |
|
92 | - /** |
|
93 | - * @return mixed |
|
94 | - */ |
|
95 | - public function getEndToken() |
|
96 | - { |
|
97 | - return $this->endToken; |
|
98 | - } |
|
99 | - |
|
100 | - /** |
|
101 | - * @param mixed $endToken |
|
102 | - * @return AccountToken |
|
103 | - */ |
|
104 | - public function setEndToken($endToken) |
|
105 | - { |
|
106 | - $this->endToken = $endToken; |
|
107 | - |
|
108 | - return $this; |
|
109 | - } |
|
110 | - |
|
111 | - /** |
|
112 | - * @return mixed |
|
113 | - */ |
|
114 | - public function getUserAgent() |
|
115 | - { |
|
116 | - return $this->userAgent; |
|
117 | - } |
|
118 | - |
|
119 | - /** |
|
120 | - * @param mixed $userAgent |
|
121 | - * @return AccountToken |
|
122 | - */ |
|
123 | - public function setUserAgent($userAgent) |
|
124 | - { |
|
125 | - $this->userAgent = $userAgent; |
|
126 | - |
|
127 | - return $this; |
|
128 | - } |
|
129 | - |
|
130 | - /** |
|
131 | - * @return mixed |
|
132 | - */ |
|
133 | - public function getIp() |
|
134 | - { |
|
135 | - return $this->ip; |
|
136 | - } |
|
137 | - |
|
138 | - /** |
|
139 | - * @param mixed $ip |
|
140 | - * @return AccountToken |
|
141 | - */ |
|
142 | - public function setIp($ip) |
|
143 | - { |
|
144 | - $this->ip = $ip; |
|
145 | - |
|
146 | - return $this; |
|
147 | - } |
|
148 | - |
|
149 | - /** |
|
150 | - * Set Account entity (many to one). |
|
151 | - * |
|
152 | - * @param Account $account |
|
153 | - * @return AccountToken |
|
154 | - */ |
|
155 | - public function setAccount(Account $account = null) |
|
156 | - { |
|
157 | - $this->account = $account; |
|
158 | - |
|
159 | - return $this; |
|
160 | - } |
|
161 | - |
|
162 | - /** |
|
163 | - * Get Account entity (many to one). |
|
164 | - * |
|
165 | - * @return Account |
|
166 | - */ |
|
167 | - public function getAccount() |
|
168 | - { |
|
169 | - return $this->account; |
|
170 | - } |
|
19 | + use GuidTrait; |
|
20 | + |
|
21 | + /** |
|
22 | + * @ORM\Id |
|
23 | + * @ORM\Column(type="integer") |
|
24 | + * @ORM\GeneratedValue(strategy="AUTO") |
|
25 | + */ |
|
26 | + protected $id; |
|
27 | + |
|
28 | + /** |
|
29 | + * @ORM\Column(type="string", length=200) |
|
30 | + */ |
|
31 | + protected $token; |
|
32 | + |
|
33 | + /** |
|
34 | + * @ORM\Column(type="datetime", nullable=true) |
|
35 | + */ |
|
36 | + protected $endToken; |
|
37 | + |
|
38 | + /** |
|
39 | + * @ORM\Column(type="string", length=200) |
|
40 | + */ |
|
41 | + protected $userAgent; |
|
42 | + |
|
43 | + /** |
|
44 | + * @ORM\Column(type="string", length=200) |
|
45 | + */ |
|
46 | + protected $ip; |
|
47 | + |
|
48 | + /** |
|
49 | + * @ORM\ManyToOne(targetEntity="Account", inversedBy="tokens") |
|
50 | + * @ORM\JoinColumn(name="account_id", referencedColumnName="id", nullable=false) |
|
51 | + */ |
|
52 | + protected $account; |
|
53 | + |
|
54 | + /** |
|
55 | + * @return mixed |
|
56 | + */ |
|
57 | + public function getId() |
|
58 | + { |
|
59 | + return $this->id; |
|
60 | + } |
|
61 | + |
|
62 | + /** |
|
63 | + * @param mixed $id |
|
64 | + * @return AccountToken |
|
65 | + */ |
|
66 | + public function setId($id) |
|
67 | + { |
|
68 | + $this->id = $id; |
|
69 | + |
|
70 | + return $this; |
|
71 | + } |
|
72 | + |
|
73 | + /** |
|
74 | + * @return mixed |
|
75 | + */ |
|
76 | + public function getToken() |
|
77 | + { |
|
78 | + return $this->token; |
|
79 | + } |
|
80 | + |
|
81 | + /** |
|
82 | + * @param mixed $token |
|
83 | + * @return AccountToken |
|
84 | + */ |
|
85 | + public function setToken($token) |
|
86 | + { |
|
87 | + $this->token = $token; |
|
88 | + |
|
89 | + return $this; |
|
90 | + } |
|
91 | + |
|
92 | + /** |
|
93 | + * @return mixed |
|
94 | + */ |
|
95 | + public function getEndToken() |
|
96 | + { |
|
97 | + return $this->endToken; |
|
98 | + } |
|
99 | + |
|
100 | + /** |
|
101 | + * @param mixed $endToken |
|
102 | + * @return AccountToken |
|
103 | + */ |
|
104 | + public function setEndToken($endToken) |
|
105 | + { |
|
106 | + $this->endToken = $endToken; |
|
107 | + |
|
108 | + return $this; |
|
109 | + } |
|
110 | + |
|
111 | + /** |
|
112 | + * @return mixed |
|
113 | + */ |
|
114 | + public function getUserAgent() |
|
115 | + { |
|
116 | + return $this->userAgent; |
|
117 | + } |
|
118 | + |
|
119 | + /** |
|
120 | + * @param mixed $userAgent |
|
121 | + * @return AccountToken |
|
122 | + */ |
|
123 | + public function setUserAgent($userAgent) |
|
124 | + { |
|
125 | + $this->userAgent = $userAgent; |
|
126 | + |
|
127 | + return $this; |
|
128 | + } |
|
129 | + |
|
130 | + /** |
|
131 | + * @return mixed |
|
132 | + */ |
|
133 | + public function getIp() |
|
134 | + { |
|
135 | + return $this->ip; |
|
136 | + } |
|
137 | + |
|
138 | + /** |
|
139 | + * @param mixed $ip |
|
140 | + * @return AccountToken |
|
141 | + */ |
|
142 | + public function setIp($ip) |
|
143 | + { |
|
144 | + $this->ip = $ip; |
|
145 | + |
|
146 | + return $this; |
|
147 | + } |
|
148 | + |
|
149 | + /** |
|
150 | + * Set Account entity (many to one). |
|
151 | + * |
|
152 | + * @param Account $account |
|
153 | + * @return AccountToken |
|
154 | + */ |
|
155 | + public function setAccount(Account $account = null) |
|
156 | + { |
|
157 | + $this->account = $account; |
|
158 | + |
|
159 | + return $this; |
|
160 | + } |
|
161 | + |
|
162 | + /** |
|
163 | + * Get Account entity (many to one). |
|
164 | + * |
|
165 | + * @return Account |
|
166 | + */ |
|
167 | + public function getAccount() |
|
168 | + { |
|
169 | + return $this->account; |
|
170 | + } |
|
171 | 171 | } |
@@ -96,7 +96,7 @@ |
||
96 | 96 | |
97 | 97 | $ribs_admin_rights = json_decode(file_get_contents($this->globals->getBaseBundlePath() . "/Resources/json/ribsadmin_rights.json")); |
98 | 98 | $modules_rights = $this->module->getModuleRights(); |
99 | - $ribs_admin_rights = (object)array_merge((array)$ribs_admin_rights, (array)$modules_rights); |
|
99 | + $ribs_admin_rights = (object) array_merge((array) $ribs_admin_rights, (array) $modules_rights); |
|
100 | 100 | |
101 | 101 | if ($admin_page == "ribsadmin" && !$api && strpos($route, "login") === false && strpos($route, "register") === false) { |
102 | 102 | //redirection if user not connected |
@@ -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 |
@@ -9,51 +9,51 @@ |
||
9 | 9 | |
10 | 10 | class UserLog |
11 | 11 | { |
12 | - /** |
|
13 | - * @var TokenStorageInterface |
|
14 | - */ |
|
15 | - private $token_storage; |
|
16 | - |
|
17 | - /** |
|
18 | - * @var EntityManagerInterface a |
|
19 | - */ |
|
20 | - private $em; |
|
21 | - |
|
22 | - public function __construct(TokenStorageInterface $token_storage, EntityManagerInterface $em) |
|
23 | - { |
|
24 | - $this->token_storage = $token_storage; |
|
25 | - $this->em = $em; |
|
26 | - } |
|
27 | - |
|
28 | - /** |
|
29 | - * @param RequestEvent $request_event |
|
30 | - */ |
|
31 | - public function onKernelRequest(RequestEvent $request_event) |
|
32 | - { |
|
33 | - if ($request_event->isMasterRequest()) { |
|
34 | - $user = null; |
|
35 | - if ($this->token_storage->getToken() && is_object($this->token_storage->getToken()->getUser()) && $this->token_storage->getToken()->getUser()->getUser()) { |
|
36 | - $user = $this->token_storage->getToken()->getUser()->getUser(); |
|
37 | - } |
|
38 | - $request = $request_event->getRequest(); |
|
39 | - $route = $request->get("_route"); |
|
40 | - |
|
41 | - if (in_array($route, ["_profiler", "_profiler_search_bar", "_wdt", "ribsadmin_userlogs", "ribsadmin_userlogs_show"])) { |
|
42 | - return; |
|
43 | - } |
|
44 | - |
|
45 | - if ($user) { |
|
46 | - $user_log = new UserLogs(); |
|
47 | - $user_log->setMethod($request->getMethod()); |
|
48 | - $user_log->setUser($user); |
|
49 | - $user_log->setRoute($request->get("_route")); |
|
50 | - $user_log->setUrl($request->getRequestUri()); |
|
51 | - $user_log->setFullUrl($request->getUri()); |
|
52 | - $user_log->setRequestFormat($request->getRequestFormat()); |
|
53 | - $user_log->setRequestParameters($request->request->all()); |
|
54 | - $this->em->persist($user_log); |
|
55 | - $this->em->flush(); |
|
56 | - } |
|
57 | - } |
|
58 | - } |
|
12 | + /** |
|
13 | + * @var TokenStorageInterface |
|
14 | + */ |
|
15 | + private $token_storage; |
|
16 | + |
|
17 | + /** |
|
18 | + * @var EntityManagerInterface a |
|
19 | + */ |
|
20 | + private $em; |
|
21 | + |
|
22 | + public function __construct(TokenStorageInterface $token_storage, EntityManagerInterface $em) |
|
23 | + { |
|
24 | + $this->token_storage = $token_storage; |
|
25 | + $this->em = $em; |
|
26 | + } |
|
27 | + |
|
28 | + /** |
|
29 | + * @param RequestEvent $request_event |
|
30 | + */ |
|
31 | + public function onKernelRequest(RequestEvent $request_event) |
|
32 | + { |
|
33 | + if ($request_event->isMasterRequest()) { |
|
34 | + $user = null; |
|
35 | + if ($this->token_storage->getToken() && is_object($this->token_storage->getToken()->getUser()) && $this->token_storage->getToken()->getUser()->getUser()) { |
|
36 | + $user = $this->token_storage->getToken()->getUser()->getUser(); |
|
37 | + } |
|
38 | + $request = $request_event->getRequest(); |
|
39 | + $route = $request->get("_route"); |
|
40 | + |
|
41 | + if (in_array($route, ["_profiler", "_profiler_search_bar", "_wdt", "ribsadmin_userlogs", "ribsadmin_userlogs_show"])) { |
|
42 | + return; |
|
43 | + } |
|
44 | + |
|
45 | + if ($user) { |
|
46 | + $user_log = new UserLogs(); |
|
47 | + $user_log->setMethod($request->getMethod()); |
|
48 | + $user_log->setUser($user); |
|
49 | + $user_log->setRoute($request->get("_route")); |
|
50 | + $user_log->setUrl($request->getRequestUri()); |
|
51 | + $user_log->setFullUrl($request->getUri()); |
|
52 | + $user_log->setRequestFormat($request->getRequestFormat()); |
|
53 | + $user_log->setRequestParameters($request->request->all()); |
|
54 | + $this->em->persist($user_log); |
|
55 | + $this->em->flush(); |
|
56 | + } |
|
57 | + } |
|
58 | + } |
|
59 | 59 | } |