@@ -36,17 +36,21 @@ |
||
| 36 | 36 | if ($controller[0] instanceof AdminAuthenticatedController) { |
| 37 | 37 | $isAdmin = false; |
| 38 | 38 | if (isset($_SESSION['phpCAS']['user'])) { |
| 39 | - if (in_array($_SESSION['phpCAS']['user'], $this->administrators)) |
|
| 40 | - $isAdmin = true; |
|
| 39 | + if (in_array($_SESSION['phpCAS']['user'], $this->administrators)) { |
|
| 40 | + $isAdmin = true; |
|
| 41 | + } |
|
| 42 | + } |
|
| 43 | + if (!$isAdmin) { |
|
| 44 | + throw new AccessDeniedHttpException('Access forbidden.'); |
|
| 41 | 45 | } |
| 42 | - if (!$isAdmin) throw new AccessDeniedHttpException('Access forbidden.'); |
|
| 43 | 46 | } |
| 44 | 47 | } |
| 45 | 48 | |
| 46 | 49 | public function onKernelRequest(GetResponseEvent $event) |
| 47 | 50 | { |
| 48 | - if (HttpKernel::MASTER_REQUEST != $event->getRequestType()) |
|
| 49 | - return; |
|
| 51 | + if (HttpKernel::MASTER_REQUEST != $event->getRequestType()) { |
|
| 52 | + return; |
|
| 53 | + } |
|
| 50 | 54 | } |
| 51 | 55 | |
| 52 | 56 | |
@@ -33,8 +33,9 @@ |
||
| 33 | 33 | */ |
| 34 | 34 | public function onKernelRequest(GetResponseEvent $event) |
| 35 | 35 | { |
| 36 | - if (HttpKernel::MASTER_REQUEST != $event->getRequestType()) |
|
| 37 | - return; |
|
| 36 | + if (HttpKernel::MASTER_REQUEST != $event->getRequestType()) { |
|
| 37 | + return; |
|
| 38 | + } |
|
| 38 | 39 | |
| 39 | 40 | $this->registerLDAP(); |
| 40 | 41 | $this->registerCapsule(); |
@@ -38,8 +38,9 @@ discard block |
||
| 38 | 38 | $res = []; |
| 39 | 39 | |
| 40 | 40 | foreach($students as $student) { |
| 41 | - if ($student['uid'][0] != null) |
|
| 42 | - $res += [ $student['uid'][0] => $student['displayname'][0] ]; |
|
| 41 | + if ($student['uid'][0] != null) { |
|
| 42 | + $res += [ $student['uid'][0] => $student['displayname'][0] ]; |
|
| 43 | + } |
|
| 43 | 44 | } |
| 44 | 45 | |
| 45 | 46 | return $this->json($res); |
@@ -73,8 +74,9 @@ discard block |
||
| 73 | 74 | ]); |
| 74 | 75 | |
| 75 | 76 | foreach (json_decode($enrollments->getBody()->getContents()) as $enrollment) { |
| 76 | - if ($enrollment->class->title != null) |
|
| 77 | - array_push($classes, $enrollment->class); |
|
| 77 | + if ($enrollment->class->title != null) { |
|
| 78 | + array_push($classes, $enrollment->class); |
|
| 79 | + } |
|
| 78 | 80 | } |
| 79 | 81 | |
| 80 | 82 | return $this->render('admin/user.twig',[ |