summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2014-09-04 17:50:41 (GMT)
committerAleksander Machniak <machniak@kolabsys.com>2014-09-04 17:50:41 (GMT)
commit5891dec809b989badbbd4c4901998e8d55f1d8d5 (patch)
tree5056340fb12d30dbc98aee5a7ad67ef633fb42bc
parent7c810d56e2acfd438805f3ba93e8a428ea7d8b59 (diff)
downloadkolab-wap-5891dec809b989badbbd4c4901998e8d55f1d8d5.tar.gz
Unify *.info and *.find commands result (#3155)
+ Small code cleanup
-rw-r--r--lib/api/kolab_api_service_group.php9
-rw-r--r--lib/api/kolab_api_service_ou.php1
-rw-r--r--lib/api/kolab_api_service_resource.php20
-rw-r--r--lib/api/kolab_api_service_role.php7
-rw-r--r--lib/api/kolab_api_service_sharedfolder.php4
-rw-r--r--lib/api/kolab_api_service_user.php11
-rw-r--r--lib/kolab_api_service.php9
7 files changed, 14 insertions, 47 deletions
diff --git a/lib/api/kolab_api_service_group.php b/lib/api/kolab_api_service_group.php
index b9eed47..ebcd43e 100644
--- a/lib/api/kolab_api_service_group.php
+++ b/lib/api/kolab_api_service_group.php
@@ -121,7 +121,6 @@ class kolab_api_service_group extends kolab_api_service
//console("group_edit \$postdata", $postdata);
$group_attributes = $this->parse_input_attributes('group', $postdata);
- $group = $postdata['id'];
$auth = Auth::get_instance();
$result = $auth->group_edit($postdata['id'], $group_attributes, $postdata['type_id']);
@@ -163,14 +162,6 @@ class kolab_api_service_group extends kolab_api_service
Log::trace("group_info() result: " . var_export($result, TRUE));
- if (empty($result['ou'])) {
- $dn = ldap_explode_dn($result['entrydn'], 0);
- // pop the count and rdn
- unset($dn['count']);
- unset($dn[0]);
- $result['ou'] = implode(',', $dn);
- }
-
if ($result) {
return $result;
}
diff --git a/lib/api/kolab_api_service_ou.php b/lib/api/kolab_api_service_ou.php
index cd4fa28..4afbf67 100644
--- a/lib/api/kolab_api_service_ou.php
+++ b/lib/api/kolab_api_service_ou.php
@@ -117,7 +117,6 @@ class kolab_api_service_ou extends kolab_api_service
public function ou_edit($getdata, $postdata)
{
$unit_attributes = $this->parse_input_attributes('ou', $postdata);
- $unit = $postdata['id'];
$auth = Auth::get_instance();
$result = $auth->organizationalunit_edit($postdata['id'], $unit_attributes, $postdata['type_id']);
diff --git a/lib/api/kolab_api_service_resource.php b/lib/api/kolab_api_service_resource.php
index 8c65e20..55c93de 100644
--- a/lib/api/kolab_api_service_resource.php
+++ b/lib/api/kolab_api_service_resource.php
@@ -124,10 +124,8 @@ class kolab_api_service_resource extends kolab_api_service
//console("\$resource_attributes as result from parse_input_attributes", $resource_attributes);
- $resource = $postdata['id'];
-
$auth = Auth::get_instance();
- $result = $auth->resource_edit($resource, $resource_attributes, $postdata['type_id']);
+ $result = $auth->resource_edit($postdata['id'], $resource_attributes, $postdata['type_id']);
// Return the $mod_array
if ($result) {
@@ -175,14 +173,6 @@ class kolab_api_service_resource extends kolab_api_service
// normalize result
$result = $this->parse_result_attributes('resource', $result);
- if (empty($result['ou'])) {
- $dn = ldap_explode_dn($result['entrydn'], 0);
- // pop the count and rdn
- unset($dn['count']);
- unset($dn[0]);
- $result['ou'] = implode(',', $dn);
- }
-
if ($result) {
return $result;
}
@@ -210,14 +200,6 @@ class kolab_api_service_resource extends kolab_api_service
// normalize result
$result = $this->parse_result_attributes('resource', $result);
- if (empty($result['ou'])) {
- $dn = ldap_explode_dn($result['entrydn'], 0);
- // pop the count and rdn
- unset($dn['count']);
- unset($dn[0]);
- $result['ou'] = implode(',', $dn);
- }
-
if ($result) {
return $result;
}
diff --git a/lib/api/kolab_api_service_role.php b/lib/api/kolab_api_service_role.php
index f00c4df..04d4c52 100644
--- a/lib/api/kolab_api_service_role.php
+++ b/lib/api/kolab_api_service_role.php
@@ -121,7 +121,6 @@ class kolab_api_service_role extends kolab_api_service
//console("role_edit \$postdata", $postdata);
$role_attributes = $this->parse_input_attributes('role', $postdata);
- $role = $postdata['id'];
$auth = Auth::get_instance();
$result = $auth->role_edit($postdata['id'], $role_attributes, $postdata['type_id']);
@@ -229,13 +228,11 @@ class kolab_api_service_role extends kolab_api_service
*/
public function role_members_list($getdata, $postdata)
{
- $auth = Auth::get_instance();
-
if (empty($getdata['id'])) {
- //console("Empty \$getdata['id']");
- return FALSE;
+ return false;
}
+ $auth = Auth::get_instance();
$result = $auth->role_members_list($getdata['id'], false);
return array(
diff --git a/lib/api/kolab_api_service_sharedfolder.php b/lib/api/kolab_api_service_sharedfolder.php
index d14c4fc..1b02431 100644
--- a/lib/api/kolab_api_service_sharedfolder.php
+++ b/lib/api/kolab_api_service_sharedfolder.php
@@ -124,10 +124,8 @@ class kolab_api_service_sharedfolder extends kolab_api_service
//console("\$sharedfolder_attributes as result from parse_input_attributes", $sharedfolder_attributes);
- $sharedfolder = $postdata['id'];
-
$auth = Auth::get_instance();
- $result = $auth->sharedfolder_edit($sharedfolder, $sharedfolder_attributes, $postdata['type_id']);
+ $result = $auth->sharedfolder_edit($postdata['id'], $sharedfolder_attributes, $postdata['type_id']);
// Return the $mod_array
if ($result) {
diff --git a/lib/api/kolab_api_service_user.php b/lib/api/kolab_api_service_user.php
index 79dcb59..33e055a 100644
--- a/lib/api/kolab_api_service_user.php
+++ b/lib/api/kolab_api_service_user.php
@@ -130,12 +130,11 @@ class kolab_api_service_user extends kolab_api_service
Log::trace("\$postdata to user_edit()", $postdata);
$user_attributes = $this->parse_input_attributes('user', $postdata);
- $user = $postdata['id'];
Log::trace("\$user_attributes as result from parse_input_attributes", $user_attributes);
$auth = Auth::get_instance();
- $result = $auth->user_edit($user, $user_attributes, $postdata['type_id']);
+ $result = $auth->user_edit($postdata['id'], $user_attributes, $postdata['type_id']);
// Return the $mod_array
if ($result) {
@@ -176,14 +175,6 @@ class kolab_api_service_user extends kolab_api_service
// normalize result
$result = $this->parse_result_attributes('user', $result);
- if (empty($result['ou'])) {
- $dn = ldap_explode_dn($result['entrydn'], 0);
- // pop the count and rdn
- unset($dn['count']);
- unset($dn[0]);
- $result['ou'] = implode(',', $dn);
- }
-
Log::trace("user.info on " . $getdata['id'] . " parsed result: " . var_export($result, TRUE));
if ($result) {
diff --git a/lib/kolab_api_service.php b/lib/kolab_api_service.php
index 2c57d9d..f5c0804 100644
--- a/lib/kolab_api_service.php
+++ b/lib/kolab_api_service.php
@@ -533,6 +533,15 @@ abstract class kolab_api_service
// always return entrydn
$attrs['entrydn'] = $dn;
+ // add organizational unit to the result
+ if (empty($attrs['ou']) && isset($attributes['ou'])) {
+ $dn = ldap_explode_dn($dn, 0);
+ // pop the count and rdn
+ unset($dn['count']);
+ unset($dn[0]);
+ $attrs['ou'] = implode(',', $dn);
+ }
+
return $attrs;
}