public function getPrincipalsByPrefix($prefixPath)
    {
        $fields = [
            'uri',
        ];

        foreach ($this->fieldMap as $key => $value) {
            $fields[] = $value['dbField'];
        }
        $result = $this->pdo->query('SELECT '.implode(',', $fields).'  FROM '.$this->tableName);

        $principals = [];

        while ($row = $result->fetch(\PDO::FETCH_ASSOC)) {
            // Checking if the principal is in the prefix
            list($rowPrefix) = Uri\split($row['uri']);
            if ($rowPrefix !== $prefixPath) {
                continue;
            }

            $principal = [
                'uri' => $row['uri'],
            ];
            foreach ($this->fieldMap as $key => $value) {
                if ($row[$value['dbField']]) {
                    $principal[$key] = $row[$value['dbField']];
                }
            }
            $principals[] = $principal;
        }

        return $principals;
    }
public function getPrincipalsByPrefix($prefixPath)
    {
        $fields = [
            'uri',
        ];

        foreach ($this->fieldMap as $key => $value) {
            $fields[] = $value['dbField'];
        }
        $result = $this->pdo->query('SELECT '.implode(',', $fields).'  FROM '.$this->tableName);

        $principals = [];

        while ($row = $result->fetch(\PDO::FETCH_ASSOC)) {
            // Checking if the principal is in the prefix
            list($rowPrefix) = Uri\split($row['uri']);
            if ($rowPrefix !== $prefixPath) {
                continue;
            }

            $principal = [
                'uri' => $row['uri'],
            ];
            foreach ($this->fieldMap as $key => $value) {
                if ($row[$value['dbField']]) {
                    $principal[$key] = $row[$value['dbField']];
                }
            }
            $principals[] = $principal;
        }

        return $principals;
    }
public function getPrincipalsByPrefix ( $ prefixPath ) { $ fields = [ 'uri' , ] ; foreach ( $ this -> fieldMap as $ key => $ value ) { $ fields [ ] = $ value [ 'dbField' ] ; } $ result = $ this -> pdo -> query ( 'SELECT ' . implode ( ',' , $ fields ) . '  FROM ' . $ this -> tableName ) ; $ principals = [ ] ; while ( $ row = $ result -> fetch ( \ PDO :: FETCH_ASSOC ) ) { // Checking if the principal is in the prefix list ( $ rowPrefix ) = Uri \ split ( $ row [ 'uri' ] ) ; if ( $ rowPrefix !== $ prefixPath ) { continue ; } $ principal = [ 'uri' => $ row [ 'uri' ] , ] ; foreach ( $ this -> fieldMap as $ key => $ value ) { if ( $ row [ $ value [ 'dbField' ] ] ) { $ principal [ $ key ] = $ row [ $ value [ 'dbField' ] ] ; } } $ principals [ ] = $ principal ; } return $ principals ; }
Returns a list of principals based on a prefix.

This prefix will often contain something like 'principals'. You are only
expected to return principals that are in this base path.

You are expected to return at least a 'uri' for every user, you can
return any additional properties if you wish so. Common properties are:
{DAV:}displayname
{http://sabredav.org/ns}email-address - This is a custom SabreDAV
field that's actualy injected in a number of other properties. If
you have an email address, use this property.

@param string $prefixPath

@return array
Returns a list of principals based on a prefix .