diff options
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(); |
