ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\CalDAV\Backend\MockSharing Class Reference
+ Inheritance diagram for Sabre\CalDAV\Backend\MockSharing:
+ Collaboration diagram for Sabre\CalDAV\Backend\MockSharing:

Public Member Functions

 __construct (array $calendars=[], array $calendarData=[], array $notifications=[])
 
 getCalendarsForUser ($principalUri)
 Returns a list of calendars for a principal. More...
 
 getNotificationsForPrincipal ($principalUri)
 Returns a list of notifications for a given principal url. More...
 
 deleteNotification ($principalUri, NotificationInterface $notification)
 This deletes a specific notifcation. More...
 
 updateInvites ($calendarId, array $sharees)
 Updates the list of shares. More...
 
 getInvites ($calendarId)
 Returns the list of people whom this calendar is shared with. More...
 
 shareReply ($href, $status, $calendarUri, $inReplyTo, $summary=null)
 This method is called when a user replied to a request to share. More...
 
 setPublishStatus ($calendarId, $value)
 Publishes a calendar. More...
 
- Public Member Functions inherited from Sabre\CalDAV\Backend\Mock
 __construct (array $calendars=[], array $calendarData=[])
 
 getCalendarsForUser ($principalUri)
 Returns a list of calendars for a principal. More...
 
 createCalendar ($principalUri, $calendarUri, array $properties)
 Creates a new calendar for a principal. More...
 
 updateCalendar ($calendarId, \Sabre\DAV\PropPatch $propPatch)
 Updates properties for a calendar. More...
 
 deleteCalendar ($calendarId)
 Delete a calendar and all it's objects. More...
 
 getCalendarObjects ($calendarId)
 Returns all calendar objects within a calendar object. More...
 
 getCalendarObject ($calendarId, $objectUri)
 Returns information from a single calendar object, based on it's object uri. More...
 
 createCalendarObject ($calendarId, $objectUri, $calendarData)
 Creates a new calendar object. More...
 
 updateCalendarObject ($calendarId, $objectUri, $calendarData)
 Updates an existing calendarobject, based on it's uri. More...
 
 deleteCalendarObject ($calendarId, $objectUri)
 Deletes an existing calendar object. More...
 
- Public Member Functions inherited from Sabre\CalDAV\Backend\AbstractBackend
 updateCalendar ($calendarId, \Sabre\DAV\PropPatch $propPatch)
 Updates properties for a calendar. More...
 
 getMultipleCalendarObjects ($calendarId, array $uris)
 Returns a list of calendar objects. More...
 
 calendarQuery ($calendarId, array $filters)
 Performs a calendar-query on the contents of this calendar. More...
 
 getCalendarObjectByUID ($principalUri, $uid)
 Searches through all of a users calendars and calendar objects to find an object with a specific UID. More...
 
 getCalendarsForUser ($principalUri)
 Returns a list of calendars for a principal. More...
 
 createCalendar ($principalUri, $calendarUri, array $properties)
 Creates a new calendar for a principal. More...
 
 updateCalendar ($calendarId, \Sabre\DAV\PropPatch $propPatch)
 Updates properties for a calendar. More...
 
 deleteCalendar ($calendarId)
 Delete a calendar and all its objects. More...
 
 getCalendarObjects ($calendarId)
 Returns all calendar objects within a calendar. More...
 
 getCalendarObject ($calendarId, $objectUri)
 Returns information from a single calendar object, based on it's object uri. More...
 
 getMultipleCalendarObjects ($calendarId, array $uris)
 Returns a list of calendar objects. More...
 
 createCalendarObject ($calendarId, $objectUri, $calendarData)
 Creates a new calendar object. More...
 
 updateCalendarObject ($calendarId, $objectUri, $calendarData)
 Updates an existing calendarobject, based on it's uri. More...
 
 deleteCalendarObject ($calendarId, $objectUri)
 Deletes an existing calendar object. More...
 
 calendarQuery ($calendarId, array $filters)
 Performs a calendar-query on the contents of this calendar. More...
 
 getCalendarObjectByUID ($principalUri, $uid)
 Searches through all of a users calendars and calendar objects to find an object with a specific UID. More...
 
 getNotificationsForPrincipal ($principalUri)
 Returns a list of notifications for a given principal url. More...
 
 deleteNotification ($principalUri, NotificationInterface $notification)
 This deletes a specific notifcation. More...
 
 shareReply ($href, $status, $calendarUri, $inReplyTo, $summary=null)
 This method is called when a user replied to a request to share. More...
 
 updateInvites ($calendarId, array $sharees)
 Updates the list of shares. More...
 
 getInvites ($calendarId)
 Returns the list of people whom this calendar is shared with. More...
 
 setPublishStatus ($calendarId, $value)
 Publishes a calendar. More...
 

