Reorganized the object classes.
authorGunnar Wrobel <p@rdus.de>
Wed, 1 Apr 2009 07:21:44 +0000 (07:21 +0000)
committerGunnar Wrobel <p@rdus.de>
Wed, 1 Apr 2009 07:23:10 +0000 (07:23 +0000)
Each object class can now provide searches specific to this class.

Structural changes: Classes directly representing an LDAP object class
should be located within the Object/ directory. Any logical Object
types should be placed in separate hierarchies (Object/Kolab so far).

27 files changed:
framework/Kolab_Server/lib/Horde/Kolab/Server/Object.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Inetorgperson.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolab/Address.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolab/Administrator.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolab/Adminrole.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolab/Distlist.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolab/Domainmaintainer.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolab/Maintainer.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolab/Server.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolab/User.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolabgroupofnames.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolabinetorgperson.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolabsharedfolder.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Organizationalperson.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Person.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/address.php [deleted file]
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/administrator.php [deleted file]
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/adminrole.php [deleted file]
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/base.php [deleted file]
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/distlist.php [deleted file]
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/domainmaintainer.php [deleted file]
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/group.php [deleted file]
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/maintainer.php [deleted file]
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/server.php [deleted file]
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/sharedfolder.php [deleted file]
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/user.php [deleted file]
framework/Kolab_Server/package.xml

