summaryrefslogtreecommitdiff
path: root/plugins/LdapAuthentication/LdapAuthenticationPlugin.php
diff options
context:
space:
mode:
authorCraig Andrews <candrews@integralblue.com>2010-01-14 19:43:03 -0500
committerCraig Andrews <candrews@integralblue.com>2010-01-14 19:52:11 -0500
commita27aef92060277120f8889136ed6972f5915709f (patch)
treebe6dad332e15b5bb9fc3348df4099a05ddae9a5a /plugins/LdapAuthentication/LdapAuthenticationPlugin.php
parentc82c43d5eebfdd74dc0846136ef8bda97683ae4d (diff)
Add nickname suggestion capability for use during autoregistration.
Diffstat (limited to 'plugins/LdapAuthentication/LdapAuthenticationPlugin.php')
-rw-r--r--plugins/LdapAuthentication/LdapAuthenticationPlugin.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/plugins/LdapAuthentication/LdapAuthenticationPlugin.php b/plugins/LdapAuthentication/LdapAuthenticationPlugin.php
index eb3a05117..1755033f1 100644
--- a/plugins/LdapAuthentication/LdapAuthenticationPlugin.php
+++ b/plugins/LdapAuthentication/LdapAuthenticationPlugin.php
@@ -153,6 +153,22 @@ class LdapAuthenticationPlugin extends AuthenticationPlugin
return false;
}
+
+ function suggestNicknameForUsername($username)
+ {
+ $entry = $this->ldap_get_user($username, $this->attributes);
+ if(!$entry){
+ //this really shouldn't happen
+ return $username;
+ }else{
+ $nickname = $entry->getValue($this->attributes['nickname'],'single');
+ if($nickname){
+ return $nickname;
+ }else{
+ return $username;
+ }
+ }
+ }
//---utility functions---//
function ldap_get_config(){