Private Attributes

 $shares = []
 
 $notifications
 

Additional Inherited Members

- Protected Member Functions inherited from Sabre\CalDAV\Backend\AbstractBackend
 validateFilterForObject (array $object, array $filters)
 This method validates if a filter (as passed to calendarQuery) matches the given object. More...
 
- Protected Attributes inherited from Sabre\CalDAV\Backend\Mock
 $calendarData
 
 $calendars
 

Detailed Description

Definition at line 8 of file MockSharing.php.

Constructor & Destructor Documentation

◆ __construct()

Sabre\CalDAV\Backend\MockSharing::__construct ( array  $calendars = [],
array  $calendarData = [],
array  $notifications = [] 
)

Member Function Documentation

◆ deleteNotification()

Sabre\CalDAV\Backend\MockSharing::deleteNotification (   $principalUri,
NotificationInterface  $notification 
)

This deletes a specific notifcation.

This may be called by a client once it deems a notification handled.

Parameters
string$principalUri
NotificationInterface$notification
Returns
void

Implements Sabre\CalDAV\Backend\NotificationSupport.

Definition at line 84 of file MockSharing.php.

84 {
85
86 foreach ($this->notifications[$principalUri] as $key => $value) {
87 if ($notification === $value) {
88 unset($this->notifications[$principalUri][$key]);
89 }
90 }
91
92 }
$key
Definition: croninfo.php:18

References $key.

◆ getCalendarsForUser()

Sabre\CalDAV\Backend\MockSharing::getCalendarsForUser (   $principalUri)

Returns a list of calendars for a principal.

Every project is an array with the following keys:

  • id, a unique id that will be used by other functions to modify the calendar. This can be the same as the uri or a database key.
  • uri, which the basename of the uri with which the calendar is accessed.
  • principalUri. The owner of the calendar. Almost always the same as principalUri passed to this method.

Furthermore it can contain webdav properties in clark notation. A very common one is '{DAV:}displayname'.

Parameters
string$principalUri
Returns
array

Reimplemented from Sabre\CalDAV\Backend\Mock.

Definition at line 37 of file MockSharing.php.

37 {
38
39 $calendars = parent::getCalendarsForUser($principalUri);
40 foreach ($calendars as $k => $calendar) {
41
42 if (isset($calendar['share-access'])) {
43 continue;
44 }
45 if (!empty($this->shares[$calendar['id']])) {
47 } else {
49 }
51
52 }
53 return $calendars;
54
55 }

References $calendar, Sabre\CalDAV\Backend\Mock\$calendars, Sabre\DAV\Sharing\Plugin\ACCESS_NOTSHARED, and Sabre\DAV\Sharing\Plugin\ACCESS_SHAREDOWNER.

◆ getInvites()

Sabre\CalDAV\Backend\MockSharing::getInvites (   $calendarId)

Returns the list of people whom this calendar is shared with.

Every item in the returned list must be a Sharee object with at least the following properties set: $href $shareAccess $inviteStatus

and optionally: $properties

Parameters
mixed$calendarId
Returns
\Sabre\DAV\Xml\Element\Sharee[]

Implements Sabre\CalDAV\Backend\SharingSupport.

Definition at line 151 of file MockSharing.php.

151 {
152
153 if (!isset($this->shares[$calendarId])) {
154 return [];
155 }
156
157 return $this->shares[$calendarId];
158
159 }

◆ getNotificationsForPrincipal()

Sabre\CalDAV\Backend\MockSharing::getNotificationsForPrincipal (   $principalUri)

Returns a list of notifications for a given principal url.

