Merge pull request #46 from ThomasRubini/is_admin
This commit is contained in:
commit
c55ad5e1be
@ -65,11 +65,17 @@ final class Session
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function is_admin(){
|
||||||
|
if (!self::is_login()) return false;
|
||||||
|
|
||||||
|
$O_userModel = new UserModel();
|
||||||
|
return $O_userModel->isUserAdmin($_SESSION["ID"]);
|
||||||
|
}
|
||||||
|
|
||||||
public static function admin_or_die(){
|
public static function admin_or_die(){
|
||||||
Session::login_or_die();
|
Session::login_or_die();
|
||||||
|
|
||||||
$O_userModel = new UserModel();
|
if (!self::is_admin()) {
|
||||||
if (!$O_userModel->isUserAdmin($_SESSION["ID"])) {
|
|
||||||
header("Location: /");
|
header("Location: /");
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user