From 7f5a871f84639a90eebd0ac1d0ee7f759e220cf6 Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Sun, 5 Oct 2014 12:32:44 -0400 Subject: Projects are not anymore visible to everybody by default --- app/Model/User.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'app/Model/User.php') diff --git a/app/Model/User.php b/app/Model/User.php index b54f6309..33bd6720 100644 --- a/app/Model/User.php +++ b/app/Model/User.php @@ -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 * -- cgit v1.2.3