diff options
author | Frédéric Guillot <fred@kanboard.net> | 2014-10-05 12:32:44 -0400 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2014-10-05 12:32:44 -0400 |
commit | 7f5a871f84639a90eebd0ac1d0ee7f759e220cf6 (patch) | |
tree | f814b2fa2ae888d0b2e800f14c6c8d6b75e85428 /app/Model/ProjectPermission.php | |
parent | bae57838c2dd789064b246308c7cb3a33bba5b8e (diff) |
Projects are not anymore visible to everybody by default
Diffstat (limited to 'app/Model/ProjectPermission.php')
-rw-r--r-- | app/Model/ProjectPermission.php | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/app/Model/ProjectPermission.php b/app/Model/ProjectPermission.php index 51c11735..9d339f4d 100644 --- a/app/Model/ProjectPermission.php +++ b/app/Model/ProjectPermission.php @@ -33,10 +33,6 @@ class ProjectPermission extends Base { $allowed_users = $this->getAllowedUsers($project_id); - if (empty($allowed_users)) { - $allowed_users = $this->user->getList(); - } - if ($prepend_unassigned) { $allowed_users = array(t('Unassigned')) + $allowed_users; } @@ -146,22 +142,10 @@ class ProjectPermission extends Base */ public function isUserAllowed($project_id, $user_id) { - // If there is nobody specified, everybody have access to the project - $nb_users = $this->db - ->table(self::TABLE) - ->eq('project_id', $project_id) - ->count(); - - if ($nb_users < 1) return true; - - // Check if user has admin rights - $nb_users = $this->db - ->table(User::TABLE) - ->eq('id', $user_id) - ->eq('is_admin', 1) - ->count(); - - if ($nb_users > 0) return true; + // Check if the user has admin rights + if ($this->user->isAdmin($user_id)) { + return true; + } // Otherwise, allow only specific users return (bool) $this->db |