summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-03-22 11:41:25 +0100
committerAleksander Machniak <alec@alec.pl>2012-03-22 11:41:25 +0100
commit18617e0d67760e3868feeecae583305c5c961618 (patch)
treea45f6da83fbac6d0d2d7a8a1c68690e30cca3e86
parent2b00ad6155b346a5c40392b2f31f9ee917f3f4fc (diff)
downloadwebadmin-18617e0d67760e3868feeecae583305c5c961618.tar.gz
Small improvement in unknown user name handling
-rw-r--r--lib/kolab_client_task.php16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/kolab_client_task.php b/lib/kolab_client_task.php
index 2a49344..920d8ae 100644
--- a/lib/kolab_client_task.php
+++ b/lib/kolab_client_task.php
@@ -182,7 +182,7 @@ class kolab_client_task
}
// @TODO: why user.info returns empty result for 'cn=Directory Manager' login?
else if (preg_match('/^cn=([a-zA-Z ]+)/', $login['username'], $m)) {
- $user['fullname'] = $m[1];
+ $user['fullname'] = ucwords($m[1]);
}
// Save user data
@@ -501,13 +501,13 @@ class kolab_client_task
return $this->cache['user_names'][$dn];
}
- if (preg_match('/^cn=([a-z ]+)$/i', $dn, $m)) {
- $username = $m[1];
- }
- else {
- $result = $this->api->get('user.info', array('user' => $dn));
- $user = $result->get($dn);
- $username = $user['displayname'];
+ $result = $this->api->get('user.info', array('user' => $dn));
+ $user = $result->get($dn);
+
+ if (empty($user) || empty($user['displayname'])) {
+ if (preg_match('/^cn=([a-zA=Z ]+)/', $dn, $m)) {
+ $username = ucwords($m[1]);
+ }
}
return $this->cache['user_names'][$dn] = $username;