summaryrefslogtreecommitdiff
path: root/app/Controller
diff options
context:
space:
mode:
Diffstat (limited to 'app/Controller')
-rw-r--r--app/Controller/ProjectPermissionController.php4
-rw-r--r--app/Controller/UserAjaxController.php12
2 files changed, 6 insertions, 10 deletions
diff --git a/app/Controller/ProjectPermissionController.php b/app/Controller/ProjectPermissionController.php
index d043d3ec..3fb6c090 100644
--- a/app/Controller/ProjectPermissionController.php
+++ b/app/Controller/ProjectPermissionController.php
@@ -69,6 +69,10 @@ class ProjectPermissionController extends BaseController
$project = $this->getProject();
$values = $this->request->getValues();
+ if (empty($values['user_id']) && ! empty($values['external_id']) && ! empty($values['external_id_column'])) {
+ $values['user_id'] = $this->userModel->getOrCreateExternalUserId($values['username'], $values['name'], $values['external_id_column'], $values['external_id']);
+ }
+
if (empty($values['user_id'])) {
$this->flash->failure(t('User not found.'));
} elseif ($this->projectUserRoleModel->addUser($values['project_id'], $values['user_id'], $values['role'])) {
diff --git a/app/Controller/UserAjaxController.php b/app/Controller/UserAjaxController.php
index 37c09b8a..57596202 100644
--- a/app/Controller/UserAjaxController.php
+++ b/app/Controller/UserAjaxController.php
@@ -2,9 +2,6 @@
namespace Kanboard\Controller;
-use Kanboard\Filter\UserNameFilter;
-use Kanboard\Model\UserModel;
-
/**
* User Ajax Controller
*
@@ -21,13 +18,8 @@ class UserAjaxController extends BaseController
public function autocomplete()
{
$search = $this->request->getStringParam('term');
- $filter = $this->userQuery->withFilter(new UserNameFilter($search));
- $filter->getQuery()
- ->eq(UserModel::TABLE.'.is_active', 1)
- ->asc(UserModel::TABLE.'.name')
- ->asc(UserModel::TABLE.'.username');
-
- $this->response->json($filter->format($this->userAutoCompleteFormatter));
+ $users = $this->userManager->find($search);
+ $this->response->json($this->userAutoCompleteFormatter->withUsers($users)->format());
}
/**