ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Inbox.php
Go to the documentation of this file.
1<?php
2
4
7use Sabre\DAV;
10
18class Inbox extends DAV\Collection implements IInbox {
19
20 use DAVACL\ACLTrait;
21
27 protected $caldavBackend;
28
34 protected $principalUri;
35
43
44 $this->caldavBackend = $caldavBackend;
45 $this->principalUri = $principalUri;
46
47 }
48
56 function getName() {
57
58 return 'inbox';
59
60 }
61
67 function getChildren() {
68
69 $objs = $this->caldavBackend->getSchedulingObjects($this->principalUri);
70 $children = [];
71 foreach ($objs as $obj) {
72 //$obj['acl'] = $this->getACL();
73 $obj['principaluri'] = $this->principalUri;
74 $children[] = new SchedulingObject($this->caldavBackend, $obj);
75 }
76 return $children;
77
78 }
79
104 function createFile($name, $data = null) {
105
106 $this->caldavBackend->createSchedulingObject($this->principalUri, $name, $data);
107
108 }
109
117 function getOwner() {
118
119 return $this->principalUri;
120
121 }
122
135 function getACL() {
136
137 return [
138 [
139 'privilege' => '{DAV:}read',
140 'principal' => '{DAV:}authenticated',
141 'protected' => true,
142 ],
143 [
144 'privilege' => '{DAV:}write-properties',
145 'principal' => $this->getOwner(),
146 'protected' => true,
147 ],
148 [
149 'privilege' => '{DAV:}unbind',
150 'principal' => $this->getOwner(),
151 'protected' => true,
152 ],
153 [
154 'privilege' => '{DAV:}unbind',
155 'principal' => $this->getOwner() . '/calendar-proxy-write',
156 'protected' => true,
157 ],
158 [
159 'privilege' => '{' . CalDAV\Plugin::NS_CALDAV . '}schedule-deliver',
160 'principal' => '{DAV:}authenticated',
161 'protected' => true,
162 ],
163 ];
164
165 }
166
184 function calendarQuery(array $filters) {
185
186 $result = [];
187 $validator = new CalDAV\CalendarQueryValidator();
188
189 $objects = $this->caldavBackend->getSchedulingObjects($this->principalUri);
190 foreach ($objects as $object) {
191 $vObject = VObject\Reader::read($object['calendardata']);
192 if ($validator->validate($vObject, $filters)) {
193 $result[] = $object['uri'];
194 }
195
196 // Destroy circular references to PHP will GC the object.
197 $vObject->destroy();
198 }
199 return $result;
200
201 }
202
203}
$result
An exception for terminatinating execution or to throw for unit testing.
const NS_CALDAV
This is the official CalDAV namespace.
Definition: Plugin.php:33
The CalDAV scheduling inbox.
Definition: Inbox.php:18
getACL()
Returns a list of ACE's for this node.
Definition: Inbox.php:135
getName()
Returns the name of the node.
Definition: Inbox.php:56
createFile($name, $data=null)
Creates a new file in the directory.
Definition: Inbox.php:104
__construct(Backend\SchedulingSupport $caldavBackend, $principalUri)
Constructor.
Definition: Inbox.php:42
getOwner()
Returns the owner principal.
Definition: Inbox.php:117
calendarQuery(array $filters)
Performs a calendar-query on the contents of this calendar.
Definition: Inbox.php:184
getChildren()
Returns an array with all the child nodes.
Definition: Inbox.php:67
The SchedulingObject represents a scheduling object in the Inbox collection.
Collection class.
Definition: Collection.php:15
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
Definition: Reader.php:42
Implementing this interface adds CalDAV Scheduling support to your caldav server, as defined in rfc66...
Implement this interface to have a node be recognized as a CalDAV scheduling inbox.
Definition: IInbox.php:13
$data
Definition: bench.php:6