Table of Contents
|
This document is intended to clarify the Horde Group API, and to provide a solid target for applications to move toward for Horde4. Motivation for this document was spurred from the conversation between the Bens on IRC regarding the "proper" way to handle groups with LDAP.
In its simplest terms a group consists of an ID and a Name. The ID is unique to that group and is unchanging. The name is a human-friendly name that can be changed as desired. The source and/or format of the group ID should not be of concern to the application using it, and should always be obtained/modified/stored through the group API calls. The group ID is the only acceptable method as to refer to a group, as it is guaranteed to be unique (uniqueness being the job of the driver). The group name is strictly for interface use.
Horde 4 will deviate from Horde 3 in these key ways:
In order to help keep concepts straight, the following standards should be used
This is the class that does the work of reading from/saving to the group storage backend.
Creates a new group and returns a new Horde_Group object.
Changes the name of a group without affecting its membership list
Removes a group from the groups system permanently.
Returns a Horde_Group object based on $name
If the name does not match exactly 1 group (too few or too many) it will raise Horde_Group_Exception with an appropriate error message
Returns Horde_Group object based on the $gid.
Boolean: Check if a group exists in the system.
Returns an array of all groups, in the format gid => name.
Get a list of every user that is a part of this group ONLY.
If $recurse is true then also check member groups' user list.
Returns an array of Horde_Group objects representing the user's membership
Say if a user is a member of a group or not.
Add a user to a group.
Remove a user from a group.
deprecated in favor of using addGroup()
deprecated -- no longer using group objects.
deprecated -- no longer using group objects.
Note: This is used in a (small) number of places, most important among those is probably the Horde base API. There are a couple methods, (
addGroupPermissions(), removeGroupPermissions()) which use it. This brings up a greater point: We probably want to have a way to allow external entities to interact with our groups via the API methods. However this probably necessitates a way to look up group IDs (rather than requiring them to know our internal Group IDs). I believe this method can be done correctly, but it does need to be better defined. Today, the DataTree? driver allows passing in a Groups object, an array, or a string. The array is join()ed with ':' to produce a string which is used to look up the Group ID. Whatever happens, we must be able to design method which does not have an ambiguous return value.
deprecated -- no need for short names...they're just confusing (K.I.S.S)
deprecated -- no longer using group objects.
deprecated in favor of always using flat lists.
deprecated in favor of getGroupParent()
deprecated in favor of listUsers()
deprecated -- This is only used in the group admin UI for the tree. Horde_Tree automatically determines node depth now, so this is no longer necessary.
deprecated -- All group modifications are saved to the backend on the fly.
deprecated -- Only used internally to store group to backend.
deprecated -- Only used internally to store group to backend.
All DatatreeObject_Group functionality has been moved to Group (Horde_Groups) to eliminate OO overhead.
This is a list of the methods that will be available in Horde_Groups to Horde4 applications: