@@ -20,7 +20,7 @@ |
||
20 | 20 | public function prePersist($entity) |
21 | 21 | { |
22 | 22 | if ($entity->getGuid() === null) { |
23 | - $entity->setGuid((string)Uuid::uuid4()); |
|
23 | + $entity->setGuid((string) Uuid::uuid4()); |
|
24 | 24 | } |
25 | 25 | } |
26 | 26 | } |
@@ -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 | } |
@@ -13,26 +13,26 @@ discard block |
||
13 | 13 | */ |
14 | 14 | class UserLogs |
15 | 15 | { |
16 | - /** |
|
17 | - * @var integer |
|
18 | - * |
|
19 | - * @ORM\Column(name="id", type="integer", nullable=false, options={"unsigned"=true}) |
|
20 | - * @ORM\Id |
|
21 | - * @ORM\GeneratedValue(strategy="NONE") |
|
22 | - */ |
|
23 | - private $id; |
|
16 | + /** |
|
17 | + * @var integer |
|
18 | + * |
|
19 | + * @ORM\Column(name="id", type="integer", nullable=false, options={"unsigned"=true}) |
|
20 | + * @ORM\Id |
|
21 | + * @ORM\GeneratedValue(strategy="NONE") |
|
22 | + */ |
|
23 | + private $id; |
|
24 | 24 | |
25 | - /** |
|
26 | - * @var \User |
|
27 | - * |
|
28 | - * @ORM\Id |
|
29 | - * @ORM\GeneratedValue(strategy="NONE") |
|
30 | - * @ORM\OneToOne(targetEntity="User") |
|
31 | - * @ORM\JoinColumns({ |
|
32 | - * @ORM\JoinColumn(name="user_id", referencedColumnName="id") |
|
33 | - * }) |
|
34 | - */ |
|
35 | - private $user; |
|
25 | + /** |
|
26 | + * @var \User |
|
27 | + * |
|
28 | + * @ORM\Id |
|
29 | + * @ORM\GeneratedValue(strategy="NONE") |
|
30 | + * @ORM\OneToOne(targetEntity="User") |
|
31 | + * @ORM\JoinColumns({ |
|
32 | + * @ORM\JoinColumn(name="user_id", referencedColumnName="id") |
|
33 | + * }) |
|
34 | + */ |
|
35 | + private $user; |
|
36 | 36 | |
37 | 37 | /** |
38 | 38 | * @var \DateTime |
@@ -50,37 +50,37 @@ discard block |
||
50 | 50 | */ |
51 | 51 | private $updateDate; |
52 | 52 | |
53 | - /** |
|
54 | - * @return int |
|
55 | - */ |
|
56 | - public function getId() |
|
57 | - { |
|
58 | - return $this->id; |
|
59 | - } |
|
53 | + /** |
|
54 | + * @return int |
|
55 | + */ |
|
56 | + public function getId() |
|
57 | + { |
|
58 | + return $this->id; |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * @param int $id |
|
63 | - */ |
|
64 | - public function setId($id) |
|
65 | - { |
|
66 | - $this->id = $id; |
|
67 | - } |
|
61 | + /** |
|
62 | + * @param int $id |
|
63 | + */ |
|
64 | + public function setId($id) |
|
65 | + { |
|
66 | + $this->id = $id; |
|
67 | + } |
|
68 | 68 | |
69 | - /** |
|
70 | - * @return \User |
|
71 | - */ |
|
72 | - public function getUser() |
|
73 | - { |
|
74 | - return $this->user; |
|
75 | - } |
|
69 | + /** |
|
70 | + * @return \User |
|
71 | + */ |
|
72 | + public function getUser() |
|
73 | + { |
|
74 | + return $this->user; |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * @param \User $user |
|
79 | - */ |
|
80 | - public function setUser($user) |
|
81 | - { |
|
82 | - $this->user = $user; |
|
83 | - } |
|
77 | + /** |
|
78 | + * @param \User $user |
|
79 | + */ |
|
80 | + public function setUser($user) |
|
81 | + { |
|
82 | + $this->user = $user; |
|
83 | + } |
|
84 | 84 | |
85 | 85 | /** |
86 | 86 | * @return \DateTime |
@@ -14,49 +14,49 @@ discard block |
||
14 | 14 | */ |
15 | 15 | class Page |
16 | 16 | { |
17 | - /** |
|
18 | - * @var integer |
|
19 | - * |
|
20 | - * @ORM\Column(name="id", type="integer", nullable=false, options={"unsigned"=true}) |
|
21 | - * @ORM\Id |
|
22 | - * @ORM\GeneratedValue(strategy="IDENTITY") |
|
23 | - */ |
|
24 | - private $id; |
|
25 | - |
|
26 | - /** |
|
27 | - * @var string |
|
28 | - * |
|
29 | - * @ORM\Column(name="guid", type="string", length=255, nullable=false) |
|
30 | - */ |
|
31 | - private $guid; |
|
32 | - |
|
33 | - /** |
|
34 | - * @var string |
|
35 | - * |
|
36 | - * @ORM\Column(name="title_tag", type="string", length=70, nullable=true) |
|
37 | - */ |
|
38 | - private $titleTag; |
|
39 | - |
|
40 | - /** |
|
41 | - * @var string |
|
42 | - * |
|
43 | - * @ORM\Column(name="description_tag", type="string", length=160, nullable=true) |
|
44 | - */ |
|
45 | - private $descriptionTag; |
|
46 | - |
|
47 | - /** |
|
48 | - * @var string |
|
49 | - * |
|
50 | - * @ORM\Column(name="title", type="string", length=255, nullable=false) |
|
51 | - */ |
|
52 | - private $title; |
|
17 | + /** |
|
18 | + * @var integer |
|
19 | + * |
|
20 | + * @ORM\Column(name="id", type="integer", nullable=false, options={"unsigned"=true}) |
|
21 | + * @ORM\Id |
|
22 | + * @ORM\GeneratedValue(strategy="IDENTITY") |
|
23 | + */ |
|
24 | + private $id; |
|
25 | + |
|
26 | + /** |
|
27 | + * @var string |
|
28 | + * |
|
29 | + * @ORM\Column(name="guid", type="string", length=255, nullable=false) |
|
30 | + */ |
|
31 | + private $guid; |
|
32 | + |
|
33 | + /** |
|
34 | + * @var string |
|
35 | + * |
|
36 | + * @ORM\Column(name="title_tag", type="string", length=70, nullable=true) |
|
37 | + */ |
|
38 | + private $titleTag; |
|
39 | + |
|
40 | + /** |
|
41 | + * @var string |
|
42 | + * |
|
43 | + * @ORM\Column(name="description_tag", type="string", length=160, nullable=true) |
|
44 | + */ |
|
45 | + private $descriptionTag; |
|
46 | + |
|
47 | + /** |
|
48 | + * @var string |
|
49 | + * |
|
50 | + * @ORM\Column(name="title", type="string", length=255, nullable=false) |
|
51 | + */ |
|
52 | + private $title; |
|
53 | 53 | |
54 | 54 | /** |
55 | 55 | * @var string |
56 | 56 | * |
57 | 57 | * @ORM\Column(name="template", type="string", length=255, nullable=false) |
58 | 58 | */ |
59 | - private $template; |
|
59 | + private $template; |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * @var string |
@@ -65,43 +65,43 @@ discard block |
||
65 | 65 | */ |
66 | 66 | private $url; |
67 | 67 | |
68 | - /** |
|
69 | - * @var string |
|
70 | - * |
|
71 | - * @ORM\Column(name="content", type="text", nullable=true) |
|
72 | - */ |
|
73 | - private $content; |
|
74 | - |
|
75 | - /** |
|
76 | - * @var integer |
|
77 | - * |
|
78 | - * @ORM\Column(name="active", type="integer", nullable=false) |
|
79 | - */ |
|
80 | - private $active; |
|
81 | - |
|
82 | - /** |
|
83 | - * @var integer |
|
84 | - * |
|
85 | - * @ORM\Column(name="order", type="integer", nullable=false) |
|
86 | - */ |
|
87 | - private $order; |
|
88 | - |
|
89 | - /** |
|
90 | - * @var integer |
|
91 | - * |
|
92 | - * @ORM\Column(name="displayed", type="integer", nullable=false) |
|
93 | - */ |
|
94 | - private $displayed; |
|
95 | - |
|
96 | - /** |
|
97 | - * @var \Page |
|
98 | - * |
|
99 | - * @ORM\ManyToOne(targetEntity="Page") |
|
100 | - * @ORM\JoinColumns({ |
|
101 | - * @ORM\JoinColumn(name="parent", referencedColumnName="id") |
|
102 | - * }) |
|
103 | - */ |
|
104 | - private $parent; |
|
68 | + /** |
|
69 | + * @var string |
|
70 | + * |
|
71 | + * @ORM\Column(name="content", type="text", nullable=true) |
|
72 | + */ |
|
73 | + private $content; |
|
74 | + |
|
75 | + /** |
|
76 | + * @var integer |
|
77 | + * |
|
78 | + * @ORM\Column(name="active", type="integer", nullable=false) |
|
79 | + */ |
|
80 | + private $active; |
|
81 | + |
|
82 | + /** |
|
83 | + * @var integer |
|
84 | + * |
|
85 | + * @ORM\Column(name="order", type="integer", nullable=false) |
|
86 | + */ |
|
87 | + private $order; |
|
88 | + |
|
89 | + /** |
|
90 | + * @var integer |
|
91 | + * |
|
92 | + * @ORM\Column(name="displayed", type="integer", nullable=false) |
|
93 | + */ |
|
94 | + private $displayed; |
|
95 | + |
|
96 | + /** |
|
97 | + * @var \Page |
|
98 | + * |
|
99 | + * @ORM\ManyToOne(targetEntity="Page") |
|
100 | + * @ORM\JoinColumns({ |
|
101 | + * @ORM\JoinColumn(name="parent", referencedColumnName="id") |
|
102 | + * }) |
|
103 | + */ |
|
104 | + private $parent; |
|
105 | 105 | |
106 | 106 | /** |
107 | 107 | * @var \DateTime |
@@ -119,85 +119,85 @@ discard block |
||
119 | 119 | */ |
120 | 120 | private $updateDate; |
121 | 121 | |
122 | - /** |
|
123 | - * @return int |
|
124 | - */ |
|
125 | - public function getId() |
|
126 | - { |
|
127 | - return $this->id; |
|
128 | - } |
|
129 | - |
|
130 | - /** |
|
131 | - * @param int $id |
|
132 | - */ |
|
133 | - public function setId($id) |
|
134 | - { |
|
135 | - $this->id = $id; |
|
136 | - } |
|
137 | - |
|
138 | - /** |
|
139 | - * @return string |
|
140 | - */ |
|
141 | - public function getGuid() |
|
142 | - { |
|
143 | - return $this->guid; |
|
144 | - } |
|
145 | - |
|
146 | - /** |
|
147 | - * @param string $guid |
|
148 | - */ |
|
149 | - public function setGuid($guid) |
|
150 | - { |
|
151 | - $this->guid = $guid; |
|
152 | - } |
|
153 | - |
|
154 | - /** |
|
155 | - * @return string |
|
156 | - */ |
|
157 | - public function getTitleTag() |
|
158 | - { |
|
159 | - return $this->titleTag; |
|
160 | - } |
|
161 | - |
|
162 | - /** |
|
163 | - * @param string $titleTag |
|
164 | - */ |
|
165 | - public function setTitleTag($titleTag) |
|
166 | - { |
|
167 | - $this->titleTag = $titleTag; |
|
168 | - } |
|
169 | - |
|
170 | - /** |
|
171 | - * @return string |
|
172 | - */ |
|
173 | - public function getDescriptionTag() |
|
174 | - { |
|
175 | - return $this->descriptionTag; |
|
176 | - } |
|
177 | - |
|
178 | - /** |
|
179 | - * @param string $descriptionTag |
|
180 | - */ |
|
181 | - public function setDescriptionTag($descriptionTag) |
|
182 | - { |
|
183 | - $this->descriptionTag = $descriptionTag; |
|
184 | - } |
|
185 | - |
|
186 | - /** |
|
187 | - * @return string |
|
188 | - */ |
|
189 | - public function getTitle() |
|
190 | - { |
|
191 | - return $this->title; |
|
192 | - } |
|
193 | - |
|
194 | - /** |
|
195 | - * @param string $title |
|
196 | - */ |
|
197 | - public function setTitle($title) |
|
198 | - { |
|
199 | - $this->title = $title; |
|
200 | - } |
|
122 | + /** |
|
123 | + * @return int |
|
124 | + */ |
|
125 | + public function getId() |
|
126 | + { |
|
127 | + return $this->id; |
|
128 | + } |
|
129 | + |
|
130 | + /** |
|
131 | + * @param int $id |
|
132 | + */ |
|
133 | + public function setId($id) |
|
134 | + { |
|
135 | + $this->id = $id; |
|
136 | + } |
|
137 | + |
|
138 | + /** |
|
139 | + * @return string |
|
140 | + */ |
|
141 | + public function getGuid() |
|
142 | + { |
|
143 | + return $this->guid; |
|
144 | + } |
|
145 | + |
|
146 | + /** |
|
147 | + * @param string $guid |
|
148 | + */ |
|
149 | + public function setGuid($guid) |
|
150 | + { |
|
151 | + $this->guid = $guid; |
|
152 | + } |
|
153 | + |
|
154 | + /** |
|
155 | + * @return string |
|
156 | + */ |
|
157 | + public function getTitleTag() |
|
158 | + { |
|
159 | + return $this->titleTag; |
|
160 | + } |
|
161 | + |
|
162 | + /** |
|
163 | + * @param string $titleTag |
|
164 | + */ |
|
165 | + public function setTitleTag($titleTag) |
|
166 | + { |
|
167 | + $this->titleTag = $titleTag; |
|
168 | + } |
|
169 | + |
|
170 | + /** |
|
171 | + * @return string |
|
172 | + */ |
|
173 | + public function getDescriptionTag() |
|
174 | + { |
|
175 | + return $this->descriptionTag; |
|
176 | + } |
|
177 | + |
|
178 | + /** |
|
179 | + * @param string $descriptionTag |
|
180 | + */ |
|
181 | + public function setDescriptionTag($descriptionTag) |
|
182 | + { |
|
183 | + $this->descriptionTag = $descriptionTag; |
|
184 | + } |
|
185 | + |
|
186 | + /** |
|
187 | + * @return string |
|
188 | + */ |
|
189 | + public function getTitle() |
|
190 | + { |
|
191 | + return $this->title; |
|
192 | + } |
|
193 | + |
|
194 | + /** |
|
195 | + * @param string $title |
|
196 | + */ |
|
197 | + public function setTitle($title) |
|
198 | + { |
|
199 | + $this->title = $title; |
|
200 | + } |
|
201 | 201 | |
202 | 202 | /** |
203 | 203 | * @return string |
@@ -231,85 +231,85 @@ discard block |
||
231 | 231 | $this->url = $url; |
232 | 232 | } |
233 | 233 | |
234 | - /** |
|
235 | - * @return string |
|
236 | - */ |
|
237 | - public function getContent() |
|
238 | - { |
|
239 | - return $this->content; |
|
240 | - } |
|
241 | - |
|
242 | - /** |
|
243 | - * @param string $content |
|
244 | - */ |
|
245 | - public function setContent($content) |
|
246 | - { |
|
247 | - $this->content = $content; |
|
248 | - } |
|
249 | - |
|
250 | - /** |
|
251 | - * @return int |
|
252 | - */ |
|
253 | - public function getActive() |
|
254 | - { |
|
255 | - return $this->active; |
|
256 | - } |
|
257 | - |
|
258 | - /** |
|
259 | - * @param int $active |
|
260 | - */ |
|
261 | - public function setActive($active) |
|
262 | - { |
|
263 | - $this->active = $active; |
|
264 | - } |
|
265 | - |
|
266 | - /** |
|
267 | - * @return int |
|
268 | - */ |
|
269 | - public function getOrder() |
|
270 | - { |
|
271 | - return $this->order; |
|
272 | - } |
|
273 | - |
|
274 | - /** |
|
275 | - * @param int $order |
|
276 | - */ |
|
277 | - public function setOrder($order) |
|
278 | - { |
|
279 | - $this->order = $order; |
|
280 | - } |
|
281 | - |
|
282 | - /** |
|
283 | - * @return int |
|
284 | - */ |
|
285 | - public function getDisplayed() |
|
286 | - { |
|
287 | - return $this->displayed; |
|
288 | - } |
|
289 | - |
|
290 | - /** |
|
291 | - * @param int $displayed |
|
292 | - */ |
|
293 | - public function setDisplayed($displayed) |
|
294 | - { |
|
295 | - $this->displayed = $displayed; |
|
296 | - } |
|
297 | - |
|
298 | - /** |
|
299 | - * @return \Page |
|
300 | - */ |
|
301 | - public function getParent() |
|
302 | - { |
|
303 | - return $this->parent; |
|
304 | - } |
|
305 | - |
|
306 | - /** |
|
307 | - * @param \Page $parent |
|
308 | - */ |
|
309 | - public function setParent($parent) |
|
310 | - { |
|
311 | - $this->parent = $parent; |
|
312 | - } |
|
234 | + /** |
|
235 | + * @return string |
|
236 | + */ |
|
237 | + public function getContent() |
|
238 | + { |
|
239 | + return $this->content; |
|
240 | + } |
|
241 | + |
|
242 | + /** |
|
243 | + * @param string $content |
|
244 | + */ |
|
245 | + public function setContent($content) |
|
246 | + { |
|
247 | + $this->content = $content; |
|
248 | + } |
|
249 | + |
|
250 | + /** |
|
251 | + * @return int |
|
252 | + */ |
|
253 | + public function getActive() |
|
254 | + { |
|
255 | + return $this->active; |
|
256 | + } |
|
257 | + |
|
258 | + /** |
|
259 | + * @param int $active |
|
260 | + */ |
|
261 | + public function setActive($active) |
|
262 | + { |
|
263 | + $this->active = $active; |
|
264 | + } |
|
265 | + |
|
266 | + /** |
|
267 | + * @return int |
|
268 | + */ |
|
269 | + public function getOrder() |
|
270 | + { |
|
271 | + return $this->order; |
|
272 | + } |
|
273 | + |
|
274 | + /** |
|
275 | + * @param int $order |
|
276 | + */ |
|
277 | + public function setOrder($order) |
|
278 | + { |
|
279 | + $this->order = $order; |
|
280 | + } |
|
281 | + |
|
282 | + /** |
|
283 | + * @return int |
|
284 | + */ |
|
285 | + public function getDisplayed() |
|
286 | + { |
|
287 | + return $this->displayed; |
|
288 | + } |
|
289 | + |
|
290 | + /** |
|
291 | + * @param int $displayed |
|
292 | + */ |
|
293 | + public function setDisplayed($displayed) |
|
294 | + { |
|
295 | + $this->displayed = $displayed; |
|
296 | + } |
|
297 | + |
|
298 | + /** |
|
299 | + * @return \Page |
|
300 | + */ |
|
301 | + public function getParent() |
|
302 | + { |
|
303 | + return $this->parent; |
|
304 | + } |
|
305 | + |
|
306 | + /** |
|
307 | + * @param \Page $parent |
|
308 | + */ |
|
309 | + public function setParent($parent) |
|
310 | + { |
|
311 | + $this->parent = $parent; |
|
312 | + } |
|
313 | 313 | |
314 | 314 | /** |
315 | 315 | * @return \DateTime |
@@ -75,14 +75,14 @@ |
||
75 | 75 | $username = $data->getUser()->getFirstName() . " " . $data->getUser()->getLastName(); |
76 | 76 | |
77 | 77 | if ($guid === null) { |
78 | - $this->addFlash("success-flash", "the account of ". $username . " was created"); |
|
78 | + $this->addFlash("success-flash", "the account of " . $username . " was created"); |
|
79 | 79 | } else { |
80 | - $this->addFlash("success-flash", "the account of ". $username . " was edited"); |
|
80 | + $this->addFlash("success-flash", "the account of " . $username . " was edited"); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | return $this->redirectToRoute("ribsadmin_accounts"); |
84 | 84 | } else { |
85 | - $this->addFlash("error-flash", "An account with username ". $data->getUsername() . " already exist"); |
|
85 | + $this->addFlash("error-flash", "An account with username " . $data->getUsername() . " already exist"); |
|
86 | 86 | return $this->redirectToRoute($request->get("_route"), ["guid" => $guid]); |
87 | 87 | } |
88 | 88 | } |
@@ -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,8 +101,8 @@ discard block |
||
101 | 101 | |
102 | 102 | return $this->render("@RibsAdmin/accounts/edit.html.twig", [ |
103 | 103 | "form" => $form->createView(), |
104 | - "form_errors" => $form->getErrors(), |
|
105 | - "user" => $user |
|
104 | + "form_errors" => $form->getErrors(), |
|
105 | + "user" => $user |
|
106 | 106 | ]); |
107 | 107 | } |
108 | 108 | //-------------------------------------------- END DISPLAY VIEWS -----------------------------------------------------------// |
@@ -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(), $module->getDevMode()) . "/Resources/json/ribsadmin_rights.json")) |
|
39 | + "rights" => (array) json_decode(file_get_contents($this->globals->getBaseBundlePath($module->getPackageName(), $module->getDevMode()) . "/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(), $module->getDevMode()) . "/Resources/json/ribsadmin_rights.json")); |
60 | 60 | } |
61 | 61 | |
62 | - return (object)$rights; |
|
62 | + return (object) $rights; |
|
63 | 63 | } |
64 | 64 | } |
@@ -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 |
@@ -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 |
@@ -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 |
@@ -50,7 +50,7 @@ |
||
50 | 50 | $output->writeln("Start composer require " . $pacakge_name); |
51 | 51 | |
52 | 52 | $process = new Process("composer require " . $pacakge_name); |
53 | - $process->run(function ($type, $buffer) { |
|
53 | + $process->run(function($type, $buffer) { |
|
54 | 54 | echo $buffer; |
55 | 55 | }); |
56 | 56 |
@@ -13,64 +13,64 @@ |
||
13 | 13 | |
14 | 14 | class ImportModuleCommand extends Command |
15 | 15 | { |
16 | - private $em; |
|
16 | + private $em; |
|
17 | 17 | |
18 | - /** |
|
19 | - * ImportModuleCommand constructor. |
|
20 | - * @param EntityManagerInterface $em |
|
21 | - * @param string|null $name |
|
22 | - */ |
|
23 | - public function __construct(EntityManagerInterface $em, string $name = null) |
|
24 | - { |
|
25 | - parent::__construct($name); |
|
26 | - $this->em = $em; |
|
27 | - } |
|
18 | + /** |
|
19 | + * ImportModuleCommand constructor. |
|
20 | + * @param EntityManagerInterface $em |
|
21 | + * @param string|null $name |
|
22 | + */ |
|
23 | + public function __construct(EntityManagerInterface $em, string $name = null) |
|
24 | + { |
|
25 | + parent::__construct($name); |
|
26 | + $this->em = $em; |
|
27 | + } |
|
28 | 28 | |
29 | - protected function configure() |
|
30 | - { |
|
31 | - $this |
|
32 | - ->setName('ribsadmin:import-module') |
|
33 | - ->setDescription('Import a module in ribs admin') |
|
34 | - ->addArgument( |
|
35 | - 'package-name', |
|
36 | - InputArgument::REQUIRED, |
|
37 | - 'Name of composer package to import' |
|
38 | - ) |
|
39 | - ->addArgument( |
|
40 | - 'module-name', |
|
41 | - InputArgument::REQUIRED, |
|
42 | - 'Name of package to display in app' |
|
43 | - ) |
|
44 | - ; |
|
45 | - } |
|
29 | + protected function configure() |
|
30 | + { |
|
31 | + $this |
|
32 | + ->setName('ribsadmin:import-module') |
|
33 | + ->setDescription('Import a module in ribs admin') |
|
34 | + ->addArgument( |
|
35 | + 'package-name', |
|
36 | + InputArgument::REQUIRED, |
|
37 | + 'Name of composer package to import' |
|
38 | + ) |
|
39 | + ->addArgument( |
|
40 | + 'module-name', |
|
41 | + InputArgument::REQUIRED, |
|
42 | + 'Name of package to display in app' |
|
43 | + ) |
|
44 | + ; |
|
45 | + } |
|
46 | 46 | |
47 | - protected function execute(InputInterface $input, OutputInterface $output) |
|
48 | - { |
|
49 | - $pacakge_name = $input->getArgument('package-name'); |
|
50 | - $output->writeln("Start composer require " . $pacakge_name); |
|
47 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
48 | + { |
|
49 | + $pacakge_name = $input->getArgument('package-name'); |
|
50 | + $output->writeln("Start composer require " . $pacakge_name); |
|
51 | 51 | |
52 | - $process = new Process("composer require " . $pacakge_name); |
|
53 | - $process->run(function ($type, $buffer) { |
|
54 | - echo $buffer; |
|
55 | - }); |
|
52 | + $process = new Process("composer require " . $pacakge_name); |
|
53 | + $process->run(function ($type, $buffer) { |
|
54 | + echo $buffer; |
|
55 | + }); |
|
56 | 56 | |
57 | - if (!$process->isSuccessful()) { |
|
58 | - throw new ProcessFailedException($process); |
|
59 | - } |
|
57 | + if (!$process->isSuccessful()) { |
|
58 | + throw new ProcessFailedException($process); |
|
59 | + } |
|
60 | 60 | |
61 | - $output->writeln("End composer require " . $pacakge_name); |
|
62 | - $output->writeln("Start insertion of module in database " . $pacakge_name); |
|
61 | + $output->writeln("End composer require " . $pacakge_name); |
|
62 | + $output->writeln("Start insertion of module in database " . $pacakge_name); |
|
63 | 63 | |
64 | - $module = new Module(); |
|
65 | - $module->setPackageName($pacakge_name); |
|
66 | - $module->setTitle($input->getArgument('module-name')); |
|
67 | - $module->setActive(false); |
|
68 | - $module->setDisplayed(true); |
|
69 | - $this->em->persist($module); |
|
70 | - $this->em->flush(); |
|
64 | + $module = new Module(); |
|
65 | + $module->setPackageName($pacakge_name); |
|
66 | + $module->setTitle($input->getArgument('module-name')); |
|
67 | + $module->setActive(false); |
|
68 | + $module->setDisplayed(true); |
|
69 | + $this->em->persist($module); |
|
70 | + $this->em->flush(); |
|
71 | 71 | |
72 | - $output->writeln("Installation of " . $pacakge_name . " is finished. You have now to configure this module in your administration interface"); |
|
72 | + $output->writeln("Installation of " . $pacakge_name . " is finished. You have now to configure this module in your administration interface"); |
|
73 | 73 | |
74 | - return 0; |
|
75 | - } |
|
74 | + return 0; |
|
75 | + } |
|
76 | 76 | } |
@@ -8,11 +8,11 @@ |
||
8 | 8 | |
9 | 9 | class PageController extends AbstractController |
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(); |