ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
AbstractPrincipalCollection.php
Go to the documentation of this file.
1<?php
2
3namespace Sabre\DAVACL;
4
5use Sabre\DAV;
7
21
28
35
42 public $disableListing = false;
43
56 function __construct(PrincipalBackend\BackendInterface $principalBackend, $principalPrefix = 'principals') {
57
58 $this->principalPrefix = $principalPrefix;
59 $this->principalBackend = $principalBackend;
60
61 }
62
73 abstract function getChildForPrincipal(array $principalInfo);
74
80 function getName() {
81
82 list(, $name) = URLUtil::splitPath($this->principalPrefix);
83 return $name;
84
85 }
86
92 function getChildren() {
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 }
107
115 function getChild($name) {
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 }
122
146 function searchPrincipals(array $searchProperties, $test = 'allof') {
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 }
158
175 function findByUri($uri) {
176
177 return $this->principalBackend->findByUri($uri, $this->principalPrefix);
178
179 }
180
181}
$result
$test
Definition: Utf8Test.php:84
An exception for terminatinating execution or to throw for unit testing.
getChildForPrincipal(array $principalInfo)
This method returns a node for a principal.
getChild($name)
Returns a child object, by its name.
getName()
Returns the name of this collection.
__construct(PrincipalBackend\BackendInterface $principalBackend, $principalPrefix='principals')
Creates the object.
searchPrincipals(array $searchProperties, $test='allof')
This method is used to search for principals matching a set of properties.
Collection class.
Definition: Collection.php:15
URL utility class.
Definition: URLUtil.php:18
static splitPath($path)
Returns the 'dirname' and 'basename' for a path.
Definition: URLUtil.php:83
$r
Definition: example_031.php:79
Principal Collection interface.
$row