index 9f531ca..614a30a 100644 (file)
  */
 class Horde_Kolab_Server_Object
 {
+    /** Define types of return values for searches. */
+    const RESULT_SINGLE = 1;
+    const RESULT_STRICT = 2;
+    const RESULT_MANY   = 3;
 
     /** Define attributes specific to this object type */
 
@@ -49,7 +53,7 @@ class Horde_Kolab_Server_Object
      *
      * @var Kolab_Server
      */
-    protected $db;
+    protected $server;
 
     /**
      * UID of this object on the Kolab server.
@@ -112,13 +116,13 @@ class Horde_Kolab_Server_Object
      * Initialize the Kolab Object. Provide either the UID or a
      * LDAP search result.
      *
-     * @param Horde_Kolab_Server &$db  The link into the Kolab db.
-     * @param string             $uid  UID of the object.
-     * @param array              $data A possible array of data for the object
+     * @param Horde_Kolab_Server &$server The link into the Kolab server.
+     * @param string             $uid     UID of the object.
+     * @param array              $data    A possible array of data for the object
      */
-    public function __construct(&$db, $uid = null, $data = null)
+    public function __construct(&$server, $uid = null, $data = null)
     {
-        $this->db = &$db;
+        $this->server = &$server;
         if (empty($uid)) {
             if (empty($data) || !isset($data[self::ATTRIBUTE_UID])) {
                 throw new Horde_Kolab_Server_Exception(_('Specify either the UID or a search result!'));
@@ -212,8 +216,8 @@ class Horde_Kolab_Server_Object
      */
     protected function read()
     {
-        $this->_cache = $this->db->read($this->uid,
-                                        $this->supported_attributes);
+        $this->_cache = $this->server->read($this->uid,
+                                            $this->supported_attributes);
     }
 
     /**
@@ -286,7 +290,7 @@ class Horde_Kolab_Server_Object
         switch ($attr) {
         case self::ATTRIBUTE_ID:
             return substr($this->uid, 0,
-                          strlen($this->uid) - strlen($this->db->getBaseUid()) - 1);
+                          strlen($this->uid) - strlen($this->server->getBaseUid()) - 1);
         }
     }
 
@@ -355,7 +359,7 @@ class Horde_Kolab_Server_Object
 
         $info[self::ATTRIBUTE_OC] = $this->object_classes;
 
-        $result = $this->db->save($this->uid, $info);
+        $result = $this->server->save($this->uid, $info);
         if ($result === false || $result instanceOf PEAR_Error) {
             return $result;
         }
@@ -364,4 +368,130 @@ class Horde_Kolab_Server_Object
 
         return $result;
     }
+
+    /**
+     * Identify the UID(s) of the result entry(s).
+     *
+     * @param array $result   The LDAP search result.
+     * @param int   $restrict A Horde_Kolab_Server::RESULT_* result restriction.
+     *
+     * @return boolean|string|array The UID(s) or false if there was no result.
+     *
+     * @throws Horde_Kolab_Server_Exception If the number of results did not
+     *                                      meet the expectations.
+     */
+    static protected function uidFromResult($result,
+                                            $restrict = Horde_Kolab_Server::RESULT_SINGLE)
+    {
+        if (empty($result)) {
+            return false;
+        }
+        $uids = array_keys($result);
+
+        switch ($restrict) {
+        case self::RESULT_STRICT:
+            if (count($uids) > 1) {
+                throw new Horde_Kolab_Server_Exception(sprintf(_("Found %s results when expecting only one!"),
+                                                               $count));
+            }
+        case self::RESULT_SINGLE:
+            return array_pop($uids);
+        case self::RESULT_MANY:
+            return $uids;
+        }
+    }
+
+    /**
+     * Get the attributes of the result entry(s).
+     *
+     * @param array $result   The LDAP search result.
+     * @param array $attrs    The attributes to retrieve.
+     * @param int   $restrict A Horde_Kolab_Server::RESULT_* result restriction.
+     *
+     * @return array The attributes of the entry(s) found.
+     *
+     * @throws Horde_Kolab_Server_Exception If the number of results did not
+     *                                      meet the expectations.
+     */
+    static protected function attrsFromResult($result, $attrs,
+                                              $restrict = Horde_Kolab_Server::RESULT_SINGLE)
+    {
+        switch ($restrict) {
+        case self::RESULT_STRICT:
+            if (count($result) > 1) {
+                throw new Horde_Kolab_Server_Exception(sprintf(_("Found %s results when expecting only one!"),
+                                                               $count));
+            }
+        case self::RESULT_SINGLE:
+            if (count($result) > 0) {
+                return array_pop($result);
+            }
+            return array();
+        case self::RESULT_MANY:
+            return $result;
+        }
+        return array();
+    }
+
+    /**
+     * Returns the set of search operations supported by this object type.
+     *
+     * @return array An array of supported search operations.
+     */
+    static public function getSearchOperations()
+    {
+        $searches = array(
+            'basicUidForSearch',
+            'attrsForSearch',
+        );
+        return $searches;
+    }
+
+    /**
+     * Identify the UID for the first object found using the specified
+     * search criteria.
+     *
+     * @param array $criteria The search parameters as array.
+     * @param int   $restrict A Horde_Kolab_Server::RESULT_* result restriction.
+     *
+     * @return boolean|string|array The UID(s) or false if there was no result.
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    static public function basicUidForSearch($server, $criteria,
+                                             $restrict = Horde_Kolab_Server::RESULT_SINGLE)
+    {
+        $params = array('attributes' => self::ATTRIBUTE_UID);
+        $filter = $server->searchQuery($criteria);
+        $result = $server->search($filter, $params, $server->getBaseUid());
+        $data = $result->as_struct();
+        if (is_a($data, 'PEAR_Error')) {
+            throw new Horde_Kolab_Server_Exception($data->getMessage());
+        }
+        return self::uidFromResult($data, $restrict);
+    }
+
+    /**
+     * Identify attributes for the objects found using a filter.
+     *
+     * @param array $criteria The search parameters as array.
+     * @param array $attrs    The attributes to retrieve.
+     * @param int   $restrict A Horde_Kolab_Server::RESULT_* result restriction.
+     *
+     * @return array The results.
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    static public function attrsForSearch($server, $criteria, $attrs,
+                                          $restrict = Horde_Kolab_Server::RESULT_SINGLE)
+    {
+        $params = array('attributes' => $attrs);
+        $filter = $server->searchQuery($criteria);
+        $result = $server->search($filter, $params, $server->getBaseUid());
+        $data   = $result->as_struct();
+        if (is_a($data, 'PEAR_Error')) {
+            throw new Horde_Kolab_Server_Exception($data->getMessage());
+        }
+        return self::attrsFromResult($data, $attrs, $restrict);
+    }
 };
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Inetorgperson.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Inetorgperson.php
new file mode 100644 (file)
index 0000000..b33b65b
--- /dev/null
@@ -0,0 +1,107 @@
+<?php
+/**
+ * A bsaic object representation.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * This class provides basic methods common to all Kolab server objects.
+ *
+ * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Object_Inetorgperson extends Horde_Kolab_Server_Object_Organizationalperson
+{
+
+    const ATTRIBUTE_SID          = 'uid';
+    const ATTRIBUTE_GIVENNAME    = 'givenName';
+    const ATTRIBUTE_FN           = 'fn';
+    const ATTRIBUTE_MAIL         = 'mail';
+    const ATTRIBUTE_LNFN         = 'lnfn';
+    const ATTRIBUTE_FNLN         = 'fnln';
+
+    const OBJECTCLASS_INETORGPERSON      = 'inetOrgPerson';
+
+    /**
+     * The ldap classes for this type of object.
+     *
+     * @var array
+     */
+    protected $object_classes = array(
+        self::OBJECTCLASS_TOP,
+        self::OBJECTCLASS_INETORGPERSON
+    );
+
+    /**
+     * The attributes supported by this class
+     *
+     * @var array
+     */
+/*     public $supported_attributes = array( */
+/*         self::ATTRIBUTE_FBPAST, */
+/*     ); */
+
+
+    /**
+     * Derive an attribute value.
+     *
+     * @param string $attr The attribute to derive.
+     *
+     * @return mixed The value of the attribute.
+     */
+    protected function derive($attr)
+    {
+        switch ($attr) {
+        case self::ATTRIBUTE_ID:
+            $result = split(',', $this->uid);
+            if (substr($result[0], 0, 3) == 'cn=') {
+                return substr($result[0], 3);
+            } else {
+                return $result[0];
+            }
+        default:
+            return parent::derive($attr);
+        }
+    }
+
+    /**
+     * Generates an ID for the given information.
+     *
+     * @param array $info The data of the object.
+     *
+     * @static
+     *
+     * @return string|PEAR_Error The ID.
+     */
+    public static function generateId($info)
+    {
+        $id_mapfields = array('givenName', 'sn');
+        $id_format    = '%s %s';
+
+        $fieldarray = array();
+        foreach ($id_mapfields as $mapfield) {
+            if (isset($info[$mapfield])) {
+                $fieldarray[] = $info[$mapfield];
+            } else {
+                $fieldarray[] = '';
+            }
+        }
+
+        return trim(vsprintf($id_format, $fieldarray), " \t\n\r\0\x0B,");
+    }
+}
\ No newline at end of file
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolab/Address.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolab/Address.php
new file mode 100644 (file)
index 0000000..1a20272
--- /dev/null
@@ -0,0 +1,82 @@
+<?php
+/**
+ * An entry in the global addressbook.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * This class provides methods to deal with global address book
+ * entries for Kolab.
+ *
+ * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Object_Kolab_Address extends Horde_Kolab_Server_Object_Kolabinetorgperson
+{
+
+    /**
+     * Attributes derived from the LDAP values.
+     *
+     * @var array
+     */
+    public $derived_attributes = array(
+        self::ATTRIBUTE_LNFN,
+        self::ATTRIBUTE_FNLN,
+    );
+
+    /**
+     * The ldap classes for this type of object.
+     *
+     * @var array
+     */
+    protected $object_classes = array(
+        self::OBJECTCLASS_TOP,
+        self::OBJECTCLASS_INETORGPERSON,
+        self::OBJECTCLASS_KOLABINETORGPERSON,
+    );
+
+    /**
+     * Return the filter string to retrieve this object type.
+     *
+     * @static
+     *
+     * @return string The filter to retrieve this object type from the server
+     *                database.
+     */
+    public static function getFilter()
+    {
+        return '(&(objectclass=inetOrgPerson)(!(uid=*))(sn=*))';
+    }
+
+    /**
+     * Convert the object attributes to a hash.
+     *
+     * @param string $attrs The attributes to return.
+     *
+     * @return array|PEAR_Error The hash representing this object.
+     */
+    public function toHash($attrs = null)
+    {
+        if (!isset($attrs)) {
+            $attrs = array(
+                self::ATTRIBUTE_LNFN,
+            );
+        }
+        return parent::toHash($attrs);
+    }
+}
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolab/Administrator.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolab/Administrator.php
new file mode 100644 (file)
index 0000000..ad20091
--- /dev/null
@@ -0,0 +1,63 @@
+<?php
+/**
+ * A system administrator.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * This class provides methods to deal with administrator
+ * entries for Kolab.
+ *
+ * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Object_Kolab_Administrator extends Horde_Kolab_Server_Object_Kolab_Adminrole
+{
+
+    /**
+     * The group the UID must be member of so that this object really
+     * matches this class type. This may not include the root UID.
+     *
+     * @var string
+     */
+    protected $required_group = 'cn=admin,cn=internal';
+
+    /**
+     * Returns the server url of the given type for this user.
+     *
+     * This method is used to encapsulate multidomain support.
+     *
+     * @param string $server_type The type of server URL that should be returned.
+     *
+     * @return string The server url or empty on error.
+     */
+    public function getServer($server_type)
+    {
+        global $conf;
+
+        switch ($server_type) {
+        case 'homeserver':
+        default:
+            $server = $this->get(self::ATTRIBUTE_HOMESERVER);
+            if (empty($server)) {
+                $server = $_SERVER['SERVER_NAME'];
+            }
+            return $server;
+        }
+    }
+}
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolab/Adminrole.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolab/Adminrole.php
new file mode 100644 (file)
index 0000000..986d248
--- /dev/null
@@ -0,0 +1,130 @@
+<?php
+/**
+ * A Kolab object of type administrator.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * This class provides methods to deal with administrator object types.
+ *
+ * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Object_Kolab_Adminrole extends Horde_Kolab_Server_Object_Kolabinetorgperson
+{
+
+    /**
+     * Attributes derived from the LDAP values.
+     *
+     * @var array
+     */
+    public $derived_attributes = array(
+        self::ATTRIBUTE_ID,
+        self::ATTRIBUTE_LNFN,
+    );
+
+    /**
+     * The group the UID must be member of so that this object really
+     * matches this class type. This may not include the root UID.
+     *
+     * @var string
+     */
+    protected $required_group;
+
+    /**
+     * Return the filter string to retrieve this object type.
+     *
+     * @static
+     *
+     * @return string The filter to retrieve this object type from the server
+     *                database.
+     */
+    public static function getFilter()
+    {
+        return '(&(cn=*)(objectClass=inetOrgPerson)(!(uid=manager))(sn=*))';
+    }
+
+    /**
+     * Convert the object attributes to a hash.
+     *
+     * @param string $attrs The attributes to return.
+     *
+     * @return array|PEAR_Error The hash representing this object.
+     */
+    public function toHash($attrs = null)
+    {
+        if (!isset($attrs)) {
+            $attrs = array(
+                self::ATTRIBUTE_SID,
+                self::ATTRIBUTE_LNFN,
+            );
+        }
+        return parent::toHash($attrs);
+    }
+
+    /**
+     * Saves object information.
+     *
+     * @param array $info The information about the object.
+     *
+     * @return boolean|PEAR_Error True on success.
+     */
+    public function save($info)
+    {
+        if (!isset($info['cn'])) {
+            if (!isset($info['sn']) || !isset($info['givenName'])) {
+                return PEAR::raiseError('Either the last name or the given name is missing!');
+            } else {
+                $info['cn'] = $this->generateId($info);
+            }
+        }
+
+        $admins_uid = sprintf('%s,%s', $this->required_group,
+                              $this->server->getBaseUid());
+
+        $admin_group = $this->server->fetch($admins_uid, 'Horde_Kolab_Server_Object_Kolabgroupofnames');
+        if ($admin_group instanceOf PEAR_Error || !$admin_group->exists()) {
+
+            $members = array($this->uid);
+
+            //FIXME: This is not okay and also contains too much LDAP knowledge
+            $parts           = split(',', $this->required_group);
+            list($groupname) = sscanf($parts[0], 'cn=%s');
+
+            $result = $this->server->add(array(self::ATTRIBUTE_CN => $groupname,
+                                               'type' => 'Horde_Kolab_Server_Object_Kolabgroupofnames',
+                                               Horde_Kolab_Server_Object_Kolabgroupofnames::ATTRIBUTE_MEMBER => $members,
+                                               Horde_Kolab_Server_Object_Kolabgroupofnames::ATTRIBUTE_VISIBILITY => false));
+            if ($result instanceOf PEAR_Error) {
+                return $result;
+            }
+        } else {
+            $result = $admin_group->isMember($this->uid);
+            if ($result instanceOf PEAR_Error) {
+                return $result;
+            }
+            if ($result === false) {
+                $members   = $admin_group->getMembers();
+                $members[] = $this->uid;
+                $admin_group->save(array(self::ATTRIBUTE_MEMBER => $members));
+            }
+        }
+        return parent::save($info);
+    }
+
+}
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolab/Distlist.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolab/Distlist.php
new file mode 100644 (file)
index 0000000..baa7882
--- /dev/null
@@ -0,0 +1,42 @@
+<?php
+/**
+ * Representation of a Kolab distribution list.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * This class provides methods to deal with distribution lists for Kolab.
+ *
+ * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Object_Kolab_Distlist extends Horde_Kolab_Server_Object_Kolabgroupofnames
+{
+    /**
+     * Return the filter string to retrieve this object type.
+     *
+     * @static
+     *
+     * @return string The filter to retrieve this object type from the server
+     *                database.
+     */
+    public static function getFilter()
+    {
+        return '(&(objectClass=kolabGroupOfNames)(mail=*))';
+    }
+};
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolab/Domainmaintainer.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolab/Domainmaintainer.php
new file mode 100644 (file)
index 0000000..c0bef84
--- /dev/null
@@ -0,0 +1,109 @@
+<?php
+/**
+ * A Kolab domain maintainer.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * This class provides methods associated to Kolab domain maintainers.
+ *
+ * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Object_Kolab_Domainmaintainer extends Horde_Kolab_Server_Object_Kolab_Adminrole
+{
+
+    const ATTRIBUTE_DOMAIN       = 'domain';
+
+    /**
+     * Attributes derived from the LDAP values.
+     *
+     * @var array
+     */
+    public $derived_attributes = array(
+        self::ATTRIBUTE_ID,
+        self::ATTRIBUTE_LNFN,
+        self::ATTRIBUTE_DOMAIN,
+    );
+
+    /**
+     * The group the UID must be member of so that this object really
+     * matches this class type. This may not include the root UID.
+     *
+     * @var string
+     */
+    protected $required_group = 'cn=domain-maintainer,cn=internal';
+
+    /**
+     * Convert the object attributes to a hash.
+     *
+     * @param string $attrs The attributes to return.
+     *
+     * @return array|PEAR_Error The hash representing this object.
+     */
+    public function toHash($attrs = null)
+    {
+        if (!isset($attrs)) {
+            $attrs = array(
+                self::ATTRIBUTE_SID,
+                self::ATTRIBUTE_LNFN,
+                self::ATTRIBUTE_DOMAIN,
+            );
+        }
+        return parent::toHash($attrs);
+    }
+
+    /**
+     * Saves object information.
+     *
+     * @param array $info The information about the object.
+     *
+     * @return boolean|PEAR_Error True on success.
+     */
+    public function save($info)
+    {
+        foreach ($info[self::ATTRIBUTE_DOMAIN] as $domain) {
+            $domain_uid = sprintf('cn=%s,cn=domain,cn=internal,%s',
+                                  $domain, $this->server->getBaseUid());
+
+            //FIXME: This should be made easier by the group object
+
+            $domain_group = $this->server->fetch($domain_uid, 'Horde_Kolab_Server_Object_Kolabgroupofnames');
+            if ($domain_group instanceOf PEAR_Error) {
+                return $domain_group;
+            }
+            if (!$domain_group->exists()) {
+                $members = array($this->uid);
+                $domain_group->save(array(self::ATTRIBUTE_CN => $domain,
+                                          Horde_Kolab_Server_Object_Kolabgroupofnames::ATTRIBUTE_MEMBER => $members));
+            } else {
+                $result = $domain_group->isMember($this->uid);
+                if ($result instanceOf PEAR_Error) {
+                    return $result;
+                }
+                if ($result === false) {
+                    $members   = $domain_group->getMembers();
+                    $members[] = $this->uid;
+                    $domain_group->save(array(Horde_Kolab_Server_Object_Kolabgroupofnames::ATTRIBUTE_MEMBER => $members));
+                }
+            }
+        }
+        return parent::save($info);
+    }
+
+}
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolab/Maintainer.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolab/Maintainer.php
new file mode 100644 (file)
index 0000000..3bb1c25
--- /dev/null
@@ -0,0 +1,40 @@
+<?php
+/**
+ * A Kolab maintainer.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * This class provides methods to deal with maintainer
+ * entries for Kolab.
+ *
+ * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Object_Kolab_Maintainer extends Horde_Kolab_Server_Object_Kolab_Adminrole
+{
+
+    /**
+     * The group the UID must be member of so that this object really
+     * matches this class type. This may not include the root UID.
+     *
+     * @var string
+     */
+    protected $required_group = 'cn=maintainer,cn=internal';
+
+}
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolab/Server.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolab/Server.php
new file mode 100644 (file)
index 0000000..cfe86da
--- /dev/null
@@ -0,0 +1,54 @@
+<?php
+/**
+ * The server configuration.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * This class provides methods to deal with Kolab server configuration.
+ *
+ * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Object_Kolab_Server extends Horde_Kolab_Server_Object
+{
+
+    const ATTRIBUTE_FBPAST       = 'kolabFreeBusyPast';
+
+    /**
+     * The attributes supported by this class
+     *
+     * @var array
+     */
+    public $supported_attributes = array(
+        self::ATTRIBUTE_FBPAST,
+    );
+
+    /**
+     * Return the filter string to retrieve this object type.
+     *
+     * @static
+     *
+     * @return string The filter to retrieve this object type from the server
+     *                database.
+     */
+    public static function getFilter()
+    {
+        return '(&((k=kolab))(objectclass=kolab))';
+    }
+}
\ No newline at end of file
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolab/User.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolab/User.php
new file mode 100644 (file)
index 0000000..52db00a
--- /dev/null
@@ -0,0 +1,317 @@
+<?php
+/**
+ * A standard Kolab user.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * This class provides methods to deal with Kolab users stored in
+ * the Kolab db.
+ *
+ * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Object_Kolab_User extends Horde_Kolab_Server_Object_Kolabinetorgperson
+{
+
+    /** Define attributes specific to this object type */
+    const ATTRIBUTE_USERTYPE = 'usertype';
+
+    /** Define the possible Kolab user types */
+    const USERTYPE_STANDARD = 0;
+    const USERTYPE_INTERNAL = 1;
+    const USERTYPE_GROUP    = 2;
+    const USERTYPE_RESOURCE = 3;
+
+    /**
+     * The attributes supported by this class
+     *
+     * @var array
+     */
+    public $supported_attributes = false;
+
+    /**
+     * Attributes derived from the LDAP values.
+     *
+     * @var array
+     */
+    public $derived_attributes = array(
+        self::ATTRIBUTE_FN,
+        'id',
+        'usertype',
+        //FIXME: Do we really want to have this type of functionality within this library?
+        'lnfn',
+        'fnln',
+    );
+
+    /**
+     * The attributes required when creating an object of this class.
+     *
+     * @var array
+     */
+    public $required_attributes = false;
+
+    /**
+     * Initialize the Kolab Object. Provide either the UID or a
+     * LDAP search result.
+     *
+     * @param Horde_Kolab_Server &$db  The link into the Kolab db.
+     * @param string             $dn   UID of the object.
+     * @param array              $data A possible array of data for the object
+     */
+    public function __construct(&$db, $dn = null, $data = null)
+    {
+        global $conf;
+
+        /** Allows to customize the supported user attributes. */
+        if (isset($conf['kolab']['server']['user_supported_attrs'])) {
+            $this->supported_attributes = $conf['kolab']['server']['user_supported_attrs'];
+        }
+
+        /** Allows to customize the required user attributes. */
+        if (isset($conf['kolab']['server']['user_required_attrs'])) {
+            $this->required_attributes = $conf['kolab']['server']['user_required_attrs'];
+        }
+
+        /** Allows to customize the user object classes. */
+        if (isset($conf['kolab']['server']['user_objectclasses'])) {
+            $this->object_classes = $conf['kolab']['server']['user_object_classes'];
+        }
+
+        parent::__construct($db, $dn, $data);
+    }
+
+    /**
+     * Return the filter string to retrieve this object type.
+     *
+     * @static
+     *
+     * @return string The filter to retrieve this object type from the server
+     *                database.
+     */
+    public static function getFilter()
+    {
+        return  '(&(objectClass=kolabInetOrgPerson)(uid=*)(mail=*)(sn=*))';
+    }
+
+    /**
+     * Derive an attribute value.
+     *
+     * @param string $attr The attribute to derive.
+     *
+     * @return mixed The value of the attribute.
+     */
+    protected function derive($attr)
+    {
+        switch ($attr) {
+        case self::ATTRIBUTE_USERTYPE:
+            if (strpos($this->_uid, 'cn=internal')) {
+                return self::USERTYPE_INTERNAL;
+            } else if (strpos($this->_uid, 'cn=group')) {
+                return self::USERTYPE_GROUP;
+            } else if (strpos($this->_uid, 'cn=resource')) {
+                return self::USERTYPE_RESOURCE;
+            } else {
+                return self::USERTYPE_STANDARD;
+            }
+        case self::ATTRIBUTE_LNFN:
+            $gn = $this->_get(self::ATTRIBUTE_GIVENNAME, true);
+            $sn = $this->_get(self::ATTRIBUTE_SN, true);
+            return sprintf('%s, %s', $sn, $gn);
+        case self::ATTRIBUTE_FNLN:
+            $gn = $this->_get(self::ATTRIBUTE_GIVENNAME, true);
+            $sn = $this->_get(self::ATTRIBUTE_SN, true);
+            return sprintf('%s %s', $gn, $sn);
+        case self::ATTRIBUTE_FN:
+            return $this->getFn();
+        default:
+            return parent::derive($attr);
+        }
+    }
+
+    /**
+     * Convert the object attributes to a hash.
+     *
+     * @param string $attrs The attributes to return.
+     *
+     * @return array|PEAR_Error The hash representing this object.
+     */
+    public function toHash($attrs = null)
+    {
+        if (!isset($attrs)) {
+            $attrs = array(
+                self::ATTRIBUTE_SID,
+                self::ATTRIBUTE_FN,
+                self::ATTRIBUTE_MAIL,
+                self::ATTRIBUTE_USERTYPE,
+            );
+        }
+        return parent::toHash($attrs);
+    }
+
+    /**
+     * Get the "first name" attribute of this object
+     *
+     * FIXME: This should get refactored to be combined with the Id value.
+     *
+     * @return string the "first name" of this object
+     */
+    protected function getFn()
+    {
+        $sn = $this->_get(self::ATTRIBUTE_SN, true);
+        $cn = $this->_get(self::ATTRIBUTE_CN, true);
+        return trim(substr($cn, 0, strlen($cn) - strlen($sn)));
+    }
+
+    /**
+     * Get the groups for this object
+     *
+     * @return mixed|PEAR_Error An array of group ids, false if no groups were
+     *                          found.
+     */
+    public function getGroups()
+    {
+        return $this->server->getGroups($this->uid);
+    }
+
+    /**
+     * Returns the server url of the given type for this user.
+     *
+     * This method is used to encapsulate multidomain support.
+     *
+     * @param string $server_type The type of server URL that should be returned.
+     *
+     * @return string The server url or empty on error.
+     */
+    public function getServer($server_type)
+    {
+        global $conf;
+
+        switch ($server_type) {
+        case 'freebusy':
+            $server = $this->get(self::ATTRIBUTE_FREEBUSYHOST);
+            if (!empty($server)) {
+                return $server;
+            }
+            if (isset($conf['kolab']['freebusy']['server'])) {
+                return $conf['kolab']['freebusy']['server'];
+            }
+            $server = $this->getServer('homeserver');
+            if (empty($server)) {
+                $server = $_SERVER['SERVER_NAME'];
+            }
+            if (isset($conf['kolab']['server']['freebusy_url_format'])) {
+                return sprintf($conf['kolab']['server']['freebusy_url_format'],
+                               $server);
+            } else {
+                return 'https://' . $server . '/freebusy';
+            }
+        case 'imap':
+            $server = $this->get(self::ATTRIBUTE_IMAPHOST);
+            if (!empty($server)) {
+                return $server;
+            }
+        case 'homeserver':
+        default:
+            $server = $this->get(self::ATTRIBUTE_HOMESERVER);
+            if (empty($server)) {
+                $server = $_SERVER['SERVER_NAME'];
+            }
+            return $server;
+        }
+    }
+
+    /**
+     * Generates an ID for the given information.
+     *
+     * @param array $info The data of the object.
+     *
+     * @static
+     *
+     * @return string|PEAR_Error The ID.
+     */
+    public static function generateId($info)
+    {
+        global $conf;
+
+        /** The fields that should get mapped into the user ID. */
+        if (isset($conf['kolab']['server']['user_id_mapfields'])) {
+            $id_mapfields = $conf['kolab']['server']['user_id_mapfields'];
+        } else {
+            $id_mapfields = array('givenName', 'sn');
+        }
+
+        /** The user ID format. */
+        if (isset($conf['kolab']['server']['user_id_format'])) {
+            $id_format = $conf['kolab']['server']['user_id_format'];
+        } else {
+            $id_format = '%s %s';
+        }
+
+        $fieldarray = array();
+        foreach ($id_mapfields as $mapfield) {
+            if (isset($info[$mapfield])) {
+                $fieldarray[] = $info[$mapfield];
+            } else {
+                $fieldarray[] = '';
+            }
+        }
+        return trim(vsprintf($id_format, $fieldarray), " \t\n\r\0\x0B,");
+    }
+
+    /**
+     * Saves object information.
+     *
+     * @param array $info The information about the object.
+     *
+     * @return boolean|PEAR_Error True on success.
+     *
+     * @throws Horde_Kolab_Server_Exception If the information to be saved is
+     *                                      invalid.
+     */
+    public function save($info)
+    {
+        if (!isset($info['cn'])) {
+            if (!isset($info['sn']) || !isset($info['givenName'])) {
+                throw new Horde_Kolab_Server_Exception(_("Either the last name or the given name is missing!"));
+            } else {
+                $info['cn'] = $this->generateId($info);
+            }
+        }
+
+        if (isset($conf['kolab']['server']['user_mapping'])) {
+            $mapped = array();
+            $map    = $conf['kolab']['server']['user_mapping'];
+            foreach ($map as $key => $val) {
+                $mapped[$val] = $info[$key];
+            }
+            $info = $mapped;
+        }
+
+        if (isset($conf['kolab']['server']['user_mapping'])) {
+            $mapped = array();
+            $map    = $conf['kolab']['server']['user_mapping'];
+            foreach ($map as $key => $val) {
+                $mapped[$val] = $info[$key];
+            }
+            $info = $mapped;
+        }
+
+        return parent::save($info);
+    }
+};
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolabgroupofnames.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolabgroupofnames.php
new file mode 100644 (file)
index 0000000..5d0e73f
--- /dev/null
@@ -0,0 +1,345 @@
+<?php
+/**
+ * Representation of a Kolab user group.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * This class provides methods to deal with groups for Kolab.
+ *
+ * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Object_Kolabgroupofnames extends Horde_Kolab_Server_Object_Inetorgperson
+{
+
+    const ATTRIBUTE_VISIBILITY   = 'visible';
+    const ATTRIBUTE_MEMBER       = 'member';
+
+    const OBJECTCLASS_KOLABGROUPOFNAMES = 'kolabGroupOfNames';
+
+    /**
+     * Attributes derived from the LDAP values.
+     *
+     * @var array
+     */
+    public $derived_attributes = array(
+        self::ATTRIBUTE_ID,
+        self::ATTRIBUTE_VISIBILITY,
+    );
+
+    /**
+     * The ldap classes for this type of object.
+     *
+     * @var array
+     */
+    protected $object_classes = array(
+        self::OBJECTCLASS_TOP,
+        self::OBJECTCLASS_INETORGPERSON,
+        self::OBJECTCLASS_KOLABGROUPOFNAMES,
+    );
+
+    /**
+     * Sort by this attributes (must be a LDAP attribute).
+     *
+     * @var string
+     */
+    public $sort_by = self::ATTRIBUTE_MAIL;
+
+    /**
+     * Return the filter string to retrieve this object type.
+     *
+     * @static
+     *
+     * @return string The filter to retrieve this object type from the server
+     *                database.
+     */
+    public static function getFilter()
+    {
+        return '(objectClass=kolabGroupOfNames)';
+    }
+
+    /**
+     * Derive an attribute value.
+     *
+     * @param string $attr The attribute to derive.
+     *
+     * @return mixed The value of the attribute.
+     */
+    protected function derive($attr)
+    {
+        switch ($attr) {
+        case self::ATTRIBUTE_VISIBILITY:
+            return strpos($this->_uid, 'cn=internal') === false;
+        default:
+            return parent::derive($attr);
+        }
+    }
+
+    /**
+     * Convert the object attributes to a hash.
+     *
+     * @param string $attrs The attributes to return.
+     *
+     * @return array|PEAR_Error The hash representing this object.
+     */
+    public function toHash($attrs = null)
+    {
+        if (!isset($attrs)) {
+            $attrs = array(
+                self::ATTRIBUTE_ID,
+                self::ATTRIBUTE_MAIL,
+                self::ATTRIBUTE_VISIBILITY,
+            );
+        }
+        return parent::toHash($attrs);
+    }
+
+    /**
+     * Generates an ID for the given information.
+     *
+     * @param array $info The data of the object.
+     *
+     * @static
+     *
+     * @return string|PEAR_Error The ID.
+     */
+    public static function generateId($info)
+    {
+        if (isset($info['mail'])) {
+            return trim($info['mail'], " \t\n\r\0\x0B,");
+        } else {
+            return trim($info['cn'], " \t\n\r\0\x0B,");
+        }
+    }
+
+    /**
+     * Saves object information.
+     *
+     * @param array $info The information about the object.
+     *
+     * @return boolean|PEAR_Error True on success.
+     */
+    public function save($info)
+    {
+        if (!isset($info['cn'])) {
+            if (!isset($info['mail'])) {
+                throw new Horde_Kolab_Server_Exception('Either the mail address or the common name has to be specified for a group object!');
+            } else {
+                $info['cn'] = $info['mail'];
+            }
+        }
+        return parent::save($info);
+    }
+
+    /**
+     * Retrieve the member list for this group.
+     *
+     * @return array|PEAR_Error The list of members in this group.
+     */
+    public function getMembers()
+    {
+        return $this->_get(self::ATTRIBUTE_MEMBER, false);
+    }
+
+    /**
+     * Add a member to this group.
+     *
+     * @param string $member The UID of the member to add.
+     *
+     * @return array|PEAR_Error True if successful.
+     */
+    public function addMember($member)
+    {
+        $members = $this->getMembers();
+        if (is_a($members, 'PEAR_Error')) {
+            return $members;
+        }
+        if (!in_array($member, $members)) {
+            $this->_cache[self::ATTRIBUTE_MEMBER][] = $member;
+        } else {
+            return PEAR::raiseError(_("The UID %s is already a member of the group %s!"),
+                                    $member, $this->_uid);
+        }
+        return $this->save($this->_cache);
+    }
+
+    /**
+     * Delete a member from this group.
+     *
+     * @param string $member The UID of the member to delete.
+     *
+     * @return array|PEAR_Error True if successful.
+     */
+    public function deleteMember($member)
+    {
+        $members = $this->getMembers();
+        if (is_a($members, 'PEAR_Error')) {
+            return $members;
+        }
+        if (in_array($member, $members)) {
+            $this->_cache[self::ATTRIBUTE_MEMBER] =
+                array_diff($this->_cache[self::ATTRIBUTE_MEMBER],
+                           array($member));
+        } else {
+            return PEAR::raiseError(_("The UID %s is no member of the group %s!"),
+                                    $member, $this->_uid);
+
+        }
+        return $this->save($this->_cache);
+    }
+
+    /**
+     * Is the specified UID member of this group?
+     *
+     * @param string $member The UID of the member to check.
+     *
+     * @return boolean|PEAR_Error True if the UID is a member of the group,
+     *                            false otherwise.
+     */
+    public function isMember($member)
+    {
+        $members = $this->getMembers();
+        if (is_a($members, 'PEAR_Error') || !is_array($members)) {
+            return $members;
+        }
+        if (!in_array($member, $members)) {
+            return false;
+        } else {
+            return true;
+        }
+    }
+
+    /**
+     * Returns the set of search operations supported by this object type.
+     *
+     * @return array An array of supported search operations.
+     */
+    static public function getSearchOperations()
+    {
+        $searches = array(
+            'gidForSearch',
+            'gidForMail',
+            'memberOfGroupAddress',
+            'getGroups',
+        );
+        return $searches;
+    }
+
+    /**
+     * FIXME: This method belongs somewhere where we are aware of groups
+     * Identify the GID for the first group found using the specified
+     * search criteria
+     *
+     * @param array $criteria The search parameters as array.
+     * @param int   $restrict A Horde_Kolab_Server::RESULT_* result restriction.
+     *
+     * @return boolean|string|array The GID(s) or false if there was no result.
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    static public function gidForSearch($server, $criteria,
+                                        $restrict = Horde_Kolab_Server_Object::RESULT_SINGLE)
+    {
+        $groups = array('field' => self::ATTRIBUTE_OC,
+                        'op'    => '=',
+                        'test'  => self::OBJECTCLASS_KOLABGROUPOFNAMES);
+        if (!empty($criteria)) {
+            $criteria = array('AND' => array($groups, $criteria));
+        } else {
+            $criteria = array('AND' => array($groups));
+        }
+        return self::basicUidForSearch($server, $criteria, $restrict);
+    }
+
+    /**
+     * Identify the GID for the first group found with the given mail.
+     *
+     * @param string $mail     Search for groups with this mail address.
+     * @param int    $restrict A Horde_Kolab_Server::RESULT_* result restriction.
+     *
+     * @return mixed The GID or false if there was no result.
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    static public function gidForMail($server, $mail,
+                                      $restrict = Horde_Kolab_Server_Object::RESULT_SINGLE)
+    {
+        $criteria = array('AND' => array(array('field' => self::ATTRIBUTE_MEMBER,
+                                               'op'    => '=',
+                                               'test'  => $mail),
+                         ),
+        );
+        return self::gidForSearch($server, $criteria, $restrict);
+    }
+
+    /**
+     * Is the given UID member of the group with the given mail address?
+     *
+     * @param string $uid  UID of the user.
+     * @param string $mail Search the group with this mail address.
+     *
+     * @return boolean True in case the user is in the group, false otherwise.
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    static public function memberOfGroupAddress($server, $uid, $mail)
+    {
+        $criteria = array('AND' =>
+                          array(
+                              array('field' => self::ATTRIBUTE_MAIL,
+                                    'op'    => '=',
+                                    'test'  => $mail),
+                              array('field' => self::ATTRIBUTE_MEMBER,
+                                    'op'    => '=',
+                                    'test'  => $uid),
+                          ),
+        );
+
+        $result = self::gidForSearch($server, $criteria,
+                                      self::RESULT_SINGLE);
+        return !empty($result);
+    }
+
+    /**
+     * Get the groups for this object.
+     *
+     * @param string $uid The UID of the object to fetch.
+     *
+     * @return array An array of group ids.
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    public function getGroups($server, $uid)
+    {
+        $criteria = array('AND' =>
+                          array(
+                              array('field' => self::ATTRIBUTE_MEMBER,
+                                    'op'    => '=',
+                                    'test'  => $uid),
+                          ),
+        );
+
+        $result = self::gidForSearch($server, $criteria, self::RESULT_MANY);
+        if (empty($result)) {
+            return array();
+        }
+        return $result;
+    }
+
+}
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolabinetorgperson.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolabinetorgperson.php
new file mode 100644 (file)
index 0000000..7c8fcff
--- /dev/null
@@ -0,0 +1,413 @@
+<?php
+/**
+ * A bsaic object representation.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * This class provides basic methods common to all Kolab server objects.
+ *
+ * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Object_Kolabinetorgperson extends Horde_Kolab_Server_Object_Inetorgperson
+{
+
+    const ATTRIBUTE_ALIAS        = 'alias';
+    const ATTRIBUTE_DELEGATE     = 'kolabDelegate';
+    const ATTRIBUTE_DELETED      = 'kolabDeleteFlag';
+    const ATTRIBUTE_FBFUTURE     = 'kolabFreeBusyFuture';
+    const ATTRIBUTE_FOLDERTYPE   = 'kolabFolderType';
+    const ATTRIBUTE_HOMESERVER   = 'kolabHomeServer';
+    const ATTRIBUTE_FREEBUSYHOST = 'kolabFreeBusyServer';
+    const ATTRIBUTE_IMAPHOST     = 'kolabImapServer';
+    const ATTRIBUTE_IPOLICY      = 'kolabInvitationPolicy';
+
+    const OBJECTCLASS_KOLABINETORGPERSON = 'kolabInetOrgPerson';
+
+    /**
+     * The ldap classes for this type of object.
+     *
+     * @var array
+     */
+    protected $object_classes = array(
+        self::OBJECTCLASS_TOP,
+        self::OBJECTCLASS_INETORGPERSON,
+        self::OBJECTCLASS_KOLABINETORGPERSON,
+    );
+
+    /**
+     * The attributes supported by this class
+     *
+     * @var array
+     */
+/*     public $supported_attributes = array( */
+/*         self::ATTRIBUTE_FBPAST, */
+/*     ); */
+
+
+    /**
+     * Derive an attribute value.
+     *
+     * @param string $attr The attribute to derive.
+     *
+     * @return mixed The value of the attribute.
+     */
+    protected function derive($attr)
+    {
+        switch ($attr) {
+        case self::ATTRIBUTE_ID:
+            $result = split(',', $this->uid);
+            if (substr($result[0], 0, 3) == self::ATTRIBUTE_CN . '=') {
+                return substr($result[0], 3);
+            } else {
+                return $result[0];
+            }
+        default:
+            return parent::derive($attr);
+        }
+    }
+
+    /**
+     * Generates an ID for the given information.
+     *
+     * @param array $info The data of the object.
+     *
+     * @static
+     *
+     * @return string|PEAR_Error The ID.
+     */
+    public static function generateId($info)
+    {
+        $id_mapfields = array(self::ATTRIBUTE_GIVENNAME,
+                              self::ATTRIBUTE_SN);
+        $id_format    = '%s %s';
+
+        $fieldarray = array();
+        foreach ($id_mapfields as $mapfield) {
+            if (isset($info[$mapfield])) {
+                $fieldarray[] = $info[$mapfield];
+            } else {
+                $fieldarray[] = '';
+            }
+        }
+
+        return trim(vsprintf($id_format, $fieldarray), " \t\n\r\0\x0B,");
+    }
+
+    /**
+     * Returns the set of search operations supported by this object type.
+     *
+     * @return array An array of supported search operations.
+     */
+    static public function getSearchOperations()
+    {
+        $searches = array(
+            'uidForSearch',
+            'uidForId',
+            'uidForMail',
+            'uidForIdOrMail',
+            'uidForAlias',
+            'uidForMailOrAlias',
+            'uidForIdOrMailOrAlias',
+            'mailForIdOrMail',
+            'addrsForIdOrMail',
+        );
+        return $searches;
+    }
+
+    /**
+     * Identify the kolab UID for the first object found using the specified
+     * search criteria.
+     *
+     * @param array $criteria The search parameters as array.
+     * @param int   $restrict A Horde_Kolab_Server::RESULT_* result restriction.
+     *
+     * @return boolean|string|array The UID(s) or false if there was no result.
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    static public function uidForSearch($server, $criteria,
+                                        $restrict = Horde_Kolab_Server_Object::RESULT_SINGLE)
+    {
+        $users = array('field' => self::ATTRIBUTE_OC,
+                       'op'    => '=',
+                       'test'  => self::OBJECTCLASS_KOLABINETORGPERSON);
+        if (!empty($criteria)) {
+            $criteria = array('AND' => array($users, $criteria));
+        } else {
+            $criteria = array('AND' => array($users));
+        }
+        return self::basicUidForSearch($server, $criteria, $restrict);
+    }
+
+    /**
+     * Identify the UID for the first object found with the given ID.
+     *
+     * @param string $id       Search for objects with this ID.
+     * @param int    $restrict A Horde_Kolab_Server::RESULT_* result restriction.
+     *
+     * @return mixed The UID or false if there was no result.
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    static public function uidForId($server, $id,
+                                    $restrict = Horde_Kolab_Server_Object::RESULT_SINGLE)
+    {
+        $criteria = array('AND' => array(array('field' => self::ATTRIBUTE_SID,
+                                               'op'    => '=',
+                                               'test'  => $id),
+                          ),
+        );
+        return self::uidForSearch($server, $criteria, $restrict);
+    }
+
+    /**
+     * Identify the UID for the first user found with the given mail.
+     *
+     * @param string $mail     Search for users with this mail address.
+     * @param int    $restrict A Horde_Kolab_Server::RESULT_* result restriction.
+     *
+     * @return mixed The UID or false if there was no result.
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    static public function uidForMail($server, $mail,
+                               $restrict = Horde_Kolab_Server_Object::RESULT_SINGLE)
+    {
+        $criteria = array('AND' => array(array('field' => self::ATTRIBUTE_MAIL,
+                                               'op'    => '=',
+                                               'test'  => $mail),
+                          ),
+        );
+        return self::uidForSearch($server, $criteria, $restrict);
+    }
+
+    /**
+     * Identify the UID for the first object found with the given ID or mail.
+     *
+     * @param string $id Search for objects with this uid/mail.
+     *
+     * @return string|boolean The UID or false if there was no result.
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    static public function uidForIdOrMail($server, $id)
+    {
+        $criteria = array('OR' =>
+                         array(
+                             array('field' => self::ATTRIBUTE_SID,
+                                   'op'    => '=',
+                                   'test'  => $id),
+                             array('field' => self::ATTRIBUTE_MAIL,
+                                   'op'    => '=',
+                                   'test'  => $id),
+                         ),
+        );
+        return self::uidForSearch($server, $criteria);
+    }
+
+    /**
+     * Identify the UID for the first object found with the given alias.
+     *
+     * @param string $mail     Search for objects with this mail alias.
+     * @param int    $restrict A Horde_Kolab_Server::RESULT_* result restriction.
+     *
+     * @return mixed The UID or false if there was no result.
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    static public function uidForAlias($server, $mail,
+                                $restrict = Horde_Kolab_Server_Object::RESULT_SINGLE)
+    {
+        $criteria = array('AND' => array(array('field' => self::ATTRIBUTE_ALIAS,
+                                               'op'    => '=',
+                                               'test'  => $mail),
+                          ),
+        );
+        return self::uidForSearch($server, $criteria, $restrict);
+    }
+
+    /**
+     * Identify the UID for the first object found with the given mail
+     * address or alias.
+     *
+     * @param string $mail Search for objects with this mail address
+     * or alias.
+     *
+     * @return string|boolean The UID or false if there was no result.
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    static public function uidForMailOrAlias($server, $mail)
+    {
+        $criteria = array('OR' =>
+                         array(
+                             array('field' => self::ATTRIBUTE_ALIAS,
+                                   'op'    => '=',
+                                   'test'  => $mail),
+                             array('field' => self::ATTRIBUTE_MAIL,
+                                   'op'    => '=',
+                                   'test'  => $mail),
+                         )
+        );
+        return self::uidForSearch($server, $criteria);
+    }
+
+    /**
+     * Identify the UID for the first object found with the given ID,
+     * mail or alias.
+     *
+     * @param string $id Search for objects with this ID/mail/alias.
+     *
+     * @return string|boolean The UID or false if there was no result.
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    static public function uidForIdOrMailOrAlias($server, $id)
+    {
+        $criteria = array('OR' =>
+                         array(
+                             array('field' => self::ATTRIBUTE_ALIAS,
+                                   'op'    => '=',
+                                   'test'  => $id),
+                             array('field' => self::ATTRIBUTE_MAIL,
+                                   'op'    => '=',
+                                   'test'  => $id),
+                             array('field' => self::ATTRIBUTE_SID,
+                                   'op'    => '=',
+                                   'test'  => $id),
+                         ),
+        );
+        return self::uidForSearch($server, $criteria);
+    }
+
+    /**
+     * Identify the primary mail attribute for the first object found
+     * with the given ID or mail.
+     *
+     * @param string $id Search for objects with this ID/mail.
+     *
+     * @return mixed The mail address or false if there was no result.
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    static public function mailForIdOrMail($server, $id)
+    {
+        $criteria = array('AND' =>
+                         array(
+                             array('field' => self::ATTRIBUTE_OC,
+                                   'op'    => '=',
+                                   'test'  => self::OBJECTCLASS_KOLABINETORGPERSON),
+                             array('OR' =>
+                                   array(
+                                       array('field' => self::ATTRIBUTE_SID,
+                                             'op'    => '=',
+                                             'test'  => $id),
+                                       array('field' => self::ATTRIBUTE_MAIL,
+                                             'op'    => '=',
+                                             'test'  => $id),
+                                   ),
+                             ),
+                         ),
+        );
+
+        $data = self::attrsForSearch($server, $criteria, array(self::ATTRIBUTE_MAIL),
+                                     self::RESULT_STRICT);
+        if (!empty($data)) {
+            return $data[self::ATTRIBUTE_MAIL][0];
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * Returns a list of allowed email addresses for the given user.
+     *
+     * @param string $id Search for objects with this ID/mail.
+     *
+     * @return array An array of allowed mail addresses.
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    static public function addrsForIdOrMail($server, $id)
+    {
+        $criteria = array('AND' =>
+                         array(
+                             array('field' => self::ATTRIBUTE_OC,
+                                   'op'    => '=',
+                                   'test'  => self::OBJECTCLASS_KOLABINETORGPERSON),
+                             array('OR' =>
+                                   array(
+                                       array('field' => self::ATTRIBUTE_SID,
+                                             'op'    => '=',
+                                             'test'  => $id),
+                                       array('field' => self::ATTRIBUTE_MAIL,
+                                             'op'    => '=',
+                                             'test'  => $id),
+                                   ),
+                             ),
+                         ),
+        );
+
+        $result = self::attrsForSearch($server, $criteria,
+                                       array(self::ATTRIBUTE_MAIL,
+                                             self::ATTRIBUTE_ALIAS),
+                                       self::RESULT_STRICT);
+        if (isset($result[self::ATTRIBUTE_ALIAS])) {
+            $addrs = array_merge((array) $result[self::ATTRIBUTE_MAIL],
+                                 (array) $result[self::ATTRIBUTE_ALIAS]);
+        } else {
+            $addrs = $result[self::ATTRIBUTE_MAIL];
+        }
+
+        if (empty($result)) {
+            return array();
+        }
+        $criteria = array('AND' =>
+                         array(
+                             array('field' => self::ATTRIBUTE_OC,
+                                   'op'    => '=',
+                                   'test'  => self::OBJECTCLASS_KOLABINETORGPERSON),
+                             array('field' => self::ATTRIBUTE_DELEGATE,
+                                   'op'    => '=',
+                                   'test'  => $result[self::ATTRIBUTE_MAIL][0]),
+                         ),
+        );
+
+        $result = self::attrsForSearch($server, $criteria,
+                                       array(self::ATTRIBUTE_MAIL,
+                                             self::ATTRIBUTE_ALIAS),
+                                       self::RESULT_MANY);
+        if (!empty($result)) {
+            foreach ($result as $adr) {
+                if (isset($adr[self::ATTRIBUTE_MAIL])) {
+                    $addrs = array_merge((array) $addrs, (array) $adr[self::ATTRIBUTE_MAIL]);
+                }
+                if (isset($adr[self::ATTRIBUTE_ALIAS])) {
+                    $addrs = array_merge((array) $addrs, (array) $adr[self::ATTRIBUTE_ALIAS]);
+                }
+            }
+        }
+
+        $addrs = array_map('strtolower', $addrs);
+
+        return $addrs;
+    }
+
+}
\ No newline at end of file
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolabsharedfolder.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolabsharedfolder.php
new file mode 100644 (file)
index 0000000..1974fdc
--- /dev/null
@@ -0,0 +1,89 @@
+<?php
+/**
+ * A shared IMAP folder.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * This class provides methods to deal with shared folders
+ * entries for Kolab.
+ *
+ * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Object_Kolabsharedfolder extends Horde_Kolab_Server_Object
+{
+
+    const OBJECTCLASS_KOLABSHAREDFOLDER = 'kolabSharedFolder';
+
+    /**
+     * The ldap classes for this type of object.
+     *
+     * @var array
+     */
+    protected $object_classes = array(
+        self::OBJECTCLASS_TOP,
+        self::OBJECTCLASS_KOLABSHAREDFOLDER,
+    );
+
+    /**
+     * Return the filter string to retrieve this object type.
+     *
+     * @static
+     *
+     * @return string The filter to retrieve this object type from the server
+     *                database.
+     */
+    public static function getFilter()
+    {
+        return '(objectClass=kolabSharedFolder)';
+    }
+
+    /**
+     * Generates an ID for the given information.
+     *
+     * @param array $info The data of the object.
+     *
+     * @static
+     *
+     * @return string|PEAR_Error The ID.
+     */
+    public static function generateId($info)
+    {
+        return trim($info['cn'], " \t\n\r\0\x0B,");
+    }
+
+    /**
+     * Convert the object attributes to a hash.
+     *
+     * @param string $attrs The attributes to return.
+     *
+     * @return array|PEAR_Error The hash representing this object.
+     */
+    public function toHash($attrs = null)
+    {
+        if (!isset($attrs)) {
+            $attrs = array(
+                self::ATTRIBUTE_CN,
+                self::ATTRIBUTE_HOMESERVER,
+                self::ATTRIBUTE_FOLDERTYPE,
+            );
+        }
+        return parent::toHash($attrs);
+    }
+}
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Organizationalperson.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Organizationalperson.php
new file mode 100644 (file)
index 0000000..53be772
--- /dev/null
@@ -0,0 +1,93 @@
+<?php
+/**
+ * An organizational person (objectclass 2.5.6.7).
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * This class provides methods for the organizationalPerson objectclass.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Object_Organizationalperson extends Horde_Kolab_Server_Object_Person
+{
+
+    const ATTRIBUTE_POSTALADDRESS          = 'postalAddress';
+
+    const OBJECTCLASS_ORGANIZATIONALPERSON = 'organizationalPerson';
+
+    /**
+     * The ldap classes for this type of object.
+     *
+     * @var array
+     */
+    protected $object_classes = array(
+        self::OBJECTCLASS_TOP,
+        self::OBJECTCLASS_ORGANIZATIONALPERSON
+    );
+
+    /**
+     * Derive an attribute value.
+     *
+     * @param string $attr The attribute to derive.
+     *
+     * @return mixed The value of the attribute.
+     */
+    protected function derive($attr)
+    {
+        switch ($attr) {
+        case self::ATTRIBUTE_ID:
+            $result = split(',', $this->uid);
+            if (substr($result[0], 0, 3) == 'cn=') {
+                return substr($result[0], 3);
+            } else {
+                return $result[0];
+            }
+        default:
+            return parent::derive($attr);
+        }
+    }
+
+    /**
+     * Generates an ID for the given information.
+     *
+     * @param array $info The data of the object.
+     *
+     * @static
+     *
+     * @return string|PEAR_Error The ID.
+     */
+    public static function generateId($info)
+    {
+        $id_mapfields = array('givenName', 'sn');
+        $id_format    = '%s %s';
+
+        $fieldarray = array();
+        foreach ($id_mapfields as $mapfield) {
+            if (isset($info[$mapfield])) {
+                $fieldarray[] = $info[$mapfield];
+            } else {
+                $fieldarray[] = '';
+            }
+        }
+
+        return trim(vsprintf($id_format, $fieldarray), " \t\n\r\0\x0B,");
+    }
+
+}
\ No newline at end of file
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Person.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Person.php
new file mode 100644 (file)
index 0000000..5ecfbb5
--- /dev/null
@@ -0,0 +1,115 @@
+<?php
+/**
+ * A person (objectclass 2.5.6.6).
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * This class provides methods for the person objectclass.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Object_Person extends Horde_Kolab_Server_Object
+{
+
+    const ATTRIBUTE_CN           = 'cn';
+    const ATTRIBUTE_SN           = 'sn';
+    const ATTRIBUTE_USERPASSWORD = 'userPassword';
+
+    const OBJECTCLASS_PERSON     = 'person';
+
+    /**
+     * The ldap classes for this type of object.
+     *
+     * @var array
+     */
+    protected $object_classes = array(
+        self::OBJECTCLASS_TOP,
+        self::OBJECTCLASS_PERSON
+    );
+
+    /**
+     * Alias names for attributes.
+     *
+     * @var array
+     */
+    protected $attribute_aliases = array(
+        self::ATTRIBUTE_CN => 'commonName',
+        self::ATTRIBUTE_SN => 'surname',
+    );
+
+    /**
+     * The attributes supported by this class
+     *
+     * @var array
+     */
+/*     public $supported_attributes = array( */
+/*         self::ATTRIBUTE_FBPAST, */
+/*     ); */
+
+
+    /**
+     * Derive an attribute value.
+     *
+     * @param string $attr The attribute to derive.
+     *
+     * @return mixed The value of the attribute.
+     */
+    protected function derive($attr)
+    {
+        switch ($attr) {
+        case self::ATTRIBUTE_ID:
+            $result = split(',', $this->uid);
+            if (substr($result[0], 0, 3) == 'cn=') {
+                return substr($result[0], 3);
+            } else {
+                return $result[0];
+            }
+        default:
+            return parent::derive($attr);
+        }
+    }
+
+    /**
+     * Generates an ID for the given information.
+     *
+     * @param array $info The data of the object.
+     *
+     * @static
+     *
+     * @return string|PEAR_Error The ID.
+     */
+    public static function generateId($info)
+    {
+        $id_mapfields = array('givenName', 'sn');
+        $id_format    = '%s %s';
+
+        $fieldarray = array();
+        foreach ($id_mapfields as $mapfield) {
+            if (isset($info[$mapfield])) {
+                $fieldarray[] = $info[$mapfield];
+            } else {
+                $fieldarray[] = '';
+            }
+        }
+
+        return trim(vsprintf($id_format, $fieldarray), " \t\n\r\0\x0B,");
+    }
+
+}
\ No newline at end of file
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/address.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/address.php
deleted file mode 100644 (file)
index 99fb851..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-<?php
-/**
- * An entry in the global addressbook.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * This class provides methods to deal with global address book
- * entries for Kolab.
- *
- * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-class Horde_Kolab_Server_Object_address extends Horde_Kolab_Server_Object_base
-{
-
-    /**
-     * Attributes derived from the LDAP values.
-     *
-     * @var array
-     */
-    public $derived_attributes = array(
-        self::ATTRIBUTE_LNFN,
-        self::ATTRIBUTE_FNLN,
-    );
-
-    /**
-     * The ldap classes for this type of object.
-     *
-     * @var array
-     */
-    protected $object_classes = array(
-        self::OBJECTCLASS_TOP,
-        self::OBJECTCLASS_INETORGPERSON,
-        self::OBJECTCLASS_KOLABINETORGPERSON,
-    );
-
-    /**
-     * Return the filter string to retrieve this object type.
-     *
-     * @static
-     *
-     * @return string The filter to retrieve this object type from the server
-     *                database.
-     */
-    public static function getFilter()
-    {
-        return '(&(objectclass=inetOrgPerson)(!(uid=*))(sn=*))';
-    }
-
-    /**
-     * Convert the object attributes to a hash.
-     *
-     * @param string $attrs The attributes to return.
-     *
-     * @return array|PEAR_Error The hash representing this object.
-     */
-    public function toHash($attrs = null)
-    {
-        if (!isset($attrs)) {
-            $attrs = array(
-                self::ATTRIBUTE_LNFN,
-            );
-        }
-        return parent::toHash($attrs);
-    }
-}
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/administrator.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/administrator.php
deleted file mode 100644 (file)
index ab7c20a..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-<?php
-/**
- * A system administrator.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * This class provides methods to deal with administrator
- * entries for Kolab.
- *
- * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-class Horde_Kolab_Server_Object_administrator extends Horde_Kolab_Server_Object_adminrole
-{
-
-    /**
-     * The group the UID must be member of so that this object really
-     * matches this class type. This may not include the root UID.
-     *
-     * @var string
-     */
-    protected $required_group = 'cn=admin,cn=internal';
-
-    /**
-     * Returns the server url of the given type for this user.
-     *
-     * This method is used to encapsulate multidomain support.
-     *
-     * @param string $server_type The type of server URL that should be returned.
-     *
-     * @return string The server url or empty on error.
-     */
-    public function getServer($server_type)
-    {
-        global $conf;
-
-        switch ($server_type) {
-        case 'homeserver':
-        default:
-            $server = $this->get(self::ATTRIBUTE_HOMESERVER);
-            if (empty($server)) {
-                $server = $_SERVER['SERVER_NAME'];
-            }
-            return $server;
-        }
-    }
-}
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/adminrole.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/adminrole.php
deleted file mode 100644 (file)
index 56147f7..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-<?php
-/**
- * A Kolab object of type administrator.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * This class provides methods to deal with administrator object types.
- *
- * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-class Horde_Kolab_Server_Object_adminrole extends Horde_Kolab_Server_Object_base
-{
-
-    /**
-     * Attributes derived from the LDAP values.
-     *
-     * @var array
-     */
-    public $derived_attributes = array(
-        self::ATTRIBUTE_ID,
-        self::ATTRIBUTE_LNFN,
-    );
-
-    /**
-     * The ldap classes for this type of object.
-     *
-     * @var array
-     */
-    protected $object_classes = array(
-        self::OBJECTCLASS_TOP,
-        self::OBJECTCLASS_INETORGPERSON,
-        self::OBJECTCLASS_KOLABINETORGPERSON,
-    );
-
-    /**
-     * The group the UID must be member of so that this object really
-     * matches this class type. This may not include the root UID.
-     *
-     * @var string
-     */
-    protected $required_group;
-
-    /**
-     * Return the filter string to retrieve this object type.
-     *
-     * @static
-     *
-     * @return string The filter to retrieve this object type from the server
-     *                database.
-     */
-    public static function getFilter()
-    {
-        return '(&(cn=*)(objectClass=inetOrgPerson)(!(uid=manager))(sn=*))';
-    }
-
-    /**
-     * Convert the object attributes to a hash.
-     *
-     * @param string $attrs The attributes to return.
-     *
-     * @return array|PEAR_Error The hash representing this object.
-     */
-    public function toHash($attrs = null)
-    {
-        if (!isset($attrs)) {
-            $attrs = array(
-                self::ATTRIBUTE_SID,
-                self::ATTRIBUTE_LNFN,
-            );
-        }
-        return parent::toHash($attrs);
-    }
-
-    /**
-     * Saves object information.
-     *
-     * @param array $info The information about the object.
-     *
-     * @return boolean|PEAR_Error True on success.
-     */
-    public function save($info)
-    {
-        if (!isset($info['cn'])) {
-            if (!isset($info['sn']) || !isset($info['givenName'])) {
-                return PEAR::raiseError('Either the last name or the given name is missing!');
-            } else {
-                $info['cn'] = $this->generateId($info);
-            }
-        }
-
-        $admins_uid = sprintf('%s,%s', $this->required_group,
-                              $this->db->getBaseUid());
-
-        $admin_group = $this->db->fetch($admins_uid, 'Horde_Kolab_Server_Object_group');
-        if ($admin_group instanceOf PEAR_Error || !$admin_group->exists()) {
-
-            $members = array($this->uid);
-
-            //FIXME: This is not okay and also contains too much LDAP knowledge
-            $parts           = split(',', $this->required_group);
-            list($groupname) = sscanf($parts[0], 'cn=%s');
-
-            $result = $this->db->add(array(self::ATTRIBUTE_CN => $groupname,
-                                           'type' => 'Horde_Kolab_Server_Object_group',
-                                           self::ATTRIBUTE_MEMBER => $members,
-                                           self::ATTRIBUTE_VISIBILITY => false));
-            if ($result instanceOf PEAR_Error) {
-                return $result;
-            }
-        } else {
-            $result = $admin_group->isMember($this->uid);
-            if ($result instanceOf PEAR_Error) {
-                return $result;
-            }
-            if ($result === false) {
-                $members   = $admin_group->getMembers();
-                $members[] = $this->uid;
-                $admin_group->save(array(self::ATTRIBUTE_MEMBER => $members));
-            }
-        }
-        return parent::save($info);
-    }
-
-}
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/base.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/base.php
deleted file mode 100644 (file)
index 9b59e59..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-<?php
-/**
- * A bsaic object representation.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * This class provides basic methods common to all Kolab server objects.
- *
- * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-class Horde_Kolab_Server_Object_base extends Horde_Kolab_Server_Object
-{
-
-    const ATTRIBUTE_SID          = 'uid';
-    const ATTRIBUTE_CN           = 'cn';
-    const ATTRIBUTE_SN           = 'sn';
-    const ATTRIBUTE_GIVENNAME    = 'givenName';
-    const ATTRIBUTE_FN           = 'fn';
-    const ATTRIBUTE_MAIL         = 'mail';
-    const ATTRIBUTE_DELEGATE     = 'kolabDelegate';
-    const ATTRIBUTE_MEMBER       = 'member';
-    const ATTRIBUTE_VISIBILITY   = 'visible';
-    const ATTRIBUTE_LNFN         = 'lnfn';
-    const ATTRIBUTE_FNLN         = 'fnln';
-    const ATTRIBUTE_DOMAIN       = 'domain';
-    const ATTRIBUTE_DELETED      = 'kolabDeleteFlag';
-    const ATTRIBUTE_FBPAST       = 'kolabFreeBusyPast';
-    const ATTRIBUTE_FBFUTURE     = 'kolabFreeBusyFuture';
-    const ATTRIBUTE_FOLDERTYPE   = 'kolabFolderType';
-    const ATTRIBUTE_HOMESERVER   = 'kolabHomeServer';
-    const ATTRIBUTE_FREEBUSYHOST = 'kolabFreeBusyServer';
-    const ATTRIBUTE_IMAPHOST     = 'kolabImapServer';
-    const ATTRIBUTE_IPOLICY      = 'kolabInvitationPolicy';
-
-    const OBJECTCLASS_INETORGPERSON      = 'inetOrgPerson';
-    const OBJECTCLASS_KOLABINETORGPERSON = 'kolabInetOrgPerson';
-    const OBJECTCLASS_HORDEPERSON        = 'hordePerson';
-    const OBJECTCLASS_KOLABGROUPOFNAMES  = 'kolabGroupOfNames';
-    const OBJECTCLASS_KOLABSHAREDFOLDER  = 'kolabSharedFolder';
-
-    /**
-     * The group the UID must be member of so that this object really
-     * matches this class type. This may not include the root UID.
-     *
-     * @var string
-     */
-    protected $required_group;
-
-    /**
-     * The attributes supported by this class
-     *
-     * @var array
-     */
-/*     public $supported_attributes = array( */
-/*         self::ATTRIBUTE_FBPAST, */
-/*     ); */
-
-
-    /**
-     * Derive an attribute value.
-     *
-     * @param string $attr The attribute to derive.
-     *
-     * @return mixed The value of the attribute.
-     */
-    protected function derive($attr)
-    {
-        switch ($attr) {
-        case self::ATTRIBUTE_ID:
-            $result = split(',', $this->uid);
-            if (substr($result[0], 0, 3) == 'cn=') {
-                return substr($result[0], 3);
-            } else {
-                return $result[0];
-            }
-        default:
-            return parent::derive($attr);
-        }
-    }
-
-    /**
-     * Generates an ID for the given information.
-     *
-     * @param array $info The data of the object.
-     *
-     * @static
-     *
-     * @return string|PEAR_Error The ID.
-     */
-    public static function generateId($info)
-    {
-        $id_mapfields = array('givenName', 'sn');
-        $id_format    = '%s %s';
-
-        $fieldarray = array();
-        foreach ($id_mapfields as $mapfield) {
-            if (isset($info[$mapfield])) {
-                $fieldarray[] = $info[$mapfield];
-            } else {
-                $fieldarray[] = '';
-            }
-        }
-
-        return trim(vsprintf($id_format, $fieldarray), " \t\n\r\0\x0B,");
-    }
-
-}
\ No newline at end of file
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/distlist.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/distlist.php
deleted file mode 100644 (file)
index a03d43d..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-/**
- * Representation of a Kolab distribution list.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * This class provides methods to deal with distribution lists for Kolab.
- *
- * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-class Horde_Kolab_Server_Object_distlist extends Horde_Kolab_Server_Object_group
-{
-    /**
-     * Return the filter string to retrieve this object type.
-     *
-     * @static
-     *
-     * @return string The filter to retrieve this object type from the server
-     *                database.
-     */
-    public static function getFilter()
-    {
-        return '(&(objectClass=kolabGroupOfNames)(mail=*))';
-    }
-};
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/domainmaintainer.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/domainmaintainer.php
deleted file mode 100644 (file)
index 37eda13..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-<?php
-/**
- * A Kolab domain maintainer.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * This class provides methods associated to Kolab domain maintainers.
- *
- * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-class Horde_Kolab_Server_Object_domainmaintainer extends Horde_Kolab_Server_Object_adminrole
-{
-
-    /**
-     * Attributes derived from the LDAP values.
-     *
-     * @var array
-     */
-    public $derived_attributes = array(
-        self::ATTRIBUTE_ID,
-        self::ATTRIBUTE_LNFN,
-        self::ATTRIBUTE_DOMAIN,
-    );
-
-    /**
-     * The group the UID must be member of so that this object really
-     * matches this class type. This may not include the root UID.
-     *
-     * @var string
-     */
-    protected $required_group = 'cn=domain-maintainer,cn=internal';
-
-    /**
-     * Convert the object attributes to a hash.
-     *
-     * @param string $attrs The attributes to return.
-     *
-     * @return array|PEAR_Error The hash representing this object.
-     */
-    public function toHash($attrs = null)
-    {
-        if (!isset($attrs)) {
-            $attrs = array(
-                self::ATTRIBUTE_SID,
-                self::ATTRIBUTE_LNFN,
-                self::ATTRIBUTE_DOMAIN,
-            );
-        }
-        return parent::toHash($attrs);
-    }
-
-    /**
-     * Saves object information.
-     *
-     * @param array $info The information about the object.
-     *
-     * @return boolean|PEAR_Error True on success.
-     */
-    public function save($info)
-    {
-        foreach ($info[self::ATTRIBUTE_DOMAIN] as $domain) {
-            $domain_uid = sprintf('cn=%s,cn=domain,cn=internal,%s',
-                                  $domain, $this->db->getBaseUid());
-
-            //FIXME: This should be made easier by the group object
-
-            $domain_group = $this->db->fetch($domain_uid, 'Horde_Kolab_Server_Object_group');
-            if ($domain_group instanceOf PEAR_Error) {
-                return $domain_group;
-            }
-            if (!$domain_group->exists()) {
-                $members = array($this->uid);
-                $domain_group->save(array(self::ATTRIBUTE_CN => $domain,
-                                          self::ATTRIBUTE_MEMBER => $members));
-            } else {
-                $result = $domain_group->isMember($this->uid);
-                if ($result instanceOf PEAR_Error) {
-                    return $result;
-                }
-                if ($result === false) {
-                    $members   = $domain_group->getMembers();
-                    $members[] = $this->uid;
-                    $domain_group->save(array(self::ATTRIBUTE_MEMBER => $members));
-                }
-            }
-        }
-        return parent::save($info);
-    }
-
-}
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/group.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/group.php
deleted file mode 100644 (file)
index 17d35a6..0000000
+++ /dev/null
@@ -1,223 +0,0 @@
-<?php
-/**
- * Representation of a Kolab user group.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * This class provides methods to deal with groups for Kolab.
- *
- * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-class Horde_Kolab_Server_Object_group extends Horde_Kolab_Server_Object_base
-{
-
-    /**
-     * Attributes derived from the LDAP values.
-     *
-     * @var array
-     */
-    public $derived_attributes = array(
-        self::ATTRIBUTE_ID,
-        self::ATTRIBUTE_VISIBILITY,
-    );
-
-    /**
-     * The ldap classes for this type of object.
-     *
-     * @var array
-     */
-    protected $object_classes = array(
-        self::OBJECTCLASS_TOP,
-        self::OBJECTCLASS_INETORGPERSON,
-        self::OBJECTCLASS_KOLABGROUPOFNAMES,
-    );
-
-    /**
-     * Sort by this attributes (must be a LDAP attribute).
-     *
-     * @var string
-     */
-    public $sort_by = self::ATTRIBUTE_MAIL;
-
-    /**
-     * Return the filter string to retrieve this object type.
-     *
-     * @static
-     *
-     * @return string The filter to retrieve this object type from the server
-     *                database.
-     */
-    public static function getFilter()
-    {
-        return '(objectClass=kolabGroupOfNames)';
-    }
-
-    /**
-     * Derive an attribute value.
-     *
-     * @param string $attr The attribute to derive.
-     *
-     * @return mixed The value of the attribute.
-     */
-    protected function derive($attr)
-    {
-        switch ($attr) {
-        case self::ATTRIBUTE_VISIBILITY:
-            return strpos($this->_uid, 'cn=internal') === false;
-        default:
-            return parent::derive($attr);
-        }
-    }
-
-    /**
-     * Convert the object attributes to a hash.
-     *
-     * @param string $attrs The attributes to return.
-     *
-     * @return array|PEAR_Error The hash representing this object.
-     */
-    public function toHash($attrs = null)
-    {
-        if (!isset($attrs)) {
-            $attrs = array(
-                self::ATTRIBUTE_ID,
-                self::ATTRIBUTE_MAIL,
-                self::ATTRIBUTE_VISIBILITY,
-            );
-        }
-        return parent::toHash($attrs);
-    }
-
-    /**
-     * Generates an ID for the given information.
-     *
-     * @param array $info The data of the object.
-     *
-     * @static
-     *
-     * @return string|PEAR_Error The ID.
-     */
-    public static function generateId($info)
-    {
-        if (isset($info['mail'])) {
-            return trim($info['mail'], " \t\n\r\0\x0B,");
-        } else {
-            return trim($info['cn'], " \t\n\r\0\x0B,");
-        }
-    }
-
-    /**
-     * Saves object information.
-     *
-     * @param array $info The information about the object.
-     *
-     * @return boolean|PEAR_Error True on success.
-     */
-    public function save($info)
-    {
-        if (!isset($info['cn'])) {
-            if (!isset($info['mail'])) {
-                throw new Horde_Kolab_Server_Exception('Either the mail address or the common name has to be specified for a group object!');
-            } else {
-                $info['cn'] = $info['mail'];
-            }
-        }
-        return parent::save($info);
-    }
-
-    /**
-     * Retrieve the member list for this group.
-     *
-     * @return array|PEAR_Error The list of members in this group.
-     */
-    public function getMembers()
-    {
-        return $this->_get(self::ATTRIBUTE_MEMBER, false);
-    }
-
-    /**
-     * Add a member to this group.
-     *
-     * @param string $member The UID of the member to add.
-     *
-     * @return array|PEAR_Error True if successful.
-     */
-    public function addMember($member)
-    {
-        $members = $this->getMembers();
-        if (is_a($members, 'PEAR_Error')) {
-            return $members;
-        }
-        if (!in_array($member, $members)) {
-            $this->_cache[self::ATTRIBUTE_MEMBER][] = $member;
-        } else {
-            return PEAR::raiseError(_("The UID %s is already a member of the group %s!"),
-                                    $member, $this->_uid);
-        }
-        return $this->save($this->_cache);
-    }
-
-    /**
-     * Delete a member from this group.
-     *
-     * @param string $member The UID of the member to delete.
-     *
-     * @return array|PEAR_Error True if successful.
-     */
-    public function deleteMember($member)
-    {
-        $members = $this->getMembers();
-        if (is_a($members, 'PEAR_Error')) {
-            return $members;
-        }
-        if (in_array($member, $members)) {
-            $this->_cache[self::ATTRIBUTE_MEMBER] =
-                array_diff($this->_cache[self::ATTRIBUTE_MEMBER],
-                           array($member));
-        } else {
-            return PEAR::raiseError(_("The UID %s is no member of the group %s!"),
-                                    $member, $this->_uid);
-
-        }
-        return $this->save($this->_cache);
-    }
-
-    /**
-     * Is the specified UID member of this group?
-     *
-     * @param string $member The UID of the member to check.
-     *
-     * @return boolean|PEAR_Error True if the UID is a member of the group,
-     *                            false otherwise.
-     */
-    public function isMember($member)
-    {
-        $members = $this->getMembers();
-        if (is_a($members, 'PEAR_Error') || !is_array($members)) {
-            return $members;
-        }
-        if (!in_array($member, $members)) {
-            return false;
-        } else {
-            return true;
-        }
-    }
-
-}
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/maintainer.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/maintainer.php
deleted file mode 100644 (file)
index d1dcb07..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-/**
- * A Kolab maintainer.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * This class provides methods to deal with maintainer
- * entries for Kolab.
- *
- * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-class Horde_Kolab_Server_Object_maintainer extends Horde_Kolab_Server_Object_adminrole
-{
-
-    /**
-     * The group the UID must be member of so that this object really
-     * matches this class type. This may not include the root UID.
-     *
-     * @var string
-     */
-    protected $required_group = 'cn=maintainer,cn=internal';
-
-}
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/server.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/server.php
deleted file mode 100644 (file)
index 8c8702c..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-/**
- * The server configuration.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * This class provides methods to deal with Kolab server configuration.
- *
- * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-class Horde_Kolab_Server_Object_server extends Horde_Kolab_Server_Object_base
-{
-
-    /**
-     * The attributes supported by this class
-     *
-     * @var array
-     */
-    public $supported_attributes = array(
-        self::ATTRIBUTE_FBPAST,
-    );
-
-    /**
-     * Return the filter string to retrieve this object type.
-     *
-     * @static
-     *
-     * @return string The filter to retrieve this object type from the server
-     *                database.
-     */
-    public static function getFilter()
-    {
-        return '(&((k=kolab))(objectclass=kolab))';
-    }
-}
\ No newline at end of file
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/sharedfolder.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/sharedfolder.php
deleted file mode 100644 (file)
index 74195b5..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-<?php
-/**
- * A shared IMAP folder.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * This class provides methods to deal with shared folders
- * entries for Kolab.
- *
- * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-class Horde_Kolab_Server_Object_sharedfolder extends Horde_Kolab_Server_Object_base
-{
-
-    /**
-     * The ldap classes for this type of object.
-     *
-     * @var array
-     */
-    protected $object_classes = array(
-        self::OBJECTCLASS_TOP,
-        self::OBJECTCLASS_KOLABSHAREDFOLDER,
-    );
-
-    /**
-     * Return the filter string to retrieve this object type.
-     *
-     * @static
-     *
-     * @return string The filter to retrieve this object type from the server
-     *                database.
-     */
-    public static function getFilter()
-    {
-        return '(objectClass=kolabSharedFolder)';
-    }
-
-    /**
-     * Generates an ID for the given information.
-     *
-     * @param array $info The data of the object.
-     *
-     * @static
-     *
-     * @return string|PEAR_Error The ID.
-     */
-    public static function generateId($info)
-    {
-        return trim($info['cn'], " \t\n\r\0\x0B,");
-    }
-
-    /**
-     * Convert the object attributes to a hash.
-     *
-     * @param string $attrs The attributes to return.
-     *
-     * @return array|PEAR_Error The hash representing this object.
-     */
-    public function toHash($attrs = null)
-    {
-        if (!isset($attrs)) {
-            $attrs = array(
-                self::ATTRIBUTE_CN,
-                self::ATTRIBUTE_HOMESERVER,
-                self::ATTRIBUTE_FOLDERTYPE,
-            );
-        }
-        return parent::toHash($attrs);
-    }
-}
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/user.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/user.php
deleted file mode 100644 (file)
index cefbf73..0000000
+++ /dev/null
@@ -1,329 +0,0 @@
-<?php
-/**
- * A standard Kolab user.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * This class provides methods to deal with Kolab users stored in
- * the Kolab db.
- *
- * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-class Horde_Kolab_Server_Object_user extends Horde_Kolab_Server_Object_base
-{
-
-    /** Define attributes specific to this object type */
-    const ATTRIBUTE_USERTYPE = 'usertype';
-
-    /** Define the possible Kolab user types */
-    const USERTYPE_STANDARD = 0;
-    const USERTYPE_INTERNAL = 1;
-    const USERTYPE_GROUP    = 2;
-    const USERTYPE_RESOURCE = 3;
-
-    /**
-     * The attributes supported by this class
-     *
-     * @var array
-     */
-    public $supported_attributes = false;
-
-    /**
-     * Attributes derived from the LDAP values.
-     *
-     * @var array
-     */
-    public $derived_attributes = array(
-        self::ATTRIBUTE_FN,
-        'id',
-        'usertype',
-        //FIXME: Do we really want to have this type of functionality within this library?
-        'lnfn',
-        'fnln',
-    );
-
-    /**
-     * The attributes required when creating an object of this class.
-     *
-     * @var array
-     */
-    public $required_attributes = false;
-
-    /**
-     * The ldap classes for this type of object.
-     *
-     * @var array
-     */
-    protected $object_classes = array(
-        self::OBJECTCLASS_TOP,
-        self::OBJECTCLASS_INETORGPERSON,
-        self::OBJECTCLASS_KOLABINETORGPERSON,
-        self::OBJECTCLASS_HORDEPERSON,
-    );
-
-    /**
-     * Initialize the Kolab Object. Provide either the UID or a
-     * LDAP search result.
-     *
-     * @param Horde_Kolab_Server &$db  The link into the Kolab db.
-     * @param string             $dn   UID of the object.
-     * @param array              $data A possible array of data for the object
-     */
-    public function __construct(&$db, $dn = null, $data = null)
-    {
-        global $conf;
-
-        /** Allows to customize the supported user attributes. */
-        if (isset($conf['kolab']['server']['user_supported_attrs'])) {
-            $this->supported_attributes = $conf['kolab']['server']['user_supported_attrs'];
-        }
-
-        /** Allows to customize the required user attributes. */
-        if (isset($conf['kolab']['server']['user_required_attrs'])) {
-            $this->required_attributes = $conf['kolab']['server']['user_required_attrs'];
-        }
-
-        /** Allows to customize the user object classes. */
-        if (isset($conf['kolab']['server']['user_objectclasses'])) {
-            $this->object_classes = $conf['kolab']['server']['user_object_classes'];
-        }
-
-        parent::__construct($db, $dn, $data);
-    }
-
-    /**
-     * Return the filter string to retrieve this object type.
-     *
-     * @static
-     *
-     * @return string The filter to retrieve this object type from the server
-     *                database.
-     */
-    public static function getFilter()
-    {
-        return  '(&(objectClass=kolabInetOrgPerson)(uid=*)(mail=*)(sn=*))';
-    }
-
-    /**
-     * Derive an attribute value.
-     *
-     * @param string $attr The attribute to derive.
-     *
-     * @return mixed The value of the attribute.
-     */
-    protected function derive($attr)
-    {
-        switch ($attr) {
-        case self::ATTRIBUTE_USERTYPE:
-            if (strpos($this->_uid, 'cn=internal')) {
-                return self::USERTYPE_INTERNAL;
-            } else if (strpos($this->_uid, 'cn=group')) {
-                return self::USERTYPE_GROUP;
-            } else if (strpos($this->_uid, 'cn=resource')) {
-                return self::USERTYPE_RESOURCE;
-            } else {
-                return self::USERTYPE_STANDARD;
-            }
-        case self::ATTRIBUTE_LNFN:
-            $gn = $this->_get(self::ATTRIBUTE_GIVENNAME, true);
-            $sn = $this->_get(self::ATTRIBUTE_SN, true);
-            return sprintf('%s, %s', $sn, $gn);
-        case self::ATTRIBUTE_FNLN:
-            $gn = $this->_get(self::ATTRIBUTE_GIVENNAME, true);
-            $sn = $this->_get(self::ATTRIBUTE_SN, true);
-            return sprintf('%s %s', $gn, $sn);
-        case self::ATTRIBUTE_FN:
-            return $this->getFn();
-        default:
-            return parent::derive($attr);
-        }
-    }
-
-    /**
-     * Convert the object attributes to a hash.
-     *
-     * @param string $attrs The attributes to return.
-     *
-     * @return array|PEAR_Error The hash representing this object.
-     */
-    public function toHash($attrs = null)
-    {
-        if (!isset($attrs)) {
-            $attrs = array(
-                self::ATTRIBUTE_SID,
-                self::ATTRIBUTE_FN,
-                self::ATTRIBUTE_MAIL,
-                self::ATTRIBUTE_USERTYPE,
-            );
-        }
-        return parent::toHash($attrs);
-    }
-
-    /**
-     * Get the "first name" attribute of this object
-     *
-     * FIXME: This should get refactored to be combined with the Id value.
-     *
-     * @return string the "first name" of this object
-     */
-    protected function getFn()
-    {
-        $sn = $this->_get(self::ATTRIBUTE_SN, true);
-        $cn = $this->_get(self::ATTRIBUTE_CN, true);
-        return trim(substr($cn, 0, strlen($cn) - strlen($sn)));
-    }
-
-    /**
-     * Get the groups for this object
-     *
-     * @return mixed|PEAR_Error An array of group ids, false if no groups were
-     *                          found.
-     */
-    public function getGroups()
-    {
-        return $this->db->getGroups($this->uid);
-    }
-
-    /**
-     * Returns the server url of the given type for this user.
-     *
-     * This method is used to encapsulate multidomain support.
-     *
-     * @param string $server_type The type of server URL that should be returned.
-     *
-     * @return string The server url or empty on error.
-     */
-    public function getServer($server_type)
-    {
-        global $conf;
-
-        switch ($server_type) {
-        case 'freebusy':
-            $server = $this->get(self::ATTRIBUTE_FREEBUSYHOST);
-            if (!empty($server)) {
-                return $server;
-            }
-            if (isset($conf['kolab']['freebusy']['server'])) {
-                return $conf['kolab']['freebusy']['server'];
-            }
-            $server = $this->getServer('homeserver');
-            if (empty($server)) {
-                $server = $_SERVER['SERVER_NAME'];
-            }
-            if (isset($conf['kolab']['server']['freebusy_url_format'])) {
-                return sprintf($conf['kolab']['server']['freebusy_url_format'],
-                               $server);
-            } else {
-                return 'https://' . $server . '/freebusy';
-            }
-        case 'imap':
-            $server = $this->get(self::ATTRIBUTE_IMAPHOST);
-            if (!empty($server)) {
-                return $server;
-            }
-        case 'homeserver':
-        default:
-            $server = $this->get(self::ATTRIBUTE_HOMESERVER);
-            if (empty($server)) {
-                $server = $_SERVER['SERVER_NAME'];
-            }
-            return $server;
-        }
-    }
-
-    /**
-     * Generates an ID for the given information.
-     *
-     * @param array $info The data of the object.
-     *
-     * @static
-     *
-     * @return string|PEAR_Error The ID.
-     */
-    public static function generateId($info)
-    {
-        global $conf;
-
-        /** The fields that should get mapped into the user ID. */
-        if (isset($conf['kolab']['server']['user_id_mapfields'])) {
-            $id_mapfields = $conf['kolab']['server']['user_id_mapfields'];
-        } else {
-            $id_mapfields = array('givenName', 'sn');
-        }
-
-        /** The user ID format. */
-        if (isset($conf['kolab']['server']['user_id_format'])) {
-            $id_format = $conf['kolab']['server']['user_id_format'];
-        } else {
-            $id_format = '%s %s';
-        }
-
-        $fieldarray = array();
-        foreach ($id_mapfields as $mapfield) {
-            if (isset($info[$mapfield])) {
-                $fieldarray[] = $info[$mapfield];
-            } else {
-                $fieldarray[] = '';
-            }
-        }
-        return trim(vsprintf($id_format, $fieldarray), " \t\n\r\0\x0B,");
-    }
-
-    /**
-     * Saves object information.
-     *
-     * @param array $info The information about the object.
-     *
-     * @return boolean|PEAR_Error True on success.
-     *
-     * @throws Horde_Kolab_Server_Exception If the information to be saved is
-     *                                      invalid.
-     */
-    public function save($info)
-    {
-        if (!isset($info['cn'])) {
-            if (!isset($info['sn']) || !isset($info['givenName'])) {
-                throw new Horde_Kolab_Server_Exception(_("Either the last name or the given name is missing!"));
-            } else {
-                $info['cn'] = $this->generateId($info);
-            }
-        }
-
-        if (isset($conf['kolab']['server']['user_mapping'])) {
-            $mapped = array();
-            $map    = $conf['kolab']['server']['user_mapping'];
-            foreach ($map as $key => $val) {
-                $mapped[$val] = $info[$key];
-            }
-            $info = $mapped;
-        }
-
-        if (isset($conf['kolab']['server']['user_mapping'])) {
-            $mapped = array();
-            $map    = $conf['kolab']['server']['user_mapping'];
-            foreach ($map as $key => $val) {
-                $mapped[$val] = $info[$key];
-            }
-            $info = $mapped;
-        }
-
-        return parent::save($info);
-    }
-};
index 1cff6b7..7a23dcf 100644 (file)
@@ -50,21 +50,27 @@ http://pear.php.net/dtd/package-2.0.xsd">
       <dir name="Server">
        <file name="Exception.php" role="php" />
        <file name="File.php" role="php" />
