diff options
author | Frederic Guillot <fred@kanboard.net> | 2017-06-03 16:53:40 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2017-06-03 16:53:40 -0400 |
commit | 9668723af4f9ad633d9c9131fbdceb47fa326d9e (patch) | |
tree | 86b019a77fa0ec05e77d10c5de16ee8fae697ade /app/Model/ProjectPermissionModel.php | |
parent | e27148dfd8192ed3052adb8397a0f8c4ed47916d (diff) |
Add dropdown menu to autocomplete email field from project members
Diffstat (limited to 'app/Model/ProjectPermissionModel.php')
-rw-r--r-- | app/Model/ProjectPermissionModel.php | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/app/Model/ProjectPermissionModel.php b/app/Model/ProjectPermissionModel.php index dabd406c..752913d7 100644 --- a/app/Model/ProjectPermissionModel.php +++ b/app/Model/ProjectPermissionModel.php @@ -93,6 +93,24 @@ class ProjectPermissionModel extends Base return $members; } + public function getMembers($project_id) + { + $userMembers = $this->projectUserRoleModel->getUsers($project_id); + $groupMembers = $this->projectGroupRoleModel->getUsers($project_id); + + $userMembers = array_column_index_unique($userMembers, 'username'); + $groupMembers = array_column_index_unique($groupMembers, 'username'); + return array_merge($userMembers, $groupMembers); + } + + public function getMembersWithEmail($project_id) + { + $members = $this->getMembers($project_id); + return array_filter($members, function (array $user) { + return ! empty($user['email']); + }); + } + /** * Return true if everybody is allowed for the project * |