summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2014-08-12 10:03:57 (GMT)
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2014-08-12 10:04:45 (GMT)
commit45ba054788f5951d8812fea6e9e4647fd7b7d114 (patch)
tree8b334e0368ddaaf2ef658df73c1cc5733aee52f1
parentd36ca8c73eb66d6f65a90cdd71080e3ec67a71fa (diff)
downloadkolab-wap-45ba054788f5951d8812fea6e9e4647fd7b7d114.tar.gz
Fix the parent location for OUs
-rw-r--r--lib/Auth/LDAP.php8
-rw-r--r--lib/api/kolab_api_service_resource.php8
2 files changed, 15 insertions, 1 deletions
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;
}