public function principalSearch(array $searchProperties, array $requestedProperties, $collectionUri = null, $test = 'allof')
    {
        if (!is_null($collectionUri)) {
            $uris = [$collectionUri];
        } else {
            $uris = $this->principalCollectionSet;
        }

        $lookupResults = [];
        foreach ($uris as $uri) {
            $principalCollection = $this->server->tree->getNodeForPath($uri);
            if (!$principalCollection instanceof IPrincipalCollection) {
                // Not a principal collection, we're simply going to ignore
                // this.
                continue;
            }

            $results = $principalCollection->searchPrincipals($searchProperties, $test);
            foreach ($results as $result) {
                $lookupResults[] = rtrim($uri, '/').'/'.$result;
            }
        }

        $matches = [];

        foreach ($lookupResults as $lookupResult) {
            list($matches[]) = $this->server->getPropertiesForPath($lookupResult, $requestedProperties, 0);
        }

        return $matches;
    }
public function principalSearch(array $searchProperties, array $requestedProperties, $collectionUri = null, $test = 'allof')
    {
        if (!is_null($collectionUri)) {
            $uris = [$collectionUri];
        } else {
            $uris = $this->principalCollectionSet;
        }

        $lookupResults = [];
        foreach ($uris as $uri) {
            $principalCollection = $this->server->tree->getNodeForPath($uri);
            if (!$principalCollection instanceof IPrincipalCollection) {
                // Not a principal collection, we're simply going to ignore
                // this.
                continue;
            }

            $results = $principalCollection->searchPrincipals($searchProperties, $test);
            foreach ($results as $result) {
                $lookupResults[] = rtrim($uri, '/').'/'.$result;
            }
        }

        $matches = [];

        foreach ($lookupResults as $lookupResult) {
            list($matches[]) = $this->server->getPropertiesForPath($lookupResult, $requestedProperties, 0);
        }

        return $matches;
    }
public function principalSearch ( array $ searchProperties , array $ requestedProperties , $ collectionUri = null , $ test = 'allof' ) { if ( ! is_null ( $ collectionUri ) ) { $ uris = [ $ collectionUri ] ; } else { $ uris = $ this -> principalCollectionSet ; } $ lookupResults = [ ] ; foreach ( $ uris as $ uri ) { $ principalCollection = $ this -> server -> tree -> getNodeForPath ( $ uri ) ; if ( ! $ principalCollection instanceof IPrincipalCollection ) { // Not a principal collection, we're simply going to ignore // this. continue ; } $ results = $ principalCollection -> searchPrincipals ( $ searchProperties , $ test ) ; foreach ( $ results as $ result ) { $ lookupResults [ ] = rtrim ( $ uri , '/' ) . '/' . $ result ; } } $ matches = [ ] ; foreach ( $ lookupResults as $ lookupResult ) { list ( $ matches [ ] ) = $ this -> server -> getPropertiesForPath ( $ lookupResult , $ requestedProperties , 0 ) ; } return $ matches ; }
Principal property search.

This method can search for principals matching certain values in
properties.

This method will return a list of properties for the matched properties.

@param array  $searchProperties    The properties to search on. This is a
key-value list. The keys are property
names, and the values the strings to
match them on.
@param array  $requestedProperties this is the list of properties to
return for every match
@param string $collectionUri       the principal collection to search on.
If this is ommitted, the standard
principal collection-set will be used
@param string $test                "allof" to use AND to search the
properties. 'anyof' for OR.

@return array This method returns an array structure similar to
Sabre\DAV\Server::getPropertiesForPath. Returned
properties are index by a HTTP status code.
Principal property search .