PDA

View Full Version : Active Directory: username-pattern



shivshan
08-31-2007, 10:31 AM
Hi
I have successfully setup AD and the users are being authenticated. However, the samaccountname is a number, and this is displayed after login.
I would like to display the real name, using the preference "username-pattern". I am afraid the page http://wiki.opengarden.org/index.php?title=Deki_Wiki/Features/LDAP_Support is not very helpful in this regard.
Can you please suggest how i can change this to display the firstname and lastname?
When i try the URL for troubleshooting LDAP, i see that the following is present:

<user name="910828">
<ldap-dn>CN=SHANKAR Shiva H N ,OU=xxx,OU=yyy,OU=All Departments,DC=nt,DC=location,DC=company,DC=com</ldap-dn>
<date.created>2007-07-13T10:59:02Z</date.created>
<firstname>Shiva H N</firstname>
<lastname>SHANKAR</lastname>

Thanks
Shiva

MaxM
08-31-2007, 08:56 PM
Good question.. Quite a few companies likely use a numeric user naming scheme and it'd be nice to see users' name rather than their account numbers.

I'm adding a config option for the LdapAuthentication service "displayname-pattern" which will allow you to customize the username returned by the Ldap Service using ldap attributes. Here's an example pattern:


{sn}, {givenname} ({samAccountName})


The tokens within {} will be substituted by their respective ldap attributes. In this case your username will be "SHANKAR, Shiva H N (910828)". This may be a little long but you get the idea. The existing service preference "username-pattern" may be obsoleted/replaced by this approach.

This will be available soon in the Hayes+ release.

Max

promao
11-29-2007, 12:19 AM
OK I have done something similar and no matter how I try it...

and I used the following patterns:
{givenName} {sn} <---- note the space between both names
{displayName}

what happens is that instead of having

usr1stnm familynm

displayed, I allways get

usr1stnm_familynm <----- note the underscore

What can I do to get rid of the undescore?

Thanks for any help on this.
Peter

promao
12-03-2007, 07:19 PM
Hello guys,

Sorry to insist on this small issue but I'm kind'a stuck here. Any ideas on how to get rid of the automatically appended underscore character?

Thanks in advance,
Peter

MaxM
12-03-2007, 09:35 PM
Peter,
unfortunately user names must currently be compatible with page titles which is why spaces are converted to underscores. We may try to change this behavior during a later release but it'll take a bit of work. You may need to use just the account name for your ldap accounts meanwhile

Max

promao
12-04-2007, 12:14 AM
Hello Max,

Thanks for the lightning fast answer. Now I get it.:D The reason behind the behaviour is indeed a logical one.

May I sugest that in this particular scenario (LDAP auth that is) leaving the page name as the users sAMAccountName? Additionally show the login name as the displayName next to the logout link?

I think this does not represent that much amount of work as would a parsing function require, testing all the scenarios etc. And this could certainly serve many LDAP users' purposes. (I may be shooting way off target presuming this!)

Do you see any disadvantage with this approach?

Besides the obvious - "this would be yet another option and these kinds of requests would lead to a inordinate amount of these in the admin area" - which, of course, is perfectly plausible and valid argument.:o

Thanks,
Peter

keota
02-27-2008, 04:36 PM
Peter,
unfortunately user names must currently be compatible with page titles which is why spaces are converted to underscores. We may try to change this behavior during a later release but it'll take a bit of work. You may need to use just the account name for your ldap accounts meanwhile

Max

You can go into the user table and remove the underscore. Everything works fine for me. Although you might not want to do this if you have a large number of users. You could write a stored procedure to replace underscores with spaces for the user table.

hoberion
07-03-2008, 02:51 PM
After looking in the database in the user table I see the "user_real_name" which would be perfect for the user pages

you could use user_name as the page name and the real_user_name as the page display name


(AD)