[Pkg-owncloud-commits] [php-sabredav] 244/275: ACL now respects {http://sabredav.org/ns}read-only

David Prévot taffit at moszumanska.debian.org
Thu Sep 25 14:56:15 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 60d27314c19fe1962a956fc57a3e9af050214caa
Author: Evert Pot <evert at rooftopsolutions.nl>
Date:   Tue Sep 16 01:35:49 2014 +0100

    ACL now respects {http://sabredav.org/ns}read-only
---
 lib/CalDAV/Calendar.php                   | 26 +++++++++++++++-----------
 tests/Sabre/CalDAV/CalendarTest.php       | 18 +++++++++---------
 tests/Sabre/CalDAV/SharedCalendarTest.php | 19 ++++++++++---------
 3 files changed, 34 insertions(+), 29 deletions(-)

diff --git a/lib/CalDAV/Calendar.php b/lib/CalDAV/Calendar.php
index d8c97de..e9ecae3 100644
--- a/lib/CalDAV/Calendar.php
+++ b/lib/CalDAV/Calendar.php
@@ -275,28 +275,18 @@ class Calendar implements ICalendar, DAV\IProperties, DAV\Sync\ISyncCollection,
      */
     function getACL() {
 
-        return [
+        $acl = [
             [
                 'privilege' => '{DAV:}read',
                 'principal' => $this->getOwner(),
                 'protected' => true,
             ],
             [
-                'privilege' => '{DAV:}write',
-                'principal' => $this->getOwner(),
-                'protected' => true,
-            ],
-            [
                 'privilege' => '{DAV:}read',
                 'principal' => $this->getOwner() . '/calendar-proxy-write',
                 'protected' => true,
             ],
             [
-                'privilege' => '{DAV:}write',
-                'principal' => $this->getOwner() . '/calendar-proxy-write',
-                'protected' => true,
-            ],
-            [
                 'privilege' => '{DAV:}read',
                 'principal' => $this->getOwner() . '/calendar-proxy-read',
                 'protected' => true,
@@ -308,6 +298,20 @@ class Calendar implements ICalendar, DAV\IProperties, DAV\Sync\ISyncCollection,
             ],
 
         ];
+        if (empty($this->calendarInfo['{http://sabredav.org/ns}read-only'])) {
+            $acl[] = [
+                'privilege' => '{DAV:}write',
+                'principal' => $this->getOwner(),
+                'protected' => true,
+            ];
+            $acl[] = [
+                'privilege' => '{DAV:}write',
+                'principal' => $this->getOwner() . '/calendar-proxy-write',
+                'protected' => true,
+            ];
+        }
+
+        return $acl;
 
     }
 
diff --git a/tests/Sabre/CalDAV/CalendarTest.php b/tests/Sabre/CalDAV/CalendarTest.php
index 21ffe09..ea744d2 100644
--- a/tests/Sabre/CalDAV/CalendarTest.php
+++ b/tests/Sabre/CalDAV/CalendarTest.php
@@ -199,28 +199,28 @@ class CalendarTest extends \PHPUnit_Framework_TestCase {
                 'protected' => true,
             ),
             array(
-                'privilege' => '{DAV:}write',
-                'principal' => 'principals/user1',
+                'privilege' => '{DAV:}read',
+                'principal' => 'principals/user1/calendar-proxy-write',
                 'protected' => true,
             ),
             array(
                 'privilege' => '{DAV:}read',
-                'principal' => 'principals/user1/calendar-proxy-write',
+                'principal' => 'principals/user1/calendar-proxy-read',
                 'protected' => true,
             ),
             array(
-                'privilege' => '{DAV:}write',
-                'principal' => 'principals/user1/calendar-proxy-write',
+                'privilege' => '{' . Plugin::NS_CALDAV . '}read-free-busy',
+                'principal' => '{DAV:}authenticated',
                 'protected' => true,
             ),
             array(
-                'privilege' => '{DAV:}read',
-                'principal' => 'principals/user1/calendar-proxy-read',
+                'privilege' => '{DAV:}write',
+                'principal' => 'principals/user1',
                 'protected' => true,
             ),
             array(
-                'privilege' => '{' . Plugin::NS_CALDAV . '}read-free-busy',
-                'principal' => '{DAV:}authenticated',
+                'privilege' => '{DAV:}write',
+                'principal' => 'principals/user1/calendar-proxy-write',
                 'protected' => true,
             ),
         );
diff --git a/tests/Sabre/CalDAV/SharedCalendarTest.php b/tests/Sabre/CalDAV/SharedCalendarTest.php
index 313c382..034a7d7 100644
--- a/tests/Sabre/CalDAV/SharedCalendarTest.php
+++ b/tests/Sabre/CalDAV/SharedCalendarTest.php
@@ -64,29 +64,30 @@ class SharedCalendarTest extends \PHPUnit_Framework_TestCase {
                 'principal' => 'principals/owner',
                 'protected' => true,
             ),
+
             array(
-                'privilege' => '{DAV:}write',
-                'principal' => 'principals/owner',
+                'privilege' => '{DAV:}read',
+                'principal' => 'principals/owner/calendar-proxy-write',
                 'protected' => true,
             ),
             array(
                 'privilege' => '{DAV:}read',
-                'principal' => 'principals/owner/calendar-proxy-write',
+                'principal' => 'principals/owner/calendar-proxy-read',
                 'protected' => true,
             ),
             array(
-                'privilege' => '{DAV:}write',
-                'principal' => 'principals/owner/calendar-proxy-write',
+                'privilege' => '{' . Plugin::NS_CALDAV . '}read-free-busy',
+                'principal' => '{DAV:}authenticated',
                 'protected' => true,
             ),
             array(
-                'privilege' => '{DAV:}read',
-                'principal' => 'principals/owner/calendar-proxy-read',
+                'privilege' => '{DAV:}write',
+                'principal' => 'principals/owner',
                 'protected' => true,
             ),
             array(
-                'privilege' => '{' . Plugin::NS_CALDAV . '}read-free-busy',
-                'principal' => '{DAV:}authenticated',
+                'privilege' => '{DAV:}write',
+                'principal' => 'principals/owner/calendar-proxy-write',
                 'protected' => true,
             ),
             array(

-- 
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