Projects are not anymore visible to everybody by default

This commit is contained in:
Frédéric Guillot
2014-10-05 12:32:44 -04:00
parent bae57838c2
commit 7f5a871f84
17 changed files with 61 additions and 60 deletions

View File

@@ -28,6 +28,24 @@ class User extends Base
*/
const EVERYBODY_ID = -1;
/**
* Return true is the given user id is administrator
*
* @access public
* @param integer $user_id User id
* @return boolean
*/
public function isAdmin($user_id)
{
$result = $this->db
->table(User::TABLE)
->eq('id', $user_id)
->eq('is_admin', 1)
->count();
return $result > 0;
}
/**
* Get the default project from the session
*