lib/api lib/Auth
Aleksander Machniak
machniak at kolabsys.com
Thu Feb 27 15:29:17 CET 2014
lib/Auth/LDAP.php | 6 +++---
lib/api/kolab_api_service_domain.php | 20 +++++++++++++++-----
2 files changed, 18 insertions(+), 8 deletions(-)
New commits:
commit 8e09ba6962f63bfcb0dcd6eee92250b352bec895
Author: Aleksander Machniak <machniak at kolabsys.com>
Date: Thu Feb 27 15:28:44 2014 +0100
Return ID also in domain.add response
diff --git a/lib/Auth/LDAP.php b/lib/Auth/LDAP.php
index 898a60d..25bef97 100644
--- a/lib/Auth/LDAP.php
+++ b/lib/Auth/LDAP.php
@@ -178,9 +178,9 @@ class LDAP extends Net_LDAP3 {
array_unshift($attributes[$domain_name_attribute], $domain);
}
- $dn = $domain_name_attribute . '=' . $domain . ',' . $domain_base_dn;
+ $domain_dn = $domain_name_attribute . '=' . $domain . ',' . $domain_base_dn;
- $result = $this->add_entry($dn, $attributes);
+ $result = $this->add_entry($domain_dn, $attributes);
if (!$result) {
return false;
@@ -369,7 +369,7 @@ class LDAP extends Net_LDAP3 {
$this->add_entry($dn, $attrs);
}
- return true;
+ return $domain_dn;
}
public function domain_edit($domain, $attributes, $typeid = null)
diff --git a/lib/api/kolab_api_service_domain.php b/lib/api/kolab_api_service_domain.php
index 711b37b..6b82d0d 100644
--- a/lib/api/kolab_api_service_domain.php
+++ b/lib/api/kolab_api_service_domain.php
@@ -77,7 +77,7 @@ class kolab_api_service_domain extends kolab_api_service
Log::trace("domain.add(\$getdata = " . var_export($getdata, TRUE) . ", \$postdata = " . var_export($postdata, TRUE) . ")");
$conf = Conf::get_instance();
- $dna = $conf->get('domain_name_attribute');
+ $dna = $conf->get('domain_name_attribute');
if (empty($dna)) {
$dna = 'associateddomain';
@@ -91,11 +91,21 @@ class kolab_api_service_domain extends kolab_api_service
$auth = Auth::get_instance($conf->get('kolab', 'primary_domain'));
// parse input attributes
- $domain_attributes = $this->parse_input_attributes('domain', $postdata);
- $domain_attributes[$dna] = (array)$domain_attributes[$dna];
- $domain = array_shift($domain_attributes[$dna]);
+ $attributes = $this->parse_input_attributes('domain', $postdata);
+ $attributes[$dna] = (array) $attributes[$dna];
+ $domain = array_shift($attributes[$dna]);
+
+ $result = $auth->domain_add($domain, $attributes);
+
+ if ($result) {
+ if ($id = $this->unique_attribute_value($result)) {
+ $attributes['id'] = $id;
+ }
+
+ return $attributes;
+ }
- return $auth->domain_add($domain, $domain_attributes);
+ return false;
}
/**
More information about the commits
mailing list