101 foreach ($this->privileges as $ace) {
127 echo "<tr><th>Principal</th><th>Privilege</th><th></th></tr>";
128 foreach ($this->privileges as $privilege) {
132 if ($privilege[
'principal'][0] ===
'{') {
133 echo '<td>', $html->
xmlName($privilege[
'principal']),
'</td>';
135 echo '<td>', $html->
link($privilege[
'principal']),
'</td>';
137 echo '<td>', $html->
xmlName($privilege[
'privilege']),
'</td>';
139 if (!empty($privilege[
'protected']))
echo '(protected)';
145 return ob_get_clean();
173 '{DAV:}ace' =>
'Sabre\Xml\Element\KeyValue',
174 '{DAV:}privilege' =>
'Sabre\Xml\Element\Elements',
175 '{DAV:}principal' =>
'Sabre\DAVACL\Xml\Property\Principal',
180 foreach ((array)$reader->
parseInnerTree($elementMap) as $element) {
182 if ($element[
'name'] !==
'{DAV:}ace') {
185 $ace = $element[
'value'];
187 if (empty($ace[
'{DAV:}principal'])) {
188 throw new DAV\Exception\BadRequest(
'Each {DAV:}ace element must have one {DAV:}principal element');
190 $principal = $ace[
'{DAV:}principal'];
192 switch ($principal->getType()) {
194 $principal = $principal->getHref();
197 $principal =
'{DAV:}authenticated';
200 $principal =
'{DAV:}unauthenticated';
203 $principal =
'{DAV:}all';
208 $protected = array_key_exists(
'{DAV:}protected', $ace);
210 if (!isset($ace[
'{DAV:}grant'])) {
211 throw new DAV\Exception\NotImplemented(
'Every {DAV:}ace element must have a {DAV:}grant element. {DAV:}deny is not yet supported');
213 foreach ($ace[
'{DAV:}grant'] as $elem) {
214 if ($elem[
'name'] !==
'{DAV:}privilege') {
218 foreach ($elem[
'value'] as $priv) {
220 'principal' => $principal,
221 'protected' => $protected,
222 'privilege' => $priv,
245 switch ($ace[
'principal']) {
246 case '{DAV:}authenticated' :
249 case '{DAV:}unauthenticated' :
266 $writer->endElement();
267 $writer->endElement();
269 if (!empty($ace[
'protected'])) {
273 $writer->endElement();
parseInnerTree(array $elementMap=null)
Parses all elements below the current element.
const ALL
Everybody, basically.
getPrivileges()
Returns the list of privileges for this property.
startElement($name)
Opens a new element.
serializeAce(Writer $writer, array $ace)
Serializes a single access control entry.
__construct(array $privileges, $prefixBaseUrl=true)
Constructor.
const UNAUTHENTICATED
To specify a not-logged-in user, use the UNAUTHENTICATED principal.
The Reader class expands upon PHP's built-in XMLReader.
const AUTHENTICATED
To specify any principal that is logged in, use AUTHENTICATED.
link($url, $label=null)
Generates a full -tag.
WebDAV properties that implement this interface are able to generate their own html output for the br...
toHtml(HtmlOutputHelper $html)
Generate html representation for this value.
xmlName($element)
This method takes an xml element in clark-notation, and turns it into a shortened version with a pref...
This is the XML element interface.
static xmlDeserialize(Reader $reader)
The deserialize method is called during xml parsing.
const HREF
Specific principals can be specified with the HREF.
xmlSerialize(Writer $writer)
The xmlSerialize method is called during xml writing.
This class represents the {DAV:}acl property.
writeElement($name, $content=null)
Write a full element tag and it's contents.
This class provides a few utility functions for easily generating HTML for the browser plugin...