[Pkg-owncloud-commits] [php-sabredav] 02/275: Added an inbox node.
David Prévot
taffit at moszumanska.debian.org
Thu Sep 25 14:55:44 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository php-sabredav.
commit 67c02358bac972f1f30d8f40deb124c2f43a36d7
Author: Evert Pot <evert at rooftopsolutions.nl>
Date: Fri Aug 16 18:39:46 2013 +0100
Added an inbox node.
---
lib/Sabre/CalDAV/Plugin.php | 2 +-
lib/Sabre/CalDAV/Schedule/IInbox.php | 15 ++++
lib/Sabre/CalDAV/Schedule/Inbox.php | 151 +++++++++++++++++++++++++++++++++++
lib/Sabre/CalDAV/Schedule/Plugin.php | 3 +
lib/Sabre/CalDAV/UserCalendars.php | 2 +
5 files changed, 172 insertions(+), 1 deletion(-)
diff --git a/lib/Sabre/CalDAV/Plugin.php b/lib/Sabre/CalDAV/Plugin.php
index f5c905a..58f2182 100644
--- a/lib/Sabre/CalDAV/Plugin.php
+++ b/lib/Sabre/CalDAV/Plugin.php
@@ -175,7 +175,7 @@ class Plugin extends DAV\ServerPlugin {
$server->propertyMap['{' . self::NS_CALDAV . '}schedule-calendar-transp'] = 'Sabre\\CalDAV\\Property\\ScheduleCalendarTransp';
$server->resourceTypeMapping['\\Sabre\\CalDAV\\ICalendar'] = '{urn:ietf:params:xml:ns:caldav}calendar';
- $server->resourceTypeMapping['\\Sabre\\CalDAV\\Schedule\\IOutbox'] = '{urn:ietf:params:xml:ns:caldav}schedule-outbox';
+
$server->resourceTypeMapping['\\Sabre\\CalDAV\\Principal\\IProxyRead'] = '{http://calendarserver.org/ns/}calendar-proxy-read';
$server->resourceTypeMapping['\\Sabre\\CalDAV\\Principal\\IProxyWrite'] = '{http://calendarserver.org/ns/}calendar-proxy-write';
$server->resourceTypeMapping['\\Sabre\\CalDAV\\Notifications\\ICollection'] = '{' . self::NS_CALENDARSERVER . '}notification';
diff --git a/lib/Sabre/CalDAV/Schedule/IInbox.php b/lib/Sabre/CalDAV/Schedule/IInbox.php
new file mode 100644
index 0000000..375ba13
--- /dev/null
+++ b/lib/Sabre/CalDAV/Schedule/IInbox.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Sabre\CalDAV\Schedule;
+
+/**
+ * Implement this interface to have a node be recognized as a CalDAV scheduling
+ * inbox.
+ *
+ * @copyright Copyright (C) 2007-2013 fruux GmbH (https://fruux.com/).
+ * @author Evert Pot (http://evertpot.com/)
+ * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
+ */
+interface IInbox extends \Sabre\DAV\ICollection, \Sabre\DAVACL\IACL {
+
+}
diff --git a/lib/Sabre/CalDAV/Schedule/Inbox.php b/lib/Sabre/CalDAV/Schedule/Inbox.php
new file mode 100644
index 0000000..c37afa0
--- /dev/null
+++ b/lib/Sabre/CalDAV/Schedule/Inbox.php
@@ -0,0 +1,151 @@
+<?php
+
+namespace Sabre\CalDAV\Schedule;
+use Sabre\DAV;
+use Sabre\CalDAV;
+use Sabre\DAVACL;
+
+/**
+ * The CalDAV scheduling inbox
+ *
+ * @copyright Copyright (C) 2007-2013 fruux GmbH (https://fruux.com/).
+ * @author Evert Pot (http://evertpot.com/)
+ * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
+ */
+class Inbox extends DAV\Collection implements IINbox {
+
+ /**
+ * The principal Uri
+ *
+ * @var string
+ */
+ protected $principalUri;
+
+ /**
+ * Constructor
+ *
+ * @param string $principalUri
+ */
+ public function __construct($principalUri) {
+
+ $this->principalUri = $principalUri;
+
+ }
+
+ /**
+ * Returns the name of the node.
+ *
+ * This is used to generate the url.
+ *
+ * @return string
+ */
+ public function getName() {
+
+ return 'inbox';
+
+ }
+
+ /**
+ * Returns an array with all the child nodes
+ *
+ * @return \Sabre\DAV\INode[]
+ */
+ public function getChildren() {
+
+ return array();
+
+ }
+
+ /**
+ * Returns the owner principal
+ *
+ * This must be a url to a principal, or null if there's no owner
+ *
+ * @return string|null
+ */
+ public function getOwner() {
+
+ return $this->principalUri;
+
+ }
+
+ /**
+ * Returns a group principal
+ *
+ * This must be a url to a principal, or null if there's no owner
+ *
+ * @return string|null
+ */
+ public function getGroup() {
+
+ return null;
+
+ }
+
+ /**
+ * Returns a list of ACE's for this node.
+ *
+ * Each ACE has the following properties:
+ * * 'privilege', a string such as {DAV:}read or {DAV:}write. These are
+ * currently the only supported privileges
+ * * 'principal', a url to the principal who owns the node
+ * * 'protected' (optional), indicating that this ACE is not allowed to
+ * be updated.
+ *
+ * @return array
+ */
+ public function getACL() {
+
+ return [
+ [
+ 'privilege' => '{DAV:}read',
+ 'principal' => $this->getOwner(),
+ 'protected' => true,
+ ],
+ [
+ 'privilege' => '{DAV:}read',
+ 'principal' => $this->getOwner() . '/calendar-proxy-read',
+ 'protected' => true,
+ ],
+ [
+ 'privilege' => '{DAV:}read',
+ 'principal' => $this->getOwner() . '/calendar-proxy-write',
+ 'protected' => true,
+ ],
+ ];
+
+ }
+
+ /**
+ * Updates the ACL
+ *
+ * This method will receive a list of new ACE's.
+ *
+ * @param array $acl
+ * @return void
+ */
+ public function setACL(array $acl) {
+
+ throw new DAV\Exception\MethodNotAllowed('You\'re not allowed to update the ACL');
+
+ }
+
+ /**
+ * Returns the list of supported privileges for this node.
+ *
+ * The returned data structure is a list of nested privileges.
+ * See Sabre\DAVACL\Plugin::getDefaultSupportedPrivilegeSet for a simple
+ * standard structure.
+ *
+ * If null is returned from this method, the default privilege set is used,
+ * which is fine for most common usecases.
+ *
+ * @return array|null
+ */
+ public function getSupportedPrivilegeSet() {
+
+ return null;
+
+ }
+
+}
diff --git a/lib/Sabre/CalDAV/Schedule/Plugin.php b/lib/Sabre/CalDAV/Schedule/Plugin.php
index 8763f03..611e5cf 100644
--- a/lib/Sabre/CalDAV/Schedule/Plugin.php
+++ b/lib/Sabre/CalDAV/Schedule/Plugin.php
@@ -101,6 +101,9 @@ class Plugin extends ServerPlugin {
$this->server = $server;
$server->on('method:POST', [$this,'httpPost']);
+ $server->resourceTypeMapping['\\Sabre\\CalDAV\\Schedule\\IOutbox'] = '{urn:ietf:params:xml:ns:caldav}schedule-outbox';
+ $server->resourceTypeMapping['\\Sabre\\CalDAV\\Schedule\\IInbox'] = '{urn:ietf:params:xml:ns:caldav}schedule-inbox';
+
}
/**
diff --git a/lib/Sabre/CalDAV/UserCalendars.php b/lib/Sabre/CalDAV/UserCalendars.php
index edbdc1b..466d010 100644
--- a/lib/Sabre/CalDAV/UserCalendars.php
+++ b/lib/Sabre/CalDAV/UserCalendars.php
@@ -174,8 +174,10 @@ class UserCalendars implements DAV\IExtendedCollection, DAVACL\IACL {
$objs[] = new Calendar($this->caldavBackend, $calendar);
}
}
+ $objs[] = new Schedule\Inbox($this->principalInfo['uri']);
$objs[] = new Schedule\Outbox($this->principalInfo['uri']);
+
// We're adding a notifications node, if it's supported by the backend.
if ($this->caldavBackend instanceof Backend\NotificationSupport) {
$objs[] = new Notifications\Collection($this->caldavBackend, $this->principalInfo['uri']);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabredav.git
More information about the Pkg-owncloud-commits
mailing list