diff options
| author | George Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2023-04-25 16:45:03 +0300 |
|---|---|---|
| committer | George Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2023-04-25 16:45:03 +0300 |
| commit | b594effb847b86fc6b1dae49d7948c46bba35e58 (patch) | |
| tree | 8c5a090cf8746870521324797762bb0ff14c8ae5 /public/app/controllers/Auth.php | |
| parent | 65d07ba64d45c77d2db16272710ec5702b34d641 (diff) | |
| download | classroom-b594effb847b86fc6b1dae49d7948c46bba35e58.tar.gz classroom-b594effb847b86fc6b1dae49d7948c46bba35e58.tar.bz2 classroom-b594effb847b86fc6b1dae49d7948c46bba35e58.zip | |
alfa version; uploaded into test server (coder)
Diffstat (limited to 'public/app/controllers/Auth.php')
| -rw-r--r-- | public/app/controllers/Auth.php | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/public/app/controllers/Auth.php b/public/app/controllers/Auth.php index 0570a5e..8af7513 100644 --- a/public/app/controllers/Auth.php +++ b/public/app/controllers/Auth.php @@ -180,7 +180,11 @@ class Auth { } - + /** is_connected + * checks if the user is connected + * + * @return true|false + */ public static function is_connected() { $manager = new Classroom_manager(); @@ -193,13 +197,17 @@ class Auth { return $user; } else { - echo 'user is not connected'; + // user is not connected; return false; } } - + /** logout + * + * performs a secure logout; + * regenerates session; deletes cookies; + */ public static function logout() { $userManager = new Classroom_manager(); @@ -232,7 +240,7 @@ class Auth { return true; // permision 0 is always granted } - if ($user = $this->is_connected() === flase) { // if not connected + if ($user = self::is_connected() === false) { // if not connected return false; // then no other permition is granted } @@ -340,6 +348,18 @@ class Auth { } + /** hasValidRole + * like allowRoles() but dowes not stop execution + * + * @return true|false + */ + public static function hasValidRole($allowed) + { + $manager = new Classroom_manager(); + return ($manager->isGranted($allowed)); + } + + public static function in_admin_group() { $manager = new Classroom_manager(); |
