lib/api lib/client
Aleksander Machniak
machniak at kolabsys.com
Thu Mar 29 15:36:35 CEST 2012
lib/api/kolab_api_service_form_value.php | 4 ++--
lib/client/kolab_client_task_user.php | 12 ++++++++++++
2 files changed, 14 insertions(+), 2 deletions(-)
New commits:
commit 73e01fe5af2dcebed7dbe2a712994f233df1e935
Author: Aleksander Machniak <alec at alec.pl>
Date: Thu Mar 29 15:35:49 2012 +0200
Fix so user roles names are listed instead of DNs
diff --git a/lib/api/kolab_api_service_form_value.php b/lib/api/kolab_api_service_form_value.php
index fa8d19d..3f53d79 100644
--- a/lib/api/kolab_api_service_form_value.php
+++ b/lib/api/kolab_api_service_form_value.php
@@ -460,7 +460,7 @@ class kolab_api_service_form_value extends kolab_api_service
$keyword = array('value' => $postdata['search']);
$data = array(
- 'attributes' => array('displayname', 'mail'),
+ 'attributes' => array('cn'),
'page_size' => 15,
'search' => array(
'displayname' => $keyword,
@@ -474,7 +474,7 @@ class kolab_api_service_form_value extends kolab_api_service
// convert to key=>value array
foreach ($list as $idx => $value) {
- $list[$idx] = is_array($value['cn']) ? implode('/', $value['cn']) : $value['cn'];
+ $list[$idx] = $value['cn'];
}
return $list;
diff --git a/lib/client/kolab_client_task_user.php b/lib/client/kolab_client_task_user.php
index 4765fb6..2daaead 100644
--- a/lib/client/kolab_client_task_user.php
+++ b/lib/client/kolab_client_task_user.php
@@ -232,6 +232,7 @@ class kolab_client_task_user extends kolab_client_task
'uidnumber' => 'system',
'gidnumber' => 'system',
'homedirectory' => 'system',
+ 'nsrole' => 'system',
'mailquota' => 'config',
'cyrususerquota' => 'config',
@@ -292,6 +293,17 @@ class kolab_client_task_user extends kolab_client_task
'section' => 'personal',
'value' => $accttypes[$type]['content'],
);
+
+ // Roles (extract role names)
+ if (!empty($fields['nsrole']) && !empty($data['nsrole'])) {
+ $data['nsrole'] = array_combine($data['nsrole'], $data['nsrole']);
+ foreach ($data['nsrole'] as $dn => $val) {
+ // @TODO: maybe ldap_explode_dn() would be better?
+ if (preg_match('/^cn=([^,]+)/i', $val, $m)) {
+ $data['nsrole'][$dn] = $m[1];
+ }
+ }
+ }
}
// Create form object and populate with fields
More information about the commits
mailing list