src/Model/Table/GroupsTable.php
protected function _getLdapGroups(): array
    {
        $result = [];

        $config = (array)Configure::read('Groups.remoteGroups.LDAP');
        if (!empty(array_diff($this->ldapRequiredParams, array_keys($config)))) {
            return $result;
        }

        $connection = $this->_ldapConnect($config);
        if (!is_resource($connection)) {
            return $result;
        }

        $search = ldap_search($connection, $config['baseDn'], $config['groupsFilter'], ['cn']);
        if (!is_resource($search)) {
            Log::critical('Failed to search LDAP');

            return $result;
        }

        $result = ldap_get_entries($connection, $search);

        if (empty($result)) {
            return $result;
        }

        return $this->_normalizeResult($result);
    }
protected function _getLdapGroups(): array
    {
        $result = [];

        $config = (array)Configure::read('Groups.remoteGroups.LDAP');
        if (!empty(array_diff($this->ldapRequiredParams, array_keys($config)))) {
            return $result;
        }

        $connection = $this->_ldapConnect($config);
        if (!is_resource($connection)) {
            return $result;
        }

        $search = ldap_search($connection, $config['baseDn'], $config['groupsFilter'], ['cn']);
        if (!is_resource($search)) {
            Log::critical('Failed to search LDAP');

            return $result;
        }

        $result = ldap_get_entries($connection, $search);

        if (empty($result)) {
            return $result;
        }

        return $this->_normalizeResult($result);
    }
protected function _getLdapGroups ( ) : array { $ result = [ ] ; $ config = ( array ) Configure :: read ( 'Groups.remoteGroups.LDAP' ) ; if ( ! empty ( array_diff ( $ this -> ldapRequiredParams , array_keys ( $ config ) ) ) ) { return $ result ; } $ connection = $ this -> _ldapConnect ( $ config ) ; if ( ! is_resource ( $ connection ) ) { return $ result ; } $ search = ldap_search ( $ connection , $ config [ 'baseDn' ] , $ config [ 'groupsFilter' ] , [ 'cn' ] ) ; if ( ! is_resource ( $ search ) ) { Log :: critical ( 'Failed to search LDAP' ) ; return $ result ; } $ result = ldap_get_entries ( $ connection , $ search ) ; if ( empty ( $ result ) ) { return $ result ; } return $ this -> _normalizeResult ( $ result ) ; }
Fetch LDAP groups.

@return mixed[]
Fetch LDAP groups .