summaryrefslogtreecommitdiff
path: root/app/Model/ProjectUserRole.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-05-05 22:13:11 -0400
committerFrederic Guillot <fred@kanboard.net>2016-05-05 22:13:11 -0400
commitcfb96c87497f3878f6b2a602d396194eae9efbe9 (patch)
treeab099ff01fc8f23162e0d4e2c92ba5f9095de4cf /app/Model/ProjectUserRole.php
parentab56d9aff280d4e5b436d8f5d843f586bef9c059 (diff)
Allow a project owner to manage his own public project
Diffstat (limited to 'app/Model/ProjectUserRole.php')
-rw-r--r--app/Model/ProjectUserRole.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/app/Model/ProjectUserRole.php b/app/Model/ProjectUserRole.php
index 2956c524..db26fd5f 100644
--- a/app/Model/ProjectUserRole.php
+++ b/app/Model/ProjectUserRole.php
@@ -69,8 +69,13 @@ class ProjectUserRole extends Base
*/
public function getUserRole($project_id, $user_id)
{
- if ($this->projectPermission->isEverybodyAllowed($project_id)) {
- return Role::PROJECT_MEMBER;
+ $projectInfo = $this->db->table(Project::TABLE)
+ ->eq('id', $project_id)
+ ->columns('owner_id', 'is_everybody_allowed')
+ ->findOne();
+
+ if ($projectInfo['is_everybody_allowed'] == 1) {
+ return $projectInfo['owner_id'] == $user_id ? Role::PROJECT_MANAGER : Role::PROJECT_MEMBER;
}
$role = $this->db->table(self::TABLE)->eq('user_id', $user_id)->eq('project_id', $project_id)->findOneColumn('role');