summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-03-29 13:35:49 (GMT)
committerAleksander Machniak <alec@alec.pl>2012-03-29 13:35:49 (GMT)
commit73e01fe5af2dcebed7dbe2a712994f233df1e935 (patch)
treec39a80a3f5c1dee451a80b4f8f8c070ba7269987
parent3a269be5be0e73d7f7da0c8779208024c6a2c61a (diff)
downloadkolab-wap-73e01fe5af2dcebed7dbe2a712994f233df1e935.tar.gz
Fix so user roles names are listed instead of DNs
-rw-r--r--lib/api/kolab_api_service_form_value.php4
-rw-r--r--lib/client/kolab_client_task_user.php12
2 files changed, 14 insertions, 2 deletions
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