ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\DAVACL\AbstractPrincipalCollection Class Reference

Principals Collection. More...

+ Inheritance diagram for Sabre\DAVACL\AbstractPrincipalCollection:
+ Collaboration diagram for Sabre\DAVACL\AbstractPrincipalCollection:

Public Member Functions

 __construct (PrincipalBackend\BackendInterface $principalBackend, $principalPrefix='principals')
 Creates the object. More...
 
 getChildForPrincipal (array $principalInfo)
 This method returns a node for a principal. More...
 
 getName ()
 Returns the name of this collection. More...
 
 getChildren ()
 Return the list of users. More...
 
 getChild ($name)
 Returns a child object, by its name. More...
 
 searchPrincipals (array $searchProperties, $test='allof')
 This method is used to search for principals matching a set of properties. More...
 
 findByUri ($uri)
 Finds a principal by its URI. More...
 
- Public Member Functions inherited from Sabre\DAV\Collection
 getChild ($name)
 Returns a child object, by its name. More...
 
 childExists ($name)
 Checks is a child-node exists. More...
 
 createFile ($name, $data=null)
 Creates a new file in the directory. More...
 
 createDirectory ($name)
 Creates a new subdirectory. More...
 
- Public Member Functions inherited from Sabre\DAV\Node
 getLastModified ()
 Returns the last modification time as a unix timestamp. More...
 
 delete ()
 Deletes the current node. More...
 
 setName ($name)
 Renames the node. More...
 
 delete ()
 Deleted the current node. More...
 
 getName ()
 Returns the name of the node. More...
 
 setName ($name)
 Renames the node. More...
 
 getLastModified ()
 Returns the last modification time, as a unix timestamp. More...
 
 createFile ($name, $data=null)
 Creates a new file in the directory. More...
 
 createDirectory ($name)
 Creates a new subdirectory. More...
 
 getChild ($name)
 Returns a specific child node, referenced by its name. More...
 
 getChildren ()
 Returns an array with all the child nodes. More...
 
 childExists ($name)
 Checks if a child-node with the specified name exists. More...
 
 searchPrincipals (array $searchProperties, $test='allof')
 This method is used to search for principals matching a set of properties. More...
 
 findByUri ($uri)
 Finds a principal by its URI. More...
 

Data Fields

 $disableListing = false
 

Protected Attributes

 $principalBackend
 
 $principalPrefix
 

Detailed Description

Principals Collection.

This is a helper class that easily allows you to create a collection that has a childnode for every principal.

To use this class, simply implement the getChildForPrincipal method.

