src/Shell/Task/SyncLdapGroupsTask.php
protected function getUsers(array $data, string $domain): array
    {
        /**
         * @var \CakeDC\Users\Model\Table\UsersTable $table
         */
        $table = $this->getUsersTable();

        $result = [];
        for ($i = 0; $i < $data['count']; $i++) {
            $username = $data[$i]['userprincipalname'][0];
            $username = str_replace('@' . $domain, '', $username);

            $query = $table->find()->where(['username' => $username]);
            if ($query->isEmpty()) {
                continue;
            }

            $result[] = $query->first();
        }

        return $result;
    }
protected function getUsers(array $data, string $domain): array
    {
        /**
         * @var \CakeDC\Users\Model\Table\UsersTable $table
         */
        $table = $this->getUsersTable();

        $result = [];
        for ($i = 0; $i < $data['count']; $i++) {
            $username = $data[$i]['userprincipalname'][0];
            $username = str_replace('@' . $domain, '', $username);

            $query = $table->find()->where(['username' => $username]);
            if ($query->isEmpty()) {
                continue;
            }

            $result[] = $query->first();
        }

        return $result;
    }
protected function getUsers ( array $ data , string $ domain ) : array { /**
         * @var \CakeDC\Users\Model\Table\UsersTable $table
         */ $ table = $ this -> getUsersTable ( ) ; $ result = [ ] ; for ( $ i = 0 ; $ i < $ data [ 'count' ] ; $ i ++ ) { $ username = $ data [ $ i ] [ 'userprincipalname' ] [ 0 ] ; $ username = str_replace ( '@' . $ domain , '' , $ username ) ; $ query = $ table -> find ( ) -> where ( [ 'username' => $ username ] ) ; if ( $ query -> isEmpty ( ) ) { continue ; } $ result [ ] = $ query -> first ( ) ; } return $ result ; }
Fetch system users which are members of LDAP group.

@param mixed[] $data LDAP result
@param string $domain LDAP domain
@return mixed[]
Fetch system users which are members of LDAP group .