+       <file name="Kolab.php" role="php" />
        <file name="Ldap.php" role="php" />
        <file name="MissingObjectException.php" role="php" />
        <file name="Object.php" role="php" />
        <dir name="Object">
-        <file name="address.php" role="php" />
-        <file name="administrator.php" role="php" />
-        <file name="adminrole.php" role="php" />
-        <file name="base.php" role="php" />
-        <file name="distlist.php" role="php" />
-        <file name="domainmaintainer.php" role="php" />
-        <file name="group.php" role="php" />
-        <file name="maintainer.php" role="php" />
-        <file name="server.php" role="php" />
-        <file name="sharedfolder.php" role="php" />
-        <file name="user.php" role="php" />
+        <file name="Inetorgperson.php" role="php" />
+        <file name="Kolabgroupofnames.php" role="php" />
+        <file name="Kolabinetorgperson.php" role="php" />
+       <file name="Kolabsharedfolder.php" role="php" />
+        <file name="Organizationalperson.php" role="php" />
+        <file name="Person.php" role="php" />
+        <dir name="Kolab">
+         <file name="Address.php" role="php" />
+         <file name="Administrator.php" role="php" />
+         <file name="Adminrole.php" role="php" />
+         <file name="Distlist.php" role="php" />
+         <file name="Domainmaintainer.php" role="php" />
+         <file name="Maintainer.php" role="php" />
+         <file name="Server.php" role="php" />
+         <file name="User.php" role="php" />
+        </dir> <!-- /lib/Horde/Kolab/Server/Object/Kolab -->
        </dir> <!-- /lib/Horde/Kolab/Server/Object -->
        <file name="Test.php" role="php" />
        <dir name="Test">
