make Calendars shareable via CalDAV
authorCornelius Weiß <mail@corneliusweiss.de>
Mon, 17 Feb 2014 09:57:42 +0000 (10:57 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Thu, 4 Sep 2014 09:25:28 +0000 (11:25 +0200)
- fix groupmember resolving

Change-Id: I9cdba9c9828313864dc95736afd246eba2a1b2fa
Reviewed-on: http://gerrit.tine20.com/customers/345
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Tinebase/WebDav/PrincipalBackend.php

index 2999c24..de8f2c4 100644 (file)
@@ -182,17 +182,24 @@ class Tinebase_WebDav_PrincipalBackend implements DAVACL\PrincipalBackend\Backen
     {
         $result = array();
         
-        list($path, $contactId) = Sabre\DAV\URLUtil::splitPath($principal);
+        list($prefix, $contactId) = \Sabre\DAV\URLUtil::splitPath($principal);
         
-        if ($path == self::PREFIX_USERS) {
-            $user = Tinebase_User::getInstance()->getUserByProperty('contactId', $contactId);
-            
-            $groupIds = Tinebase_Group::getInstance()->getGroupMemberships($user);
-            $groups   = Tinebase_Group::getInstance()->getMultiple($groupIds);
-            
-            foreach ($groups as $group) {
-                $result[] = self::PREFIX_GROUPS . '/' . $group->list_id;
-            }
+        switch ($prefix) {
+            case self::PREFIX_GROUPS:
+                // @TODO implement?
+                break;
+        
+            case self::PREFIX_USERS:
+                $user = Tinebase_User::getInstance()->getUserByProperty('contactId', $contactId);
+                
+                $groupIds = Tinebase_Group::getInstance()->getGroupMemberships($user);
+                $groups   = Tinebase_Group::getInstance()->getMultiple($groupIds);
+                
+                foreach ($groups as $group) {
+                    $result[] = self::PREFIX_GROUPS . '/' . $group->list_id;
+                }
+        
+                break;
         }
         
         return $result;