Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix user creation using LDAP Plugin
Signed-off-by: Vinicius Cubas Brand <viniciuscb@gmail.com>
  • Loading branch information
viniciuscb committed Mar 1, 2019
commit 62ab9e082bc2dc20af8e2b26d34af8cf954b1ff3
2 changes: 1 addition & 1 deletion apps/user_ldap/lib/UserPluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function implementsActions($actions) {
*
* @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) {
Expand Down
12 changes: 10 additions & 2 deletions apps/user_ldap/lib/User_LDAP.php
Original file line number Diff line number Diff line change
Expand Up @@ -615,11 +615,19 @@ public function getNewLDAPConnection($uid) {
* 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;
}
Expand Down
2 changes: 1 addition & 1 deletion apps/user_ldap/tests/User_LDAPTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1422,7 +1422,7 @@ public function testCreateUserWithPlugin() {
->with('uid','password')
->willReturn('result');

$this->assertEquals($this->backend->createUser('uid', 'password'),'result');
$this->assertEquals($this->backend->createUser('uid', 'password'),true);
}

public function testCreateUserFailing() {
Expand Down