summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/api/kolab_api_service_domain.php31
1 files changed, 27 insertions, 4 deletions
diff --git a/lib/api/kolab_api_service_domain.php b/lib/api/kolab_api_service_domain.php
index 9781eeb..8803109 100644
--- a/lib/api/kolab_api_service_domain.php
+++ b/lib/api/kolab_api_service_domain.php
@@ -174,7 +174,7 @@ class kolab_api_service_domain extends kolab_api_service
$attributes = $this->parse_input_attributes('domain', $postdata, $postdata['type_id']);
- $this->_mod_domain_attrs(null, $attributes);
+ $this->_mod_domain_attrs(null, $attributes, $postdata['id']);
$result = $auth->domain_edit($postdata['id'], $attributes, $postdata['type_id']);
@@ -278,7 +278,7 @@ class kolab_api_service_domain extends kolab_api_service
/**
* Modify hosted domain attributes
*/
- protected function _mod_domain_attrs($domain, &$attributes)
+ protected function _mod_domain_attrs($domain, &$attributes, $olddn = null)
{
// Generate attributes (aci, inetdomainbasedn) for hosted domains
$conf = Conf::get_instance();
@@ -328,8 +328,31 @@ class kolab_api_service_domain extends kolab_api_service
. 'ldap:///cn=kolab-admin,' . $mgmt_root_dn . '");)'
);
- $attributes['aci'] = $aci;
- $attributes['inetdomainbasedn'] = $domain_root_dn;
+ // Preserve important old aci and inetdomainbasedn attributes of the
+ // management and hosted domain.
+ if (!empty($olddn)) {
+ $auth = Auth::get_instance();
+ $info = $auth->domain_info($olddn);
+ if (!empty($info)) {
+ $oldattributes = reset($info);
+ if (!empty($oldattributes['inetdomainbasedn'])
+ && $oldattributes['inetdomainbasedn'] == $hosted_root_dn
+ || "dc=".implode(",dc=",explode(".",$domain)) == $mgmt_root_dn
+ ) {
+ $aci = $oldattributes['aci'];
+ if (!empty($oldattributes['inetdomainbasedn'])) {
+ $domain_root_dn = $oldattributes['inetdomainbasedn'];
+ } else {
+ $domain_root_dn = null;
+ }
+ }
+ }
+ }
+
+ $attributes['aci'] = $aci;
+ if (!empty($domain_root_dn)) {
+ $attributes['inetdomainbasedn'] = $domain_root_dn;
+ }
$this->is_hosted = true;
}