File tree Expand file tree Collapse file tree 3 files changed +12
-4
lines changed
Expand file tree Collapse file tree 3 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ public function implementsActions($actions) {
8484 *
8585 * @param string $username The username of the user to create
8686 * @param string $password The password of the new user
87- * @return bool
87+ * @return string | false The user DN if user creation was successful.
8888 * @throws \Exception
8989 */
9090 public function createUser ($ username , $ password ) {
Original file line number Diff line number Diff line change @@ -615,11 +615,19 @@ public function getNewLDAPConnection($uid) {
615615 * create new user
616616 * @param string $username username of the new user
617617 * @param string $password password of the new user
618- * @return bool was the user created?
618+ * @return bool
619619 */
620620 public function createUser ($ username , $ password ) {
621621 if ($ this ->userPluginManager ->implementsActions (Backend::CREATE_USER )) {
622- return $ this ->userPluginManager ->createUser ($ username , $ password );
622+ if ($ dn = $ this ->userPluginManager ->createUser ($ username , $ password )) {
623+ if (is_string ($ dn )) {
624+ //updates user mapping
625+ $ this ->access ->dn2ocname ($ dn , $ username , true );
626+ } else {
627+ throw new \Exception ("LDAP Plugin: Method createUser changed to return the user DN instead of boolean. " );
628+ }
629+ }
630+ return (bool ) $ dn ;
623631 }
624632 return false ;
625633 }
Original file line number Diff line number Diff line change @@ -1422,7 +1422,7 @@ public function testCreateUserWithPlugin() {
14221422 ->with ('uid ' ,'password ' )
14231423 ->willReturn ('result ' );
14241424
1425- $ this ->assertEquals ($ this ->backend ->createUser ('uid ' , 'password ' ),' result ' );
1425+ $ this ->assertEquals ($ this ->backend ->createUser ('uid ' , 'password ' ),true );
14261426 }
14271427
14281428 public function testCreateUserFailing () {
You can’t perform that action at this time.
0 commit comments