summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-04-08 17:03:40 +0200
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-04-08 17:03:40 +0200
commit745d1e86142e50231ccead6095bb5c427e376af6 (patch)
tree465dda16087245adb1426a97b996259b3ad319d4
parentedf09ae570e8adf804154794a9fc86f8f050a864 (diff)
downloadwebadmin-745d1e86142e50231ccead6095bb5c427e376af6.tar.gz
Set the default OU for adding new users
-rw-r--r--lib/api/kolab_api_service_form_value.php22
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/api/kolab_api_service_form_value.php b/lib/api/kolab_api_service_form_value.php
index 694a1d8..0bf12a2 100644
--- a/lib/api/kolab_api_service_form_value.php
+++ b/lib/api/kolab_api_service_form_value.php
@@ -623,16 +623,16 @@ class kolab_api_service_form_value extends kolab_api_service
$base_dn = $conf->get('base_dn');
}
- $subject = $auth->search($base_dn, '(' . $unique_attr . '=' . $postdata['id'] . ')');
-
- $subject_dn = $subject[0];
-
- $subject_dn_components = ldap_explode_dn($subject_dn, 0);
- unset($subject_dn_components['count']);
-
- array_shift($subject_dn_components);
-
- $subject_parent_ou = strtolower(implode(',', $subject_dn_components));
+ if (!empty($postdata['id'])) {
+ $subject = $auth->search($base_dn, '(' . $unique_attr . '=' . $postdata['id'] . ')');
+ $subject_dn = $subject[0];
+ $subject_dn_components = ldap_explode_dn($subject_dn, 0);
+ unset($subject_dn_components['count']);
+ array_shift($subject_dn_components);
+ $default = strtolower(implode(',', $subject_dn_components));
+ } else {
+ $default = $base_dn;
+ }
$ous = $auth->search($base_dn, '(objectclass=organizationalunit)');
@@ -644,7 +644,7 @@ class kolab_api_service_form_value extends kolab_api_service
sort($_ous);
- $_ous['default'] = $subject_parent_ou;
+ $_ous['default'] = strtolower($default);
return $_ous;
}