Check if the user session match an existing user

This commit is contained in:
Frederic Guillot
2015-02-13 16:41:50 -05:00
parent 8fde5df4f8
commit 124f7cad28
2 changed files with 19 additions and 0 deletions

View File

@@ -28,6 +28,18 @@ class User extends Base
*/
const EVERYBODY_ID = -1;
/**
* Return true if the user exists
*
* @access public
* @param integer $user_id User id
* @return boolean
*/
public function exists($user_id)
{
return $this->db->table(self::TABLE)->eq('id', $user_id)->count() === 1;
}
/**
* Get query to fetch all users
*