Check if user role has changed while the session is open

This commit is contained in:
Frédéric Guillot
2019-01-30 20:59:25 -08:00
parent 19ea9ed620
commit 61a55c8888
3 changed files with 12 additions and 2 deletions

View File

@@ -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
*