Table of Contents

  1. Horde Group API
    1. Abstract
    2. Functional Changes
    3. Challenges
    4. Horde_Group_Base
      1. create($name)
      2. rename($gid, $newName)
      3. remove($gid)
      4. exists($gid)
      5. getName($gid)
      6. listAll()
      7. listUsers($gid, $recurse = false)
      8. listGroups($user)
      9. addUser($gid, $username)
      10. removeUser($gid, $username)
      11. search($name)

Horde Group API

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.


Abstract

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.

Functional Changes

Horde 4 will deviate from Horde 3 in these key ways:

Challenges


Horde_Group_Base

This is the class that does the work of reading from/saving to the group storage backend.

create($name)

Creates a new group and returns a new group ID.

rename($gid, $newName)

Changes the name of a group without affecting its membership list

remove($gid)

Removes a group from the groups system permanently.

exists($gid)

Boolean: Check if a group exists in the system.

getName($gid)

Returns a group name.

listAll()

Returns an array of all groups, in the format gid => name.

listUsers($gid, $recurse = false)

Get a list of every user that is a part of this group ONLY.

If $recurse is true then also check member groups' user lists.

listGroups($user)

Returns an array of group IDs representing the user's membership

addUser($gid, $username)

Add a user to a group.

removeUser($gid, $username)

Remove a user from a group.

search($name)

Returns a list of group IDs that match the name (substring search?)