Overview

Packages

  • Group

Classes

  • Horde_Group_Base
  • Horde_Group_Contactlists
  • Horde_Group_Exception
  • Horde_Group_Kolab
  • Horde_Group_Ldap
  • Horde_Group_Mock
  • Horde_Group_Sql
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * Horde_Group_Base is the base class for all drivers of the Horde group
  4:  * system.
  5:  *
  6:  * Copyright 1999-2012 Horde LLC (http://www.horde.org/)
  7:  *
  8:  * See the enclosed file COPYING for license information (LGPL). If you
  9:  * did not receive this file, see http://www.horde.org/licenses/lgpl21.
 10:  *
 11:  * @author   Jan Schneider <jan@horde.org>
 12:  * @category Horde
 13:  * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
 14:  * @package  Group
 15:  */
 16: abstract class Horde_Group_Base
 17: {
 18:     /**
 19:      * Returns whether the group backend is read-only.
 20:      *
 21:      * @return boolean
 22:      */
 23:     public function readOnly()
 24:     {
 25:         return true;
 26:     }
 27: 
 28:     /**
 29:      * Returns whether groups can be renamed.
 30:      *
 31:      * @return boolean
 32:      */
 33:     public function renameSupported()
 34:     {
 35:         return true;
 36:     }
 37: 
 38:     /**
 39:      * Creates a new group.
 40:      *
 41:      * @param string $name   A group name.
 42:      * @param string $email  The group's email address.
 43:      *
 44:      * @return mixed  The ID of the created group.
 45:      * @throws Horde_Group_Exception
 46:      */
 47:     public function create($name, $email = null)
 48:     {
 49:         throw new Horde_Group_Exception('This group backend is read-only.');
 50:     }
 51: 
 52:     /**
 53:      * Renames a group.
 54:      *
 55:      * @param mixed $gid    A group ID.
 56:      * @param string $name  The new name.
 57:      *
 58:      * @throws Horde_Group_Exception
 59:      * @throws Horde_Exception_NotFound
 60:      */
 61:     public function rename($gid, $name)
 62:     {
 63:         throw new Horde_Group_Exception('This group backend is read-only.');
 64:     }
 65: 
 66:     /**
 67:      * Removes a group.
 68:      *
 69:      * @param mixed $gid  A group ID.
 70:      *
 71:      * @throws Horde_Group_Exception
 72:      */
 73:     public function remove($gid)
 74:     {
 75:         throw new Horde_Group_Exception('This group backend is read-only.');
 76:     }
 77: 
 78:     /**
 79:      * Checks if a group exists.
 80:      *
 81:      * @param mixed $gid  A group ID.
 82:      *
 83:      * @return boolean  True if the group exists.
 84:      * @throws Horde_Group_Exception
 85:      */
 86:     abstract public function exists($gid);
 87: 
 88:     /**
 89:      * Returns a group name.
 90:      *
 91:      * @param mixed $gid  A group ID.
 92:      *
 93:      * @return string  The group's name.
 94:      * @throws Horde_Group_Exception
 95:      * @throws Horde_Exception_NotFound
 96:      */
 97:     abstract public function getName($gid);
 98: 
 99:     /**
100:      * Returns all available attributes of a group.
101:      *
102:      * @param mixed $gid  A group ID.
103:      *
104:      * @return array  The group's date.
105:      * @throws Horde_Group_Exception
106:      * @throws Horde_Exception_NotFound
107:      */
108:     abstract public function getData($gid);
109: 
110:     /**
111:      * Sets one or more attributes of a group.
112:      *
113:      * @param mixed $gid               A group ID.
114:      * @param array|string $attribute  An attribute name or a hash of
115:      *                                 attributes.
116:      * @param string $value            An attribute value if $attribute is a
117:      *                                 string.
118:      *
119:      * @throws Horde_Group_Exception
120:      * @throws Horde_Exception_NotFound
121:      */
122:     public function setData($gid, $attribute, $value = null)
123:     {
124:         throw new Horde_Group_Exception('This group backend is read-only.');
125:     }
126: 
127:     /**
128:      * Returns a list of all groups a user may see, with IDs as keys and names
129:      * as values.
130:      *
131:      * @param string $member  Only return groups that this user is a member of.
132:      *
133:      * @return array  All existing groups.
134:      * @throws Horde_Group_Exception
135:      */
136:     abstract public function listAll($member = null);
137: 
138:     /**
139:      * Returns a list of users in a group.
140:      *
141:      * @param mixed $gid  A group ID.
142:      *
143:      * @return array  List of group users.
144:      * @throws Horde_Group_Exception
145:      * @throws Horde_Exception_NotFound
146:      */
147:     abstract public function listUsers($gid);
148: 
149:     /**
150:      * Returns a list of groups a user belongs to.
151:      *
152:      * @param string $user  A user name.
153:      *
154:      * @return array  A list of groups, with IDs as keys and names as values.
155:      * @throws Horde_Group_Exception
156:      */
157:     abstract public function listGroups($user);
158: 
159:     /**
160:      * Add a user to a group.
161:      *
162:      * @param mixed $gid    A group ID.
163:      * @param string $user  A user name.
164:      *
165:      * @throws Horde_Group_Exception
166:      * @throws Horde_Exception_NotFound
167:      */
168:     public function addUser($gid, $user)
169:     {
170:         throw new Horde_Group_Exception('This group backend is read-only.');
171:     }
172: 
173:     /**
174:      * Removes a user from a group.
175:      *
176:      * @param mixed $gid    A group ID.
177:      * @param string $user  A user name.
178:      *
179:      * @throws Horde_Group_Exception
180:      * @throws Horde_Exception_NotFound
181:      */
182:     public function removeUser($gid, $user)
183:     {
184:         throw new Horde_Group_Exception('This group backend is read-only.');
185:     }
186: 
187:     /**
188:      * Searches for group names.
189:      *
190:      * @param string $name  A search string.
191:      *
192:      * @return array  A list of matching groups, with IDs as keys and names as
193:      *                values.
194:      * @throws Horde_Group_Exception
195:      */
196:     abstract public function search($name);
197: }
198: 
API documentation generated by ApiGen