Author
Evert Pot (http://evertpot.com/) @license http://sabre.io/license/ Modified BSD License

Definition at line 20 of file AbstractPrincipalCollection.php.

Constructor & Destructor Documentation

◆ __construct()

Sabre\DAVACL\AbstractPrincipalCollection::__construct ( PrincipalBackend\BackendInterface  $principalBackend,
  $principalPrefix = 'principals' 
)

Creates the object.

This object must be passed the principal backend. This object will filter all principals from a specified prefix ($principalPrefix). The default is 'principals', if your principals are stored in a different collection, override $principalPrefix

Parameters
PrincipalBackend\BackendInterface$principalBackend
string$principalPrefix

Definition at line 56 of file AbstractPrincipalCollection.php.

References Sabre\DAVACL\AbstractPrincipalCollection\$principalBackend, and Sabre\DAVACL\AbstractPrincipalCollection\$principalPrefix.

Member Function Documentation

◆ findByUri()

Sabre\DAVACL\AbstractPrincipalCollection::findByUri (   $uri)

Finds a principal by its URI.

This method may receive any type of uri, but mailto: addresses will be the most common.

Implementation of this API is optional. It is currently used by the CalDAV system to find principals based on their email addresses. If this API is not implemented, some features may not work correctly.

This method must return a relative principal path, or null, if the principal was not found or you refuse to find it.

Parameters
string$uri
Returns
string

Implements Sabre\DAVACL\IPrincipalCollection.

Definition at line 175 of file AbstractPrincipalCollection.php.

175 {
176
177 return $this->principalBackend->findByUri($uri, $this->principalPrefix);
178
179 }

◆ getChild()

Sabre\DAVACL\AbstractPrincipalCollection::getChild (   $name)

Returns a child object, by its name.

Parameters
string$name
Exceptions
DAV

Exception\NotFound

Returns
DAV\INode

Reimplemented from Sabre\DAV\Collection.

Definition at line 115 of file AbstractPrincipalCollection.php.

115 {
116
117 $principalInfo = $this->principalBackend->getPrincipalByPath($this->principalPrefix . '/' . $name);
118 if (!$principalInfo) throw new DAV\Exception\NotFound('Principal with name ' . $name . ' not found');
119 return $this->getChildForPrincipal($principalInfo);
120
121 }
getChildForPrincipal(array $principalInfo)
This method returns a node for a principal.

References $name, and Sabre\DAVACL\AbstractPrincipalCollection\getChildForPrincipal().

+ Here is the call graph for this function:

◆ getChildForPrincipal()

Sabre\DAVACL\AbstractPrincipalCollection::getChildForPrincipal ( array  $principalInfo)
abstract

This method returns a node for a principal.

The passed array contains principal information, and is guaranteed to at least contain a uri item. Other properties may or may not be supplied by the authentication backend.

Parameters
array$principalInfo
Returns
IPrincipal

Reimplemented in Sabre\CalDAV\CalendarRoot, Sabre\CardDAV\AddressBookRoot, Sabre\DAVACL\PrincipalCollection, Sabre\CalDAV\Principal\Collection, and Sabre\DAVACL\FS\HomeCollection.

Referenced by Sabre\DAVACL\AbstractPrincipalCollection\getChild(), and Sabre\DAVACL\AbstractPrincipalCollection\getChildren().

+ Here is the caller graph for this function:

◆ getChildren()

Sabre\DAVACL\AbstractPrincipalCollection::getChildren ( )

Return the list of users.

Returns
array

Implements Sabre\DAV\ICollection.

Definition at line 92 of file AbstractPrincipalCollection.php.

92 {
93
94 if ($this->disableListing)
95 throw new DAV\Exception\MethodNotAllowed('Listing members of this collection is disabled');
96
97 $children = [];
98 foreach ($this->principalBackend->getPrincipalsByPrefix($this->principalPrefix) as $principalInfo) {
99
100 $children[] = $this->getChildForPrincipal($principalInfo);
101
102
103 }
104 return $children;
105
106 }

References Sabre\DAVACL\AbstractPrincipalCollection\getChildForPrincipal().

+ Here is the call graph for this function:

◆ getName()

Sabre\DAVACL\AbstractPrincipalCollection::getName ( )

Returns the name of this collection.

Returns
string

Implements Sabre\DAV\INode.

Reimplemented in Sabre\CalDAV\CalendarRoot, Sabre\CardDAV\AddressBookRoot, and Sabre\DAVACL\FS\HomeCollection.

Definition at line 80 of file AbstractPrincipalCollection.php.

80 {
81
82 list(, $name) = URLUtil::splitPath($this->principalPrefix);
83 return $name;
84
85 }
static splitPath($path)
Returns the 'dirname' and 'basename' for a path.
Definition: URLUtil.php:83

References $name, and Sabre\HTTP\URLUtil\splitPath().

+ Here is the call graph for this function:

◆ searchPrincipals()

Sabre\DAVACL\AbstractPrincipalCollection::searchPrincipals ( array  $searchProperties,
  $test = 'allof' 
)

This method is used to search for principals matching a set of properties.

This search is specifically used by RFC3744's principal-property-search REPORT. You should at least allow searching on http://sabredav.org/ns}email-address.

The actual search should be a unicode-non-case-sensitive search. The keys in searchProperties are the WebDAV property names, while the values are the property values to search on.

By default, if multiple properties are submitted to this method, the various properties should be combined with 'AND'. If $test is set to 'anyof', it should be combined using 'OR'.

This method should simply return a list of 'child names', which may be used to call $this->getChild in the future.

Parameters
array$searchProperties
string$test
Returns
array

Implements Sabre\DAVACL\IPrincipalCollection.

Definition at line 146 of file AbstractPrincipalCollection.php.

146 {
147
148 $result = $this->principalBackend->searchPrincipals($this->principalPrefix, $searchProperties, $test);
149 $r = [];
150
151 foreach ($result as $row) {
152 list(, $r[]) = URLUtil::splitPath($row);
153 }
154
155 return $r;
156
157 }
$result
$test
Definition: Utf8Test.php:84
$r
Definition: example_031.php:79
$row

References $r, $result, $row, $test, and Sabre\HTTP\URLUtil\splitPath().

+ Here is the call graph for this function:

Field Documentation

◆ $disableListing

Sabre\DAVACL\AbstractPrincipalCollection::$disableListing = false

Definition at line 42 of file AbstractPrincipalCollection.php.

◆ $principalBackend

Sabre\DAVACL\AbstractPrincipalCollection::$principalBackend
protected

◆ $principalPrefix


The documentation for this class was generated from the following file: