diff options
author | Vinicius Cubas Brand <viniciuscb@gmail.com> | 2019-03-01 18:12:19 +0300 |
---|---|---|
committer | Backportbot <backportbot-noreply@rullzer.com> | 2019-03-21 13:33:03 +0300 |
commit | 20b0817e5c1761b8a2d8f8bc7cf0a167f58029d1 (patch) | |
tree | 0eee03fb8976d00ac041d79620d4688ed7659885 /apps/user_ldap | |
parent | 2c7f1fd001b6f442ed9b32b17d68371cf3f74e2d (diff) |
fix user creation using LDAP Plugin
Signed-off-by: Vinicius Cubas Brand <viniciuscb@gmail.com>
Diffstat (limited to 'apps/user_ldap')
-rw-r--r-- | apps/user_ldap/lib/UserPluginManager.php | 2 | ||||
-rw-r--r-- | apps/user_ldap/lib/User_LDAP.php | 12 | ||||
-rw-r--r-- | apps/user_ldap/tests/User_LDAPTest.php | 2 |
3 files changed, 12 insertions, 4 deletions
diff --git a/apps/user_ldap/lib/UserPluginManager.php b/apps/user_ldap/lib/UserPluginManager.php index b3fda494022..576137970cc 100644 --- a/apps/user_ldap/lib/UserPluginManager.php +++ b/apps/user_ldap/lib/UserPluginManager.php @@ -84,7 +84,7 @@ class UserPluginManager { * * @param string $username The username of the user to create * @param string $password The password of the new user - * @return bool + * @return string | false The user DN if user creation was successful. * @throws \Exception */ public function createUser($username, $password) { diff --git a/apps/user_ldap/lib/User_LDAP.php b/apps/user_ldap/lib/User_LDAP.php index fbdf1cc2551..855c13e13fb 100644 --- a/apps/user_ldap/lib/User_LDAP.php +++ b/apps/user_ldap/lib/User_LDAP.php @@ -615,11 +615,19 @@ class User_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn * create new user * @param string $username username of the new user * @param string $password password of the new user - * @return bool was the user created? + * @return bool */ public function createUser($username, $password) { if ($this->userPluginManager->implementsActions(Backend::CREATE_USER)) { - return $this->userPluginManager->createUser($username, $password); + if ($dn = $this->userPluginManager->createUser($username, $password)) { + if (is_string($dn)) { + //updates user mapping + $this->access->dn2ocname($dn, $username, true); + } else { + throw new \Exception("LDAP Plugin: Method createUser changed to return the user DN instead of boolean."); + } + } + return (bool) $dn; } return false; } diff --git a/apps/user_ldap/tests/User_LDAPTest.php b/apps/user_ldap/tests/User_LDAPTest.php index 693159dc72b..f58c5f881f9 100644 --- a/apps/user_ldap/tests/User_LDAPTest.php +++ b/apps/user_ldap/tests/User_LDAPTest.php @@ -1422,7 +1422,7 @@ class User_LDAPTest extends TestCase { ->with('uid','password') ->willReturn('result'); - $this->assertEquals($this->backend->createUser('uid', 'password'),'result'); + $this->assertEquals($this->backend->createUser('uid', 'password'),true); } public function testCreateUserFailing() { |