@@ -4,11 +4,11 @@ |
||
| 4 | 4 | use Security\Resources\Middleware\AuthMiddleware; |
| 5 | 5 | |
| 6 | 6 | |
| 7 | -$app->group('', function () { |
|
| 7 | +$app->group('', function() { |
|
| 8 | 8 | $this->get('/login', 'AuthController:login')->setName('login'); |
| 9 | 9 | })->add(new GuestMiddleware($container)); |
| 10 | 10 | |
| 11 | -$app->group('', function () { |
|
| 11 | +$app->group('', function() { |
|
| 12 | 12 | $this->get('/logout', 'AuthController:logout')->setName('logout'); |
| 13 | 13 | })->add(new AuthMiddleware($container)); |
| 14 | 14 | |
@@ -20,12 +20,12 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | public function __invoke(Request $request, Response $response, callable $next) |
| 22 | 22 | { |
| 23 | - if (isset($_SESSION['phpCAS']['user'])) { |
|
| 23 | + if (isset($_SESSION['phpCAS']['user'])) { |
|
| 24 | 24 | if (in_array($_SESSION['phpCAS']['user'], $this->container['parameters']['administrators'])) |
| 25 | 25 | return $next($request, $response); |
| 26 | - } |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - $this->flash->addMessage('error', '<i class="minus circle icon"></i> You are not allowed to access to this content.'); |
|
| 29 | - return $response->withRedirect($this->router->pathFor('wrong-entry')); |
|
| 28 | + $this->flash->addMessage('error', '<i class="minus circle icon"></i> You are not allowed to access to this content.'); |
|
| 29 | + return $response->withRedirect($this->router->pathFor('wrong-entry')); |
|
| 30 | 30 | } |
| 31 | 31 | } |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | public function __invoke(Request $request, Response $response, callable $next) |
| 22 | 22 | { |
| 23 | - if (isset($_SESSION['phpCAS']['user'])) { |
|
| 23 | + if (isset($_SESSION['phpCAS']['user'])) { |
|
| 24 | 24 | if (in_array($_SESSION['phpCAS']['user'], $this->container['parameters']['administrators'])) |
| 25 | 25 | return $next($request, $response); |
| 26 | 26 | } |
@@ -21,8 +21,9 @@ |
||
| 21 | 21 | public function __invoke(Request $request, Response $response, callable $next) |
| 22 | 22 | { |
| 23 | 23 | if (isset($_SESSION['phpCAS']['user'])) { |
| 24 | - if (in_array($_SESSION['phpCAS']['user'], $this->container['parameters']['administrators'])) |
|
| 25 | - return $next($request, $response); |
|
| 24 | + if (in_array($_SESSION['phpCAS']['user'], $this->container['parameters']['administrators'])) { |
|
| 25 | + return $next($request, $response); |
|
| 26 | + } |
|
| 26 | 27 | } |
| 27 | 28 | |
| 28 | 29 | $this->flash->addMessage('error', '<i class="minus circle icon"></i> You are not allowed to access to this content.'); |
@@ -33,8 +33,9 @@ |
||
| 33 | 33 | |
| 34 | 34 | $res = []; |
| 35 | 35 | foreach($students as $student) { |
| 36 | - if ($student['uid'][0] != null) |
|
| 37 | - $res += [ $student['uid'][0] => $student['displayname'][0] ]; |
|
| 36 | + if ($student['uid'][0] != null) { |
|
| 37 | + $res += [ $student['uid'][0] => $student['displayname'][0] ]; |
|
| 38 | + } |
|
| 38 | 39 | } |
| 39 | 40 | |
| 40 | 41 | return $this->json($response, $res); |
@@ -27,9 +27,9 @@ |
||
| 27 | 27 | $students = $this->ldap($filter, ['displayname', 'uid']); |
| 28 | 28 | $res = []; |
| 29 | 29 | |
| 30 | - foreach($students as $student) { |
|
| 30 | + foreach ($students as $student) { |
|
| 31 | 31 | if ($student['uid'][0] != null) |
| 32 | - $res += [ $student['uid'][0] => $student['displayname'][0] ]; |
|
| 32 | + $res += [$student['uid'][0] => $student['displayname'][0]]; |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | return $this->json($response, $res); |
@@ -3,9 +3,9 @@ |
||
| 3 | 3 | use App\Resources\Middleware\CountryMiddleware; |
| 4 | 4 | use \Security\Resources\Middleware\AdminMiddleware; |
| 5 | 5 | |
| 6 | -$app->group('/{country:[a-z]{2}}', function () use ($container) { |
|
| 6 | +$app->group('/{country:[a-z]{2}}', function() use ($container) { |
|
| 7 | 7 | |
| 8 | - $this->group('/tools', function () use ($container) { |
|
| 8 | + $this->group('/tools', function() use ($container) { |
|
| 9 | 9 | $this->map(['GET', 'POST'], '/find-student', 'AdminController:findStudent')->setName('find-student'); |
| 10 | 10 | })->add(new AdminMiddleware($container)); |
| 11 | 11 | |
@@ -27,8 +27,9 @@ |
||
| 27 | 27 | ]); |
| 28 | 28 | |
| 29 | 29 | foreach (json_decode($enrollments->getBody()->getContents()) as $enrollment) { |
| 30 | - if ($enrollment->class->title != null) |
|
| 31 | - array_push($classes, $enrollment->class); |
|
| 30 | + if ($enrollment->class->title != null) { |
|
| 31 | + array_push($classes, $enrollment->class); |
|
| 32 | + } |
|
| 32 | 33 | } |
| 33 | 34 | |
| 34 | 35 | return $this->view->render($response, 'App/user.twig',[ |
@@ -31,10 +31,10 @@ |
||
| 31 | 31 | array_push($classes, $enrollment->class); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - return $this->view->render($response, 'App/user.twig',[ |
|
| 34 | + return $this->view->render($response, 'App/user.twig', [ |
|
| 35 | 35 | 'classes' => $classes, |
| 36 | 36 | 'student_name' => $this->ldapFirst("uid=$id")['displayname'][0] |
| 37 | - ] ); |
|
| 37 | + ]); |
|
| 38 | 38 | |
| 39 | 39 | } |
| 40 | 40 | |
@@ -69,15 +69,15 @@ |
||
| 69 | 69 | */ |
| 70 | 70 | public function createJWT() |
| 71 | 71 | { |
| 72 | - return json_decode( $this->http->request('POST', 'auth/login', [ |
|
| 73 | - 'headers' => [ 'X-Requested-With' => 'XMLHttpRequest' ], |
|
| 72 | + return json_decode($this->http->request('POST', 'auth/login', [ |
|
| 73 | + 'headers' => ['X-Requested-With' => 'XMLHttpRequest'], |
|
| 74 | 74 | 'json' => [ |
| 75 | 75 | 'username' => $this->parameters['api']['username'], |
| 76 | 76 | 'password' => $this->parameters['api']['password'] |
| 77 | 77 | ] |
| 78 | 78 | ]) |
| 79 | 79 | ->getBody() |
| 80 | - ->getContents() ); |
|
| 80 | + ->getContents()); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | |
| 5 | 5 | $app->get('/', 'AppController:redirectHome')->setName('wrong-entry'); |
| 6 | 6 | |
| 7 | -$app->group('/{country:[a-z]{2}}', function () { |
|
| 7 | +$app->group('/{country:[a-z]{2}}', function() { |
|
| 8 | 8 | $this->get('', 'AppController:home')->setName('home'); |
| 9 | 9 | $this->get('/users/{id}', 'UserController:user')->setName('user-profile'); |
| 10 | 10 | })->add(new CountryMiddleware($container)); |
@@ -17,8 +17,9 @@ |
||
| 17 | 17 | $country_id = $request->getAttribute('routeInfo')[2]['country']; |
| 18 | 18 | |
| 19 | 19 | // Useful when a client edits the URL and types a language that does not exist. |
| 20 | - if (!$this->checkCountry($country_id)) |
|
| 21 | - return $response->withRedirect($this->router->pathFor('wrong-entry')); |
|
| 20 | + if (!$this->checkCountry($country_id)) { |
|
| 21 | + return $response->withRedirect($this->router->pathFor('wrong-entry')); |
|
| 22 | + } |
|
| 22 | 23 | |
| 23 | 24 | setcookie('country', $country_id, time() + (30 * 24 * 60 * 60)); // 30 days |
| 24 | 25 | |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | return User::find($uid)->user['sourcedId']; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | - /** protected $fillable = [ |
|
| 18 | + /** protected $fillable = [ |
|
| 19 | 19 | 'username', |
| 20 | 20 | 'email', |
| 21 | 21 | 'password', |