The returned array should only consist of implementations of Sabre\CalDAV\Notifications\INotificationType.

Parameters
string$principalUri
Returns
array

Implements Sabre\CalDAV\Backend\NotificationSupport.

Definition at line 66 of file MockSharing.php.

66 {
67
68 if (isset($this->notifications[$principalUri])) {
69 return $this->notifications[$principalUri];
70 }
71 return [];
72
73 }

◆ setPublishStatus()

Sabre\CalDAV\Backend\MockSharing::setPublishStatus (   $calendarId,
  $value 
)

Publishes a calendar.

Parameters
mixed$calendarId
bool$value
Returns
void

Implements Sabre\CalDAV\Backend\SharingSupport.

Definition at line 187 of file MockSharing.php.

187 {
188
189 foreach ($this->calendars as $k => $cal) {
190 if ($cal['id'] === $calendarId) {
191 if (!$value) {
192 unset($cal['{http://calendarserver.org/ns/}publish-url']);
193 } else {
194 $cal['{http://calendarserver.org/ns/}publish-url'] = 'http://example.org/public/ ' . $calendarId . '.ics';
195 }
196 return;
197 }
198 }
199
200 throw new DAV\Exception('Calendar with id "' . $calendarId . '" not found');
201
202 }

◆ shareReply()

Sabre\CalDAV\Backend\MockSharing::shareReply (   $href,
  $status,
  $calendarUri,
  $inReplyTo,
  $summary = null 
)

This method is called when a user replied to a request to share.

Parameters
stringhref The sharee who is replying (often a mailto: address)
intstatus One of the \Sabre\DAV\Sharing\Plugin::INVITE_* constants
string$calendarUriThe url to the calendar thats being shared
string$inReplyToThe unique id this message is a response to
string$summaryA description of the reply
Returns
void

Implements Sabre\CalDAV\Backend\NotificationSupport.

Definition at line 171 of file MockSharing.php.

171 {
172
173 // This operation basically doesn't do anything yet
174 if ($status === DAV\Sharing\Plugin::INVITE_ACCEPTED) {
175 return 'calendars/blabla/calendar';
176 }
177
178 }

◆ updateInvites()

Sabre\CalDAV\Backend\MockSharing::updateInvites (   $calendarId,
array  $sharees 
)

Updates the list of shares.

Parameters
mixed$calendarId
\Sabre\DAV\Xml\Element\Sharee[]$sharees
Returns
void

Implements Sabre\CalDAV\Backend\SharingSupport.

Definition at line 101 of file MockSharing.php.

101 {
102
103 if (!isset($this->shares[$calendarId])) {
104 $this->shares[$calendarId] = [];
105 }
106
107 foreach ($sharees as $sharee) {
108
109 $existingKey = null;
110 foreach ($this->shares[$calendarId] as $k => $existingSharee) {
111 if ($sharee->href === $existingSharee->href) {
112 $existingKey = $k;
113 }
114 }
115 // Just making sure we're not affecting an existing copy.
116 $sharee = clone $sharee;
117 $sharee->inviteStatus = DAV\Sharing\Plugin::INVITE_NORESPONSE;
118
119 if ($sharee->access === DAV\Sharing\Plugin::ACCESS_NOACCESS) {
120 // It's a removal
121 unset($this->shares[$calendarId][$existingKey]);
122 } elseif ($existingKey) {
123 // It's an update
124 $this->shares[$calendarId][$existingKey] = $sharee;
125 } else {
126 // It's an addition
127 $this->shares[$calendarId][] = $sharee;
128 }
129 }
130
131 // Re-numbering keys
132 $this->shares[$calendarId] = array_values($this->shares[$calendarId]);
133
134 }

References Sabre\DAV\Sharing\Plugin\INVITE_NORESPONSE.

Field Documentation

◆ $notifications

Sabre\CalDAV\Backend\MockSharing::$notifications
private

Definition at line 11 of file MockSharing.php.

Referenced by Sabre\CalDAV\Backend\MockSharing\__construct().

◆ $shares

Sabre\CalDAV\Backend\MockSharing::$shares = []
private

Definition at line 10 of file MockSharing.php.


The documentation for this class was generated from the following file: