-
Notifications
You must be signed in to change notification settings - Fork 343
Expand file tree
/
Copy pathCalendarObject.php
More file actions
95 lines (75 loc) · 2.01 KB
/
Copy pathCalendarObject.php
File metadata and controls
95 lines (75 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php
/**
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\Deck\DAV;
use OCA\Deck\Db\Card;
use OCA\Deck\Db\Stack;
use Sabre\CalDAV\ICalendarObject;
use Sabre\DAV\Exception\Forbidden;
use Sabre\DAVACL\IACL;
use Sabre\VObject\Component\VCalendar;
class CalendarObject implements ICalendarObject, IACL {
/** @var Calendar */
private $calendar;
/** @var string */
private $name;
/** @var Card|Stack */
private $sourceItem;
/** @var DeckCalendarBackend */
private $backend;
/** @var VCalendar */
private $calendarObject;
public function __construct(Calendar $calendar, string $name, DeckCalendarBackend $backend, $sourceItem) {
$this->calendar = $calendar;
$this->name = $name;
$this->sourceItem = $sourceItem;
$this->backend = $backend;
$this->calendarObject = $this->sourceItem->getCalendarObject();
}
public function getOwner() {
return null;
}
public function getGroup() {
return null;
}
public function getACL() {
return $this->calendar->getACL();
}
public function setACL(array $acl) {
throw new Forbidden('Setting ACL is not supported on this node');
}
public function getSupportedPrivilegeSet() {
return null;
}
public function put($data) {
throw new Forbidden('This calendar-object is read-only');
}
public function get() {
if ($this->sourceItem) {
return $this->calendarObject->serialize();
}
}
public function getContentType() {
return 'text/calendar; charset=utf-8';
}
public function getETag() {
return '"' . md5($this->sourceItem->getLastModified()) . '"';
}
public function getSize() {
return mb_strlen($this->calendarObject->serialize());
}
public function delete() {
throw new Forbidden('This calendar-object is read-only');
}
public function getName() {
return $this->name;
}
public function setName($name) {
throw new Forbidden('This calendar-object is read-only');
}
public function getLastModified() {
return $this->sourceItem->getLastModified();
}
}