summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2015-06-18 12:45:35 +0200
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2015-06-18 12:45:35 +0200
commit2719b480959d7a7bba0df95ab73cacfe96feb9ea (patch)
tree2cfd5db78064f47f0375b315b4f4cb9466200784 /lib
parentbc42856017200d85a2cc3ce8d2c91cdb243f203a (diff)
downloadwebadmin-2719b480959d7a7bba0df95ab73cacfe96feb9ea.tar.gz
Compare the configured base DNs of domains that are visible as to be able to associate child domain name spaces with parent domain name spaces.
Summary: Domain validation: Consider child domains by comparing base DNs Test Plan: No particular test plan in particular Reviewers: #web_administration_panel_developers, machniak Reviewed By: #web_administration_panel_developers, machniak Subscribers: dhoffend, machniak, pokorra Maniphest Tasks: T435 Differential Revision: https://git.kolab.org/D10
Diffstat (limited to 'lib')
-rw-r--r--lib/api/kolab_api_service_form_value.php31
1 files changed, 28 insertions, 3 deletions
diff --git a/lib/api/kolab_api_service_form_value.php b/lib/api/kolab_api_service_form_value.php
index 56074bb..7976780 100644
--- a/lib/api/kolab_api_service_form_value.php
+++ b/lib/api/kolab_api_service_form_value.php
@@ -1594,6 +1594,12 @@ class kolab_api_service_form_value extends kolab_api_service
return $valid;
}
+ /**
+ * Lists the valid domains given a primary domain name space.
+ *
+ * Includes the parent domain and any alias or child domains.
+ * Considers domains that point to the same base dn to be child domains.
+ */
private function _get_valid_domains($my_primary_domain = null)
{
$my_primary_domain = $my_primary_domain !== null
@@ -1604,10 +1610,11 @@ class kolab_api_service_form_value extends kolab_api_service
$conf = Conf::get_instance();
$all_domains = $auth->list_domains();
$all_domains = $all_domains['list'];
+ $all_basedns = Array();
$dna = $conf->get('domain_name_attribute');
+ $dra = $conf->get('domain_rootdn_attribute');
- Log::trace("__get_valid_domains( " . $my_primary_domain . ")");
- Log::trace("\$all_domains includes: " . var_export($all_domains, TRUE) . " (must include domain for \$my_primary_domain)");
+ Log::trace("_get_valid_domains(" . $my_primary_domain . ")");
$valid_domains = $my_primary_domain ? array($my_primary_domain) : array();
foreach ($all_domains as $domain_id => $domain_attrs) {
@@ -1618,9 +1625,27 @@ class kolab_api_service_form_value extends kolab_api_service
if (in_array($my_primary_domain, $domain_attrs[$dna])) {
$valid_domains = array_merge($valid_domains, $domain_attrs[$dna]);
}
+
+ if (array_key_exists($dra, $domain_attrs)) {
+ if (array_key_exists($domain_attrs[$dra], $all_basedns)) {
+ $all_basedns[$domain_attrs[$dra]] = array_merge($all_basedns[$domain_attrs[$dra]], $domain_attrs[$dna]);
+ } else {
+ $all_basedns[$domain_attrs[$dra]] = $domain_attrs[$dna];
+ }
+ }
}
- return array_unique($valid_domains);
+ foreach ($all_basedns as $base_dn => $domains) {
+ if (in_array($my_primary_domain, $domains)) {
+ $valid_domains = array_merge($valid_domains, $domains);
+ }
+ }
+
+ $result = array_unique($valid_domains);
+
+ Log::trace("_get_valid_domains result: " . var_export($result, TRUE));
+
+ return array_unique($result);
}
private function _validate_email_address_in_any_of_my_domains($mail_address)