src/Classes/AdldapUsers.php
public function move($username, $container)
    {
        $user = new User([
            'username' => $username,
            'container' => $container,
        ]);

        // Validate only the username and container attributes
        $user->validateRequired(['username', 'container']);

        $this->adldap->utilities()->validateLdapIsBound();

        $userInfo = $this->info($user->getAttribute('username'));

        $dn = $userInfo['dn'];

        $newRDn = 'cn='.$user->getAttribute('username');

        $container = array_reverse($container);

        $newContainer = 'ou='.implode(',ou=', $container);

        $newBaseDn = strtolower($newContainer).','.$this->adldap->getBaseDn();

        return $this->connection->rename($dn, $newRDn, $newBaseDn, true);
    }
public function move($username, $container)
    {
        $user = new User([
            'username' => $username,
            'container' => $container,
        ]);

        // Validate only the username and container attributes
        $user->validateRequired(['username', 'container']);

        $this->adldap->utilities()->validateLdapIsBound();

        $userInfo = $this->info($user->getAttribute('username'));

        $dn = $userInfo['dn'];

        $newRDn = 'cn='.$user->getAttribute('username');

        $container = array_reverse($container);

        $newContainer = 'ou='.implode(',ou=', $container);

        $newBaseDn = strtolower($newContainer).','.$this->adldap->getBaseDn();

        return $this->connection->rename($dn, $newRDn, $newBaseDn, true);
    }
public function move ( $ username , $ container ) { $ user = new User ( [ 'username' => $ username , 'container' => $ container , ] ) ; // Validate only the username and container attributes $ user -> validateRequired ( [ 'username' , 'container' ] ) ; $ this -> adldap -> utilities ( ) -> validateLdapIsBound ( ) ; $ userInfo = $ this -> info ( $ user -> getAttribute ( 'username' ) ) ; $ dn = $ userInfo [ 'dn' ] ; $ newRDn = 'cn=' . $ user -> getAttribute ( 'username' ) ; $ container = array_reverse ( $ container ) ; $ newContainer = 'ou=' . implode ( ',ou=' , $ container ) ; $ newBaseDn = strtolower ( $ newContainer ) . ',' . $ this -> adldap -> getBaseDn ( ) ; return $ this -> connection -> rename ( $ dn , $ newRDn , $ newBaseDn , true ) ; }
Move a user account to a different OU.

When specifying containers, it accepts containers in 1. parent 2. child order

@param string $username  The username to move
@param string $container The container or containers to move the user to

@return bool|string
Move a user account to a different OU .