source: pmb4.2/trunk/fuentes/pmb/admin/connecteurs/out/webdav/lib/Sabre/DAVACL/Property/CurrentUserPrivilegeSet.php @ 815

Last change on this file since 815 was 815, checked in by jrpelegrina, 4 years ago

Initial release of pmb 4.2

  • Property svn:executable set to *
File size: 1.7 KB
Line 
1<?php
2
3namespace Sabre\DAVACL\Property;
4
5use Sabre\DAV;
6
7/**
8 * CurrentUserPrivilegeSet
9 *
10 * This class represents the current-user-privilege-set property. When
11 * requested, it contain all the privileges a user has on a specific node.
12 *
13 * @copyright Copyright (C) 2007-2013 Rooftop Solutions. All rights reserved.
14 * @author Evert Pot (http://www.rooftopsolutions.nl/)
15 * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
16 */
17class CurrentUserPrivilegeSet extends DAV\Property {
18
19    /**
20     * List of privileges
21     *
22     * @var array
23     */
24    private $privileges;
25
26    /**
27     * Creates the object
28     *
29     * Pass the privileges in clark-notation
30     *
31     * @param array $privileges
32     */
33    public function __construct(array $privileges) {
34
35        $this->privileges = $privileges;
36
37    }
38
39    /**
40     * Serializes the property in the DOM
41     *
42     * @param DAV\Server $server
43     * @param \DOMElement $node
44     * @return void
45     */
46    public function serialize(DAV\Server $server,\DOMElement $node) {
47
48        $doc = $node->ownerDocument;
49        foreach($this->privileges as $privName) {
50
51            $this->serializePriv($doc,$node,$privName);
52
53        }
54
55    }
56
57    /**
58     * Serializes one privilege
59     *
60     * @param \DOMDocument $doc
61     * @param \DOMElement $node
62     * @param string $privName
63     * @return void
64     */
65    protected function serializePriv($doc,$node,$privName) {
66
67        $xp  = $doc->createElementNS('DAV:','d:privilege');
68        $node->appendChild($xp);
69
70        $privParts = null;
71        preg_match('/^{([^}]*)}(.*)$/',$privName,$privParts);
72
73        $xp->appendChild($doc->createElementNS($privParts[1],'d:'.$privParts[2]));
74
75    }
76
77}
Note: See TracBrowser for help on using the repository browser.