Check if the user is assigned to any role in the project

This commit is contained in:
Tomas Dittmann 2020-10-26 01:57:10 +01:00 committed by GitHub
parent ae072d5fcf
commit e470f807b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 5 deletions

View File

@ -124,10 +124,8 @@ class ProjectPermissionModel extends Base
return true;
}
return in_array(
$this->projectUserRoleModel->getUserRole($project_id, $user_id),
array(Role::PROJECT_MANAGER, Role::PROJECT_MEMBER, Role::PROJECT_VIEWER)
);
return $this->userModel->isActive($user_id) &&
$this->isMember($project_id, $user_id);
}
/**
@ -159,7 +157,7 @@ class ProjectPermissionModel extends Base
*/
public function isMember($project_id, $user_id)
{
return in_array($this->projectUserRoleModel->getUserRole($project_id, $user_id), array(Role::PROJECT_MEMBER, Role::PROJECT_MANAGER, Role::PROJECT_VIEWER));
return ! empty($this->projectUserRoleModel->getUserRole($project_id, $user_id));
}
/**