瀏覽代碼

fix user creation using LDAP Plugin

Signed-off-by: Vinicius Cubas Brand <viniciuscb@gmail.com>
tags/v16.0.0beta1
Vinicius Cubas Brand 5 年之前
父節點
當前提交
c4dbc428f9
No account linked to committer's email address
共有 3 個文件被更改,包括 12 次插入4 次删除
  1. 1
    1
      apps/user_ldap/lib/UserPluginManager.php
  2. 10
    2
      apps/user_ldap/lib/User_LDAP.php
  3. 1
    1
      apps/user_ldap/tests/User_LDAPTest.php

+ 1
- 1
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) {

+ 10
- 2
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;
}

+ 1
- 1
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() {

Loading…
取消
儲存