lib/api lib/Auth

Jeroen van Meeuwen vanmeeuwen at kolabsys.com
Tue Aug 12 12:04:49 CEST 2014


 lib/Auth/LDAP.php                      |    8 +++++++-
 lib/api/kolab_api_service_resource.php |    8 ++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

New commits:
commit 45ba054788f5951d8812fea6e9e4647fd7b7d114
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Tue Aug 12 12:03:57 2014 +0200

    Fix the parent location for OUs

diff --git a/lib/Auth/LDAP.php b/lib/Auth/LDAP.php
index 0c03be0..1ca5764 100644
--- a/lib/Auth/LDAP.php
+++ b/lib/Auth/LDAP.php
@@ -780,7 +780,13 @@ class LDAP extends Net_LDAP3 {
 
     public function resource_add($attrs, $typeid = null)
     {
-        $base_dn = $this->entry_base_dn('resource', $typeid);
+        if (!empty($attrs['ou'])) {
+            $base_dn = $attrs['ou'];
+            unset($attrs['ou']);
+        }
+        else {
+            $base_dn = $this->entry_base_dn('resource', $typeid);
+        }
 
         // TODO: The rdn is configurable as well.
         // Use [$type_str . "_"]resource_rdn_attr
diff --git a/lib/api/kolab_api_service_resource.php b/lib/api/kolab_api_service_resource.php
index 7fa454b..e3d6de1 100644
--- a/lib/api/kolab_api_service_resource.php
+++ b/lib/api/kolab_api_service_resource.php
@@ -175,6 +175,14 @@ class kolab_api_service_resource extends kolab_api_service
         // normalize result
         $result = $this->parse_result_attributes('resource', $result);
 
+        if (empty($result['ou'])) {
+            $dn = ldap_explode_dn($result['entrydn'], 0);
+            // pop the count and rdn
+            unset($dn['count']);
+            unset($dn[0]);
+            $result['ou'] = implode(',', $dn);
+        }
+
         if ($result) {
             return $result;
         }




More information about the commits mailing list