]> git.mxchange.org Git - friendica-addons.git/blob - dav/SabreDAV/lib/Sabre/CalDAV/Schedule/Outbox.php
Merge branch '3.6-rc'
[friendica-addons.git] / dav / SabreDAV / lib / Sabre / CalDAV / Schedule / Outbox.php
1 <?php
2
3 /**
4  * The CalDAV scheduling outbox
5  *
6  * The outbox is mainly used as an endpoint in the tree for a client to do
7  * free-busy requests. This functionality is completely handled by the
8  * Scheduling addon, so this object is actually mostly static.
9  *
10  * @package Sabre
11  * @subpackage CalDAV
12  * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
13  * @author Evert Pot (http://www.rooftopsolutions.nl/)
14  * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
15  */
16 class Sabre_CalDAV_Schedule_Outbox extends Sabre_DAV_Collection implements Sabre_CalDAV_Schedule_IOutbox {
17
18     /**
19      * The principal Uri
20      *
21      * @var string
22      */
23     protected $principalUri;
24
25     /**
26      * Constructor
27      *
28      * @param string $principalUri
29      */
30     public function __construct($principalUri) {
31
32         $this->principalUri = $principalUri;
33
34     }
35
36     /**
37      * Returns the name of the node.
38      *
39      * This is used to generate the url.
40      *
41      * @return string
42      */
43     public function getName() {
44
45         return 'outbox';
46
47     }
48
49     /**
50      * Returns an array with all the child nodes
51      *
52      * @return Sabre_DAV_INode[]
53      */
54     public function getChildren() {
55
56         return array();
57
58     }
59
60     /**
61      * Returns the owner principal
62      *
63      * This must be a url to a principal, or null if there's no owner
64      *
65      * @return string|null
66      */
67     public function getOwner() {
68
69         return $this->principalUri;
70
71     }
72
73     /**
74      * Returns a group principal
75      *
76      * This must be a url to a principal, or null if there's no owner
77      *
78      * @return string|null
79      */
80     public function getGroup() {
81
82         return null;
83
84     }
85
86     /**
87      * Returns a list of ACE's for this node.
88      *
89      * Each ACE has the following properties:
90      *   * 'privilege', a string such as {DAV:}read or {DAV:}write. These are
91      *     currently the only supported privileges
92      *   * 'principal', a url to the principal who owns the node
93      *   * 'protected' (optional), indicating that this ACE is not allowed to
94      *      be updated.
95      *
96      * @return array
97      */
98     public function getACL() {
99
100         return array(
101             array(
102                 'privilege' => '{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}schedule-query-freebusy',
103                 'principal' => $this->getOwner(),
104                 'protected' => true,
105             ),
106             array(
107                 'privilege' => '{DAV:}read',
108                 'principal' => $this->getOwner(),
109                 'protected' => true,
110             ),
111         );
112
113     }
114
115     /**
116      * Updates the ACL
117      *
118      * This method will receive a list of new ACE's.
119      *
120      * @param array $acl
121      * @return void
122      */
123     public function setACL(array $acl) {
124
125         throw new Sabre_DAV_Exception_MethodNotAllowed('You\'re not allowed to update the ACL');
126
127     }
128
129     /**
130      * Returns the list of supported privileges for this node.
131      *
132      * The returned data structure is a list of nested privileges.
133      * See Sabre_DAVACL_Plugin::getDefaultSupportedPrivilegeSet for a simple
134      * standard structure.
135      *
136      * If null is returned from this method, the default privilege set is used,
137      * which is fine for most common usecases.
138      *
139      * @return array|null
140      */
141     public function getSupportedPrivilegeSet() {
142
143         $default = Sabre_DAVACL_Plugin::getDefaultSupportedPrivilegeSet();
144         $default['aggregates'][] = array(
145             'privilege' => '{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}schedule-query-freebusy',
146         );
147
148         return $default;
149
150     }
151
152 }