summaryrefslogtreecommitdiffstats
path: root/lib/api/kolab_api_service_role.php
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2014-02-27 14:17:01 +0100
committerAleksander Machniak <machniak@kolabsys.com>2014-02-27 14:17:01 +0100
commit4a55f2c1d856a3e7d44ab03d31ceca7bee86afda (patch)
treea88b0279c6283d17a831036b604a986b4d6f657d /lib/api/kolab_api_service_role.php
parent52e47e63d2c46206dff28a3d1cec782f0d5b1f23 (diff)
downloadwebadmin-4a55f2c1d856a3e7d44ab03d31ceca7bee86afda.tar.gz
Return ID (unique attribute) after adding an object (Request #2829)
Diffstat (limited to 'lib/api/kolab_api_service_role.php')
-rw-r--r--lib/api/kolab_api_service_role.php19
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/api/kolab_api_service_role.php b/lib/api/kolab_api_service_role.php
index 6ca2231..31c3a8b 100644
--- a/lib/api/kolab_api_service_role.php
+++ b/lib/api/kolab_api_service_role.php
@@ -76,16 +76,19 @@ class kolab_api_service_role extends kolab_api_service
*/
public function role_add($getdata, $postdata)
{
- $role_attributes = $this->parse_input_attributes('role', $postdata);
-
- $auth = Auth::get_instance();
- $result = $auth->role_add($role_attributes, $postdata['type_id']);
+ $attributes = $this->parse_input_attributes('role', $postdata);
+ $auth = Auth::get_instance();
+ $result = $auth->role_add($attributes, $postdata['type_id']);
if ($result) {
- return $role_attributes;
+ if ($id = $this->unique_attribute_value($result)) {
+ $attributes['id'] = $id;
+ }
+
+ return $attributes;
}
- return FALSE;
+ return false;
}
/**
@@ -99,7 +102,7 @@ class kolab_api_service_role extends kolab_api_service
public function role_delete($getdata, $postdata)
{
if (empty($postdata['id'])) {
- return FALSE;
+ return false;
}
// TODO: Input validation
@@ -110,7 +113,7 @@ class kolab_api_service_role extends kolab_api_service
return $result;
}
- return FALSE;
+ return false;
}
public function role_edit($getdata, $postdata)