From 7257206bcff84368dd255540fa6918e39f14f3fe Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 20 Jun 2017 19:59:41 +0200 Subject: [PATCH] Create users in non default backends first Most of the time, when people have multiple backends or add a custom backend, they want to create the users there and not in the default backend. But since that is registered first, users were always created there. Signed-off-by: Joas Schilling --- lib/private/User/Manager.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/private/User/Manager.php b/lib/private/User/Manager.php index 0477f23e552..c04f426c2cf 100644 --- a/lib/private/User/Manager.php +++ b/lib/private/User/Manager.php @@ -284,7 +284,20 @@ class Manager extends PublicEmitter implements IUserManager { * @return bool|IUser the created user or false */ public function createUser($uid, $password) { + $localBackends = []; foreach ($this->backends as $backend) { + if ($backend instanceof Database) { + // First check if there is another user backend + $localBackends[] = $backend; + continue; + } + + if ($backend->implementsActions(Backend::CREATE_USER)) { + return $this->createUserFromBackend($uid, $password, $backend); + } + } + + foreach ($localBackends as $backend) { if ($backend->implementsActions(Backend::CREATE_USER)) { return $this->createUserFromBackend($uid, $password, $backend); } -- 2.39.5