diff options
Diffstat (limited to 'app/Model/ProjectPermission.php')
-rw-r--r-- | app/Model/ProjectPermission.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/app/Model/ProjectPermission.php b/app/Model/ProjectPermission.php index 66f4091d..cea62e13 100644 --- a/app/Model/ProjectPermission.php +++ b/app/Model/ProjectPermission.php @@ -44,6 +44,25 @@ class ProjectPermission extends Base } /** + * Get all usernames (fetch users from groups) + * + * @access public + * @param integer $project_id + * @param string $input + * @return array + */ + public function findUsernames($project_id, $input) + { + $userMembers = $this->projectUserRoleFilter->create()->filterByProjectId($project_id)->startWithUsername($input)->findAll('username'); + $groupMembers = $this->projectGroupRoleFilter->create()->filterByProjectId($project_id)->startWithUsername($input)->findAll('username'); + $members = array_unique(array_merge($userMembers, $groupMembers)); + + sort($members); + + return $members; + } + + /** * Return true if everybody is allowed for the project * * @access public |