4 * CurrentUserPrivilegeSet
6 * This class represents the current-user-privilege-set property. When
7 * requested, it contain all the privileges a user has on a specific node.
11 * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
12 * @author Evert Pot (http://www.rooftopsolutions.nl/)
13 * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
15 class Sabre_DAVACL_Property_CurrentUserPrivilegeSet extends Sabre_DAV_Property {
27 * Pass the privileges in clark-notation
29 * @param array $privileges
31 public function __construct(array $privileges) {
33 $this->privileges = $privileges;
38 * Serializes the property in the DOM
40 * @param Sabre_DAV_Server $server
41 * @param DOMElement $node
44 public function serialize(Sabre_DAV_Server $server,DOMElement $node) {
46 $doc = $node->ownerDocument;
47 foreach($this->privileges as $privName) {
49 $this->serializePriv($doc,$node,$privName);
56 * Serializes one privilege
58 * @param DOMDocument $doc
59 * @param DOMElement $node
60 * @param string $privName
63 protected function serializePriv($doc,$node,$privName) {
65 $xp = $doc->createElementNS('DAV:','d:privilege');
66 $node->appendChild($xp);
69 preg_match('/^{([^}]*)}(.*)$/',$privName,$privParts);
71 $xp->appendChild($doc->createElementNS($privParts[1],'d:'.$privParts[2]));