gunnar: server/kolab-freebusy/freebusy generatefb.php,1.3,1.4

cvs at kolab.org cvs at kolab.org
Wed Feb 6 18:49:50 CET 2008


Author: gunnar

Update of /kolabrepository/server/kolab-freebusy/freebusy
In directory doto:/tmp/cvs-serv3186

Modified Files:
	generatefb.php 
Log Message:
Fix the hack for the manager ACLs.

Index: generatefb.php
===================================================================
RCS file: /kolabrepository/server/kolab-freebusy/freebusy/generatefb.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- generatefb.php	6 Feb 2008 09:28:52 -0000	1.3
+++ generatefb.php	6 Feb 2008 17:49:48 -0000	1.4
@@ -107,12 +107,29 @@
 
     /* Hack for allowing manager access */
     if ($access->user == 'manager') {
-        $acl = $imap->_imap->getACL($calendar);
+        $imapc = &Kolab_IMAP_Connection::singleton(Kolab::getServer('imap'),
+                                                   $GLOBALS['conf']['kolab']['imap']['port']);
+        if (is_a($imapc, 'PEAR_Error')) {
+            echo "Failed connecting the server!\n";
+            var_dump($imapc->getMessage());
+            exit(-1);
+        }
+        $acl = $imapc->getACL($calendar);
+        if (is_a($acl, 'PEAR_Error')) {
+            echo "Failed accessing calendar \"" . $calendar . "\"!\n";
+            var_dump($acl->getMessage());
+            exit(-1);
+        }
         $oldacl = '';
         if (isset($acl['manager'])) {
             $oldacl = $acl['manager'];
         }
-        $acl['manager'] = 'lrs';
+        $result = $imapc->setACL($calendar, 'manager', 'lrs');
+        if (is_a($result, 'PEAR_Error')) {
+            echo "Failed setting manager ACL to \"lrs\"!\n";
+            var_dump($result->getMessage());
+            exit(-1);
+        }
     }
 
     echo "Regenerating calendar \"" . $calendar . "\"!\n";
@@ -126,13 +143,13 @@
     }
 
     /* Revert the acl  */
-    if ($access->user == 'manager') {
-        $acl = $imap->_imap->getACL($calendar);
-        $oldacl = '';
-        if (isset($acl['manager'])) {
-            $oldacl = $acl['manager'];
+    if ($access->user == 'manager' && $oldacl) {
+        $result = $imapc->setACL($calendar, 'manager', $oldacl);
+        if (is_a($result, 'PEAR_Error')) {
+            echo "Failed resetting manager ACL to \"" . $oldacl . "\"!\n";
+            var_dump($result->getMessage());
+            exit(-1);
         }
-        $acl['manager'] = 'lrs';
     }
 
     if ($failed) {





More information about the commits mailing list