@@ -136,20 +142,24 @@ http://pear.php.net/dtd/package-2.0.xsd">
    <install name="lib/Horde/Kolab/Test/Server.php" as="Horde/Kolab/Test/Server.php" />
    <install name="lib/Horde/Kolab/Server/Exception.php" as="Horde/Kolab/Server/Exception.php" />
    <install name="lib/Horde/Kolab/Server/File.php" as="Horde/Kolab/Server/File.php" />
+   <install name="lib/Horde/Kolab/Server/Kolab.php" as="Horde/Kolab/Server/Kolab.php" />
    <install name="lib/Horde/Kolab/Server/Ldap.php" as="Horde/Kolab/Server/Ldap.php" />
    <install name="lib/Horde/Kolab/Server/MissingObjectException.php" as="Horde/Kolab/Server/MissingObjectException.php" />
    <install name="lib/Horde/Kolab/Server/Object.php" as="Horde/Kolab/Server/Object.php" />
-   <install name="lib/Horde/Kolab/Server/Object/address.php" as="Horde/Kolab/Server/Object/address.php" />
-   <install name="lib/Horde/Kolab/Server/Object/administrator.php" as="Horde/Kolab/Server/Object/administrator.php" />
-   <install name="lib/Horde/Kolab/Server/Object/adminrole.php" as="Horde/Kolab/Server/Object/adminrole.php" />
-   <install name="lib/Horde/Kolab/Server/Object/base.php" as="Horde/Kolab/Server/Object/base.php" />
-   <install name="lib/Horde/Kolab/Server/Object/distlist.php" as="Horde/Kolab/Server/Object/distlist.php" />
-   <install name="lib/Horde/Kolab/Server/Object/domainmaintainer.php" as="Horde/Kolab/Server/Object/domainmaintainer.php" />
-   <install name="lib/Horde/Kolab/Server/Object/group.php" as="Horde/Kolab/Server/Object/group.php" />
-   <install name="lib/Horde/Kolab/Server/Object/maintainer.php" as="Horde/Kolab/Server/Object/maintainer.php" />
-   <install name="lib/Horde/Kolab/Server/Object/server.php" as="Horde/Kolab/Server/Object/server.php" />
-   <install name="lib/Horde/Kolab/Server/Object/sharedfolder.php" as="Horde/Kolab/Server/Object/sharedfolder.php" />
-   <install name="lib/Horde/Kolab/Server/Object/user.php" as="Horde/Kolab/Server/Object/user.php" />
+   <install name="lib/Horde/Kolab/Server/Object/Inetorgperson.php" as="Horde/Kolab/Server/Object/Inetorgperson.php" />
+   <install name="lib/Horde/Kolab/Server/Object/Kolabgroupofnames.php" as="Horde/Kolab/Server/Object/Kolabgroupofnames.php" />
+   <install name="lib/Horde/Kolab/Server/Object/Kolabinetorgperson.php" as="Horde/Kolab/Server/Object/Kolabinetorgperson.php" />
+   <install name="lib/Horde/Kolab/Server/Object/Kolabsharedfolder.php" as="Horde/Kolab/Server/Object/Kolabsharedfolder.php" />
+   <install name="lib/Horde/Kolab/Server/Object/Kolab/Address.php" as="Horde/Kolab/Server/Object/Kolab/Address.php" />
+   <install name="lib/Horde/Kolab/Server/Object/Kolab/Administrator.php" as="Horde/Kolab/Server/Object/Kolab/Administrator.php" />
+   <install name="lib/Horde/Kolab/Server/Object/Kolab/Adminrole.php" as="Horde/Kolab/Server/Object/Kolab/Adminrole.php" />
+   <install name="lib/Horde/Kolab/Server/Object/Kolab/Distlist.php" as="Horde/Kolab/Server/Object/Kolab/Distlist.php" />
+   <install name="lib/Horde/Kolab/Server/Object/Kolab/Domainmaintainer.php" as="Horde/Kolab/Server/Object/Kolab/Domainmaintainer.php" />
+   <install name="lib/Horde/Kolab/Server/Object/Kolab/Maintainer.php" as="Horde/Kolab/Server/Object/Kolab/Maintainer.php" />
+   <install name="lib/Horde/Kolab/Server/Object/Kolab/Server.php" as="Horde/Kolab/Server/Object/Kolab/Server.php" />
+   <install name="lib/Horde/Kolab/Server/Object/Kolab/User.php" as="Horde/Kolab/Server/Object/Kolab/User.php" />
+   <install name="lib/Horde/Kolab/Server/Object/Organizationalperson.php" as="Horde/Kolab/Server/Object/Organizationalperson.php" />
+   <install name="lib/Horde/Kolab/Server/Object/Person.php" as="Horde/Kolab/Server/Object/Person.php" />
    <install name="lib/Horde/Kolab/Server/Test.php" as="Horde/Kolab/Server/Test.php" />
    <install name="lib/Horde/Kolab/Server/Test/Search.php" as="Horde/Kolab/Server/Test/Search.php" />
    <install name="test/Horde/Kolab/Server/AddingObjectsTest.php" as="Horde/Kolab/Server/AddingObjectsTest.php" />