summaryrefslogtreecommitdiff
path: root/models/project.php
diff options
context:
space:
mode:
authortoomyem <toomyem@toomyem.net>2014-03-05 09:40:06 +0100
committertoomyem <toomyem@toomyem.net>2014-03-05 09:40:06 +0100
commit384b64b7fab59d9de0fea5adb89438c1192b6301 (patch)
tree4e1019a7a2177fbfbc5ff11ea51a1c2a19546a3f /models/project.php
parent141616b48cdb2f05a8288be0519ac4094c292ba6 (diff)
Admin users are not allowed for a project
In function isUserAllowed() it is only checked if: 1. any user is assigned to the project (if no then allow anybody) 2. if logged user is allowed for given project But also _admin_ users _not assigned_ to the project shall be allowed.
Diffstat (limited to 'models/project.php')
-rw-r--r--models/project.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/models/project.php b/models/project.php
index a2f66478..45cd1baa 100644
--- a/models/project.php
+++ b/models/project.php
@@ -82,6 +82,15 @@ class Project extends Base
if ($nb_users < 1) return true;
+ // check if user has admin rights
+ $nb_users = $this->db
+ ->table(\Model\User::TABLE)
+ ->eq('id', $user_id)
+ ->eq('is_admin', 1)
+ ->count();
+
+ if ($nb_users > 0) return true;
+
// Otherwise, allow only specific users
return (bool) $this->db
->table(self::TABLE_USERS)