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.
This commit is contained in:
toomyem 2014-03-05 09:40:06 +01:00
parent 141616b48c
commit 384b64b7fa
1 changed files with 9 additions and 0 deletions

View File

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