summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-12-27 18:18:26 (GMT)
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-12-27 18:21:22 (GMT)
commitaa565f6d71292bb5b3dd545da2075a38e74c53cd (patch)
tree33dc7b004401eeea57e48bb45c51ca94514f92f5
parentdb839380bd42cacb522e288e596720c9a77edaeb (diff)
downloadkolab-wap-aa565f6d71292bb5b3dd545da2075a38e74c53cd.tar.gz
Correct detecting the base dn for subjects (object's key/type) that are being added. Adding a domain in the web administration panel now functionally does not require adding a section in the kolab.conf configuration file any longer.
-rw-r--r--lib/Auth.php5
-rw-r--r--lib/Auth/LDAP.php19
-rw-r--r--lib/api/kolab_api_service_form_value.php10
3 files changed, 16 insertions, 18 deletions
diff --git a/lib/Auth.php b/lib/Auth.php
index 26f1d0b..a2a9907 100644
--- a/lib/Auth.php
+++ b/lib/Auth.php
@@ -397,6 +397,11 @@ class Auth {
return call_user_func_array(Array($this->auth_instance(), 'search'), func_get_args());
}
+ public function subject_base_dn($subject)
+ {
+ return $this->auth_instance()->subject_base_dn($subject);
+ }
+
public function user_add($attributes, $typeid = null)
{
return $this->auth_instance()->user_add($attributes, $typeid);
diff --git a/lib/Auth/LDAP.php b/lib/Auth/LDAP.php
index 15b3057..bcf2176 100644
--- a/lib/Auth/LDAP.php
+++ b/lib/Auth/LDAP.php
@@ -542,6 +542,11 @@ class LDAP extends Net_LDAP3 {
return parent::search($base_dn, $filter, $scope, $sort, $search);
}
+ public function subject_base_dn($subject)
+ {
+ return $this->_subject_base_dn($subject);
+ }
+
public function user_add($attrs, $typeid = null)
{
$base_dn = $this->entry_base_dn('user', $typeid);
@@ -1217,10 +1222,6 @@ class LDAP extends Net_LDAP3 {
*/
private function domain_root_dn($domain)
{
- if (!empty($this->domain_root_dn)) {
- return $this->domain_root_dn;
- }
-
if (!$this->connect()) {
$this->_log(LOG_DEBUG, "Could not connect");
return false;
@@ -1257,22 +1258,22 @@ class LDAP extends Net_LDAP3 {
if (is_array($entry_attrs)) {
if (in_array('inetdomainbasedn', $entry_attrs) && !empty($entry_attrs['inetdomainbasedn'])) {
- $this->domain_root_dn = $entry_attrs['inetdomainbasedn'];
+ $domain_root_dn = $entry_attrs['inetdomainbasedn'];
}
else {
if (is_array($entry_attrs[$domain_name_attribute])) {
- $this->domain_root_dn = $this->_standard_root_dn($entry_attrs[$domain_name_attribute][0]);
+ $domain_root_dn = $this->_standard_root_dn($entry_attrs[$domain_name_attribute][0]);
}
else {
- $this->domain_root_dn = $this->_standard_root_dn($entry_attrs[$domain_name_attribute]);
+ $domain_root_dn = $this->_standard_root_dn($entry_attrs[$domain_name_attribute]);
}
}
}
else {
- $this->domain_root_dn = $this->_standard_root_dn($domain);
+ $domain_root_dn = $this->_standard_root_dn($domain);
}
- return $this->domain_root_dn;
+ return $domain_root_dn;
}
diff --git a/lib/api/kolab_api_service_form_value.php b/lib/api/kolab_api_service_form_value.php
index b9fd055..7536340 100644
--- a/lib/api/kolab_api_service_form_value.php
+++ b/lib/api/kolab_api_service_form_value.php
@@ -980,15 +980,7 @@ class kolab_api_service_form_value extends kolab_api_service
$object_type = $postdata['object_type'];
$object_key = $postdata['type_key'];
- if ($object_key && $object_type) {
- $base_dn = $conf->get($object_key . '_' . $object_type . '_base_dn');
- }
- if (!$base_dn && $object_type) {
- $base_dn = $conf->get($object_type . '_base_dn');
- }
- if (!$base_dn) {
- $base_dn = $conf->get('base_dn');
- }
+ $base_dn = $auth->subject_base_dn($object_key . '_' . $object_type);
if (!empty($postdata['id'])) {
$subjects = $auth->search($base_dn, '(' . $unique_attr . '=' . $postdata['id'] . ')')->entries(true);