[dev] Patches for shares and prefs

Jason Rust jrust at rustyparts.com
Mon Sep 15 12:01:33 PDT 2003


Attached are a couple of patches that fix small bugs I've found in CVS
HEAD.  The first is for shares, and it fixes the following problem:
1. User logs in.  login.php loads horde prefs and saves them to cache.
2. login.php redirects to initial app (in my case kronolith)
3. kronolith checks if prefs are saved to cache.  Because only prefs for
horde are cached cacheLookup() returns false and kronolith loads its
prefs.  BUT horde's cached preferences are never loaded for that page
load.
4. The result is that the first time the user logs in the page shows
with all the default preferences.  If they reload the page it shows fine
because both horde and kronolith's prefs have been cached. 

My patch fixes this by always loading the Horde preferences if they are
present.

The second patch fixes a problem where creator permissions were not
being queried in the listShares() method.  The end result in kronolith
was that even if a user had object creator permissions for a calendar
the Add Event link wasn't showing up in the menu.

-Jason

-- 
http://www.rustyparts.com/blip
b l i p .
-------------- next part --------------
Index: Share.php
===================================================================
RCS file: /repository/horde/lib/Share.php,v
retrieving revision 1.50
diff -u -r1.50 Share.php
--- Share.php	8 Sep 2003 21:44:32 -0000	1.50
+++ Share.php	15 Sep 2003 18:47:27 -0000
@@ -298,6 +298,12 @@
                                     array('field' => 'key', 'op' => '=', 'test' => $userid),
                                     array('field' => 'value', 'op' => '&', 'test' => $perm))),
 
+                            // (name == perm_creator and val & $perm
+                            array(
+                                'AND' => array(
+                                    array('field' => 'name', 'op' => '=', 'test' => 'perm_creator'),
+                                    array('field' => 'value', 'op' => '&', 'test' => $perm))),
+
                             // (name == perm_default and val & $perm
                             array(
                                 'AND' => array(
-------------- next part --------------
Index: Prefs.php
===================================================================
RCS file: /repository/horde/lib/Prefs.php,v
retrieving revision 1.116
diff -u -r1.116 Prefs.php
--- Prefs.php	9 Sep 2003 15:22:20 -0000	1.116
+++ Prefs.php	15 Sep 2003 18:48:22 -0000
@@ -173,17 +173,17 @@
         }
 
         if (isset($_SESSION['prefs_cache'])) {
-            /* If we haven't filled the cache yet, force a retrieval. */
-            if (empty($_SESSION['prefs_cache']['_filled'][$this->_scope])) {
-                $_SESSION['prefs_cache']['_filled'][$this->_scope] = true;
-                return false;
-            }
-
             /* Restore global preferences. */
             if (isset($_SESSION['prefs_cache']['horde'])) {
                 foreach ($_SESSION['prefs_cache']['horde'] as $name => $pref) {
                     $this->_prefs[$name] = $pref;
                 }
+            }
+
+            /* If we haven't filled the cache yet, force a retrieval. */
+            if (empty($_SESSION['prefs_cache']['_filled'][$this->_scope])) {
+                $_SESSION['prefs_cache']['_filled'][$this->_scope] = true;
+                return false;
             }
 
             /* Restore application-specific preferences. */


More information about the dev mailing list