[Pkg-owncloud-commits] [php-sabredav] 245/275: Now correctly setting ACL for calendarobjects as well.

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 ad5b7135450260111b8e8119c7673a9973781495
Author: Evert Pot <evert at rooftopsolutions.nl>
Date:   Tue Sep 16 01:40:58 2014 +0100

    Now correctly setting ACL for calendarobjects as well.
---
 lib/CalDAV/Calendar.php                   | 27 ++++++++++++++++-----------
 tests/Sabre/CalDAV/CalendarObjectTest.php | 12 ++++++------
 tests/Sabre/CalDAV/SharedCalendarTest.php | 22 ++++++----------------
 3 files changed, 28 insertions(+), 33 deletions(-)

diff --git a/lib/CalDAV/Calendar.php b/lib/CalDAV/Calendar.php
index e9ecae3..fa366e1 100644
--- a/lib/CalDAV/Calendar.php
+++ b/lib/CalDAV/Calendar.php
@@ -324,34 +324,39 @@ class Calendar implements ICalendar, DAV\IProperties, DAV\Sync\ISyncCollection,
      */
     function getChildACL() {
 
-        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,
             ],
 
         ];
+        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/CalendarObjectTest.php b/tests/Sabre/CalDAV/CalendarObjectTest.php
index 095972a..4793957 100644
--- a/tests/Sabre/CalDAV/CalendarObjectTest.php
+++ b/tests/Sabre/CalDAV/CalendarObjectTest.php
@@ -180,23 +180,23 @@ class CalendarObjectTest 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',
+                'principal' => 'principals/user1',
                 'protected' => true,
             ),
             array(
-                'privilege' => '{DAV:}read',
-                'principal' => 'principals/user1/calendar-proxy-read',
+                '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 034a7d7..a2b07ca 100644
--- a/tests/Sabre/CalDAV/SharedCalendarTest.php
+++ b/tests/Sabre/CalDAV/SharedCalendarTest.php
@@ -115,23 +115,23 @@ class SharedCalendarTest extends \PHPUnit_Framework_TestCase {
                 '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',
+                'principal' => 'principals/owner',
                 'protected' => true,
             ),
             array(
-                'privilege' => '{DAV:}read',
-                'principal' => 'principals/owner/calendar-proxy-read',
+                'privilege' => '{DAV:}write',
+                'principal' => 'principals/owner/calendar-proxy-write',
                 'protected' => true,
             ),
             array(
@@ -159,21 +159,11 @@ class SharedCalendarTest extends \PHPUnit_Framework_TestCase {
                 'protected' => true,
             ),
             array(
-                'privilege' => '{DAV:}write',
-                'principal' => 'principals/owner',
-                'protected' => true,
-            ),
-            array(
                 'privilege' => '{DAV:}read',
                 'principal' => 'principals/owner/calendar-proxy-write',
                 'protected' => true,
             ),
             array(
-                'privilege' => '{DAV:}write',
-                'principal' => 'principals/owner/calendar-proxy-write',
-                'protected' => true,
-            ),
-            array(
                 'privilege' => '{DAV:}read',
                 'principal' => 'principals/owner/calendar-proxy-read',
                 'protected' => true,

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