summaryrefslogtreecommitdiff
path: root/app/Model
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2019-01-30 20:59:25 -0800
committerFrédéric Guillot <fred@kanboard.net>2019-01-30 20:59:25 -0800
commit61a55c888889a1ec3376a7a3bba230dc15a378a4 (patch)
treea7bd979f04aeed56e7c101e7a6dad6cd52c6404d /app/Model
parent19ea9ed6209b36cba5cb8f96224d9e3a0c022c93 (diff)
Check if user role has changed while the session is open
Diffstat (limited to 'app/Model')
-rw-r--r--app/Model/UserModel.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/Model/UserModel.php b/app/Model/UserModel.php
index c44fd3e7..d8db3270 100644
--- a/app/Model/UserModel.php
+++ b/app/Model/UserModel.php
@@ -29,6 +29,15 @@ class UserModel extends Base
*/
const EVERYBODY_ID = -1;
+ public function isValidSession($userID, $sessionRole)
+ {
+ return $this->db->table(self::TABLE)
+ ->eq('id', $userID)
+ ->eq('is_active', 1)
+ ->eq('role', $sessionRole)
+ ->exists();
+ }
+
/**
* Return true if the user exists
*