@@ -36,17 +36,21 @@ |
||
| 36 | 36 | if ($controller[0] instanceof AdminAuthenticatedInterface) { |
| 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 | |
@@ -42,8 +42,9 @@ |
||
| 42 | 42 | |
| 43 | 43 | public function onKernelRequest(GetResponseEvent $event) |
| 44 | 44 | { |
| 45 | - if (HttpKernel::MASTER_REQUEST != $event->getRequestType()) |
|
| 46 | - return; |
|
| 45 | + if (HttpKernel::MASTER_REQUEST != $event->getRequestType()) { |
|
| 46 | + return; |
|
| 47 | + } |
|
| 47 | 48 | } |
| 48 | 49 | |
| 49 | 50 | |
@@ -86,10 +86,10 @@ |
||
| 86 | 86 | $activities = array_count_values($activities); |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - //foreach (json_decode($enrollments->getBody()->getContents()) as $enrollment) { |
|
| 90 | - // if ($enrollment->class->title != null) |
|
| 91 | - // array_push($classes, $enrollment->class); |
|
| 92 | - //} |
|
| 89 | + //foreach (json_decode($enrollments->getBody()->getContents()) as $enrollment) { |
|
| 90 | + // if ($enrollment->class->title != null) |
|
| 91 | + // array_push($classes, $enrollment->class); |
|
| 92 | + //} |
|
| 93 | 93 | |
| 94 | 94 | return $this->render('Admin/user.twig', [ |
| 95 | 95 | 'givenName' => $user->givenName, |
@@ -36,8 +36,9 @@ discard block |
||
| 36 | 36 | $res = []; |
| 37 | 37 | |
| 38 | 38 | foreach($students as $student) { |
| 39 | - if ($student['uid'][0] != null) |
|
| 40 | - $res += [ $student['uid'][0] => $student['displayname'][0] ]; |
|
| 39 | + if ($student['uid'][0] != null) { |
|
| 40 | + $res += [ $student['uid'][0] => $student['displayname'][0] ]; |
|
| 41 | + } |
|
| 41 | 42 | } |
| 42 | 43 | |
| 43 | 44 | return $this->json($res); |
@@ -80,8 +81,9 @@ discard block |
||
| 80 | 81 | |
| 81 | 82 | if ($events != null) |
| 82 | 83 | { |
| 83 | - foreach ($events as $event) |
|
| 84 | - array_push($activities, $event->object->name); |
|
| 84 | + foreach ($events as $event) { |
|
| 85 | + array_push($activities, $event->object->name); |
|
| 86 | + } |
|
| 85 | 87 | |
| 86 | 88 | $activities = array_count_values($activities); |
| 87 | 89 | } |