From b5e349484b4499ae0aba7de9f095a7bcf02e80cb Mon Sep 17 00:00:00 2001
From: "Jens-U. Mozdzen" <jmozdzen@nde.ag>
Date: Wed, 21 Nov 2012 15:26:28 +0100
Subject: [PATCH 2/2] group driver "kolab" polished up, renamed to
 "Horde_Core_Factory_Group" and added mysteriously
 required Include_once() to be able to use that class...


Signed-off-by: Jens-U. Mozdzen <jmozdzen@nde.ag>
---
 framework/Core/lib/Horde/Core/Factory/Group.php |    3 ++
 framework/Group/lib/Horde/Group/Kolab.php       |   24 ++++++++++++++++++----
 2 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/framework/Core/lib/Horde/Core/Factory/Group.php b/framework/Core/lib/Horde/Core/Factory/Group.php
index fd756ac..9148220 100644
--- a/framework/Core/lib/Horde/Core/Factory/Group.php
+++ b/framework/Core/lib/Horde/Core/Factory/Group.php
@@ -3,6 +3,9 @@
  * @category Horde
  * @package  Core
  */
+
+Include_once( '/usr/share/php5/PEAR/Horde/Group/Kolab.php');
+
 class Horde_Core_Factory_Group extends Horde_Core_Factory_Injector
 {
     public function create(Horde_Injector $injector)
diff --git a/framework/Group/lib/Horde/Group/Kolab.php b/framework/Group/lib/Horde/Group/Kolab.php
index cb5d9e7..71233e7 100644
--- a/framework/Group/lib/Horde/Group/Kolab.php
+++ b/framework/Group/lib/Horde/Group/Kolab.php
@@ -13,21 +13,20 @@
  * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
  * @package  Group
  */
-class Horde_Group_Kolab extends Horde_Group_Ldap
+class Horde_Core_Group_Kolab extends Horde_Group_Ldap
 {
     /**
      * Constructor.
      *
      * @throws Horde_Group_Exception
      */
-    /*
     public function __construct($params)
     {
         $this->_params = array(
             'hostspec' => $GLOBALS['conf']['kolab']['ldap']['server'],
             'basedn' => $GLOBALS['conf']['kolab']['ldap']['basedn'],
             'binddn' => $GLOBALS['conf']['kolab']['ldap']['phpdn'],
-            'password' => $GLOBALS['conf']['kolab']['ldap']['phppw'],
+            'bindpw' => $GLOBALS['conf']['kolab']['ldap']['phppw'],
             'version' => 3,
             'gid' => 'cn',
             'memberuid' => 'member',
@@ -37,9 +36,24 @@ class Horde_Group_Kolab extends Horde_Group_Ldap
             'newgroup_objectclass' => 'kolabGroupOfNames'
         );
 
-        $this->_filter = 'objectclass=' . $this->_params['objectclass'];
+        /* Lowercase attribute names. */
+        $this->_params['gid']       = Horde_String::lower($this->_params['gid']);
+        $this->_params['memberuid'] = Horde_String::lower($this->_params['memberuid']);
+
+        /* Generate LDAP search filter. */
+        try {
+            $this->_filter = Horde_Ldap_Filter::create( 'objectclass', 'equals', $this->_params['objectclass']);
+        } catch (Horde_Ldap_Exception $e) {
+            throw new Horde_Group_Exception($e);
+        }
+
+        /* Set Horde_Ldap object. */
+        $this->_ldap = new Horde_Ldap( $this->_params);
+
+        unset($params['ldap']);
+
+        $this->_params = $params;
     }
-    */
 
     /**
      * Returns a list of groups a user belongs to.
-- 
1.7.7