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

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));
}
/**