[dev] Shares bug with group permissions?

Rob Lineweaver rlineweaver at harrisonburg.k12.va.us
Wed Jul 23 18:48:34 PDT 2003


Greetings,

Sharing calendars by group in Kronolith is not working for me in CVS HEAD.  I
can share calendars by specific user permissions or default perms, but after
adding 'show' and 'read' privs on a calendar for a group, that calendar never
appears in group members' "Show:" menu.  The problem I am experiencing is
exactly like what this person describes a month ago:

http://marc.theaimsgroup.com/?l=kronolith&m=105614419830404&w=2

and I never saw any response to that report.

I would have sent this to the Kronolith mailing list except that I think the bug
is in the Horde shares code.  After turning on logging for all levels and
watching the SQL queries, the problem appears to be that Horde is storing the
group calendar permissions (in the horde_category_attributes table) using the
group's *name* as the attribute_key, but when it checks for the group
permissions that a user has access to, is looks them up by the group's
*category_id*.

The simple patch pasted below changes the lookup query to use the name instead
of the category_id.  This makes group shared calendars work on my system. 
However, I would not think that this is really the desired solution (so don't
apply that patch to the real CVS tree, it's just for testing & reference).  It
seems to me that the permission system should be referencing the group's
category_id in the attribute_key rather than the name (for better use of
indexes, less DB storage space required, etc.).  Making it work that way would
mean changing the code that stores the group permission information, which I
haven't tracked down yet.

I just wanted to fire this message off before I dig too deeply to see if I'm way
off base or if anybody had any comments or help to provide.  Is sharing
calendars by group currently working for anyone using CVS HEAD?

Thanks,

Rob Lineweaver
Network Administrator
Harrisonburg City Public Schools

-------------------


--- lib/Share.php-orig  2003-07-23 21:29:22.000000000 -0400
+++ lib/Share.php       2003-07-23 20:16:48.000000000 -0400
@@ -311,7 +311,7 @@
                         $criteria['OR'][] = array(
                             'AND' => array(
                                 array('field' => 'name', 'op' => '=', 'test' =>
'perm_groups'),
-                                array('field' => 'key', 'op' => 'IN', 'test' =>
'(' . implode(', ', array_keys($groups)) . ')'),
+                                array('field' => 'key', 'op' => 'IN', 'test' =>
'(\'' . implode('\', \'', array_values($groups)) . '\')'),
                                 array('field' => 'value', 'op' => '&', 'test'
=> $perm)));
                     }
                 }


More information about the dev mailing list