gunnar: server/php-kolab/Kolab_Freebusy/Freebusy Cache.php, 1.9, 1.10 Page.php, 1.9, 1.10

cvs at kolab.org cvs at kolab.org
Mon Jun 9 08:00:49 CEST 2008


Author: gunnar

Update of /kolabrepository/server/php-kolab/Kolab_Freebusy/Freebusy
In directory doto:/tmp/cvs-serv1790/php-kolab/Kolab_Freebusy/Freebusy

Modified Files:
	Cache.php Page.php 
Log Message:
kolab/issue2734 (Automatic ressources decline changed overlapping event time)

Index: Cache.php
===================================================================
RCS file: /kolabrepository/server/php-kolab/Kolab_Freebusy/Freebusy/Cache.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- Cache.php	3 Mar 2008 14:48:25 -0000	1.9
+++ Cache.php	9 Jun 2008 06:00:47 -0000	1.10
@@ -97,11 +97,11 @@
 
             $relevance = $fb->getRelevance();
             if (is_a($relevance, 'PEAR_Error')) {
-                $relevance;
+                return $relevance;
             }
             $acl = $fb->getACL();
             if (is_a($acl, 'PEAR_Error')) {
-                $acl;
+                return $acl;
             }
 
             $result = $c_acl->storeACL($acl, $relevance);
@@ -111,11 +111,10 @@
             
             $xacl = $fb->getExtendedACL();
             if (is_a($xacl, 'PEAR_Error')) {
-                $xacl;
+                return $xacl;
             }
-            /* The owner may always look at the extended attributes */
-            $xacl .= ' ' . $access->owner;
-            $result = $c_xacl->storeXACL($xacl);
+
+            $result = $c_xacl->storeXACL($xacl, $acl);
             if (is_a($result, 'PEAR_Error')) {
                 return $result;
             }
@@ -267,7 +266,10 @@
     {
         $xaclcache = &FreeBusyCacheDB_xacl::singleton('xacl', $this->_cache_dir);
             
-        foreach ($access->groups as $id) {
+            Horde::logMessage(sprintf(_("GROUPS: %s."), 
+                                      serialize($access->user_groups)),
+                              __FILE__, __LINE__, PEAR_LOG_DEBUG);
+        foreach ($access->user_groups as $id) {
             if ($xaclcache->has($file, $id)) {
                 return true;
             }
@@ -855,11 +857,20 @@
         return parent::purge();
     }
     
-    function storeXACL(&$xacl) 
+    function storeXACL(&$xacl, &$acl)
     {
         $oldxacl = $this->load();
         if (is_a($oldxacl, 'PEAR_Error')) {
             $oldxacl = '';
+        }
+
+        /* Users with read access to the folder may also access the extended information */
+        foreach ($acl as $user => $ac) {
+            if (strpos($ac, 'r') !== false) {
+                if (!empty($user)) {
+                    $xacl .= ' ' . $user;
+                }
+            }
         }
 
         $result = $this->_xacls->store($this->_filename, $xacl, $oldxacl);

Index: Page.php
===================================================================
RCS file: /kolabrepository/server/php-kolab/Kolab_Freebusy/Freebusy/Page.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- Page.php	2 Apr 2008 17:32:55 -0000	1.9
+++ Page.php	9 Jun 2008 06:00:47 -0000	1.10
@@ -226,14 +226,20 @@
     var $homeserver;
 
     /**
-     * The groups of the user calling the script (this includes the
-     * primary user id)
+     * The groups of the owner
      *
-     * @var string
+     * @var array
      */
     var $groups;
 
     /**
+     * The groups of the user
+     *
+     * @var array
+     */
+    var $user_groups;
+
+    /**
      * The number of days to calculate free/busy into the past
      *
      * @var int
@@ -413,8 +419,19 @@
         }
 
         /* Possibly rewrite the calling UID into the primary mail address */
-        if ($userinfo && isset($userinfo['MAIL']) && !empty($userinfo['MAIL'])) {
-            $this->user = $userinfo['MAIL'];
+        if ($userinfo) {
+            if (isset($userinfo['MAIL']) && !empty($userinfo['MAIL'])) {
+                $this->user = $userinfo['MAIL'];
+            }
+            if (!empty($userinfo['GROUPS'])) {
+                $this->user_groups = $userinfo['GROUPS'];  
+            }
+        }
+
+        if (empty($this->user_groups)) {
+            $this->user_groups = array($this->user);
+        } else {
+            $this->user_groups[] = $this->user;
         }
 
         /* Fetch the user info of the requested folder owner */
@@ -467,9 +484,9 @@
             }
         }
         if (empty($this->groups)) {
-            $this->groups = array($this->user);
+            $this->groups = array($this->owner);
         } else {
-            $this->groups[] = $this->user;
+            $this->groups[] = $this->owner;
         }
         $this->imap_folder = $this->_getImapFolder();
     }





More information about the commits mailing list