Changeset View
Changeset View
Standalone View
Standalone View
lib/api/kolab_api_service_domain.php
Show First 20 Lines • Show All 168 Lines • ▼ Show 20 Lines | public function domain_edit($getdata, $postdata) | ||||
&& !$auth->domain_is_empty($domain) | && !$auth->domain_is_empty($domain) | ||||
) { | ) { | ||||
throw new kolab_api_exception(kolab_api_exception::DOMAIN_NOT_EMPTY); | throw new kolab_api_exception(kolab_api_exception::DOMAIN_NOT_EMPTY); | ||||
} | } | ||||
} | } | ||||
$attributes = $this->parse_input_attributes('domain', $postdata, $postdata['type_id']); | $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']); | $result = $auth->domain_edit($postdata['id'], $attributes, $postdata['type_id']); | ||||
if ($result) { | if ($result) { | ||||
return $result; | return $result; | ||||
} | } | ||||
return false; | return false; | ||||
▲ Show 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | public function domain_info($getdata, $postdata) | ||||
} | } | ||||
return false; | return false; | ||||
} | } | ||||
/** | /** | ||||
* Modify hosted domain attributes | * 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 | // Generate attributes (aci, inetdomainbasedn) for hosted domains | ||||
$conf = Conf::get_instance(); | $conf = Conf::get_instance(); | ||||
if ($conf->get('kolab_wap', 'hosted_root_dn')) { | if ($conf->get('kolab_wap', 'hosted_root_dn')) { | ||||
$domain_name_attribute = $conf->get('ldap', 'domain_name_attribute'); | $domain_name_attribute = $conf->get('ldap', 'domain_name_attribute'); | ||||
$hosted_root_dn = $conf->get('kolab_wap', 'hosted_root_dn'); | $hosted_root_dn = $conf->get('kolab_wap', 'hosted_root_dn'); | ||||
$mgmt_root_dn = $conf->get('kolab_wap', 'mgmt_root_dn'); | $mgmt_root_dn = $conf->get('kolab_wap', 'mgmt_root_dn'); | ||||
Show All 33 Lines | protected function _mod_domain_attrs($domain, &$attributes, $olddn = null) | ||||
. 'ldap:///ou=People,' . $domain_root_dn . '??sub?(objectclass=inetorgperson)");)', | . 'ldap:///ou=People,' . $domain_root_dn . '??sub?(objectclass=inetorgperson)");)', | ||||
'(targetattr = "*")' | '(targetattr = "*")' | ||||
. '(version 3.0;acl "Kolab Administrators";allow (all)' | . '(version 3.0;acl "Kolab Administrators";allow (all)' | ||||
. '(roledn = "ldap:///cn=kolab-admin,' . $domain_root_dn . ' || ' | . '(roledn = "ldap:///cn=kolab-admin,' . $domain_root_dn . ' || ' | ||||
. 'ldap:///cn=kolab-admin,' . $mgmt_root_dn . '");)' | . 'ldap:///cn=kolab-admin,' . $mgmt_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; | $attributes['aci'] = $aci; | ||||
if (!empty($domain_root_dn)) { | |||||
$attributes['inetdomainbasedn'] = $domain_root_dn; | $attributes['inetdomainbasedn'] = $domain_root_dn; | ||||
} | |||||
$this->is_hosted = true; | $this->is_hosted = true; | ||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* Create LDAP object related to the new hosted domain | * Create LDAP object related to the new hosted domain | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 82 Lines • Show Last 20 Lines |