[Freeipa-devel] [RFC] show first/last name in ipa-finduser output
Martin Nagy
mnagy at redhat.com
Tue Aug 5 12:48:44 UTC 2008
Hi,
Rob Crittenden wrote:
> We currently display common name in ipa-finduser which can cause
> confusion since we explicitly provide options for managing first and
> last name. Updating those doesn't automatically update the cn field so
> it looks as if a change hasn't been applied.
>
> So here is my first crack at fixing it. All I've done is grab sn and
> givenname instead of cn and ensure that in the display sn comes after
> gn. It looks like:
>
> % ipa-finduser tuser1
> First Name: Testy
> Last Name: User
> Home Directory: /home/tuser1
> Login Shell: /bin/sh
> Login: tuser1
>
> % ipa-finduser -a tuser1 |grep Full
> Full Name: Test User
>
> So you can see that the Full Name (cn) isn't the same as givenname + sn.
>
> I wanted to avoid creating some sort of special "full name" attribute
> because one can run this with -n to get the real LDAP attribute names
> and I didn't want anyone trying to query for LDAP attributes that don't
> exist.
Regarding your approach, I think it might be just a bit inconvenient for
the user, but it would at least be correct and avoid some confusion.
Since I don't have any better idea, I say we do it.
> So here is a patch for the current approach. Need some feedback.
Regarding the patch:
> + # Always have sn following givenname
> + try:
> + l = attr.index('givenname')
-> + try:
> + attr.remove('sn')
-> + except:
-> + pass
> + attr.insert(l+1, 'sn')
> + except:
> + pass
> +
I'd remove the lines that I marked here with '-'. I think we don't want
to insert 'sn' to the attr list if it wasn't there. I just hope
[].remove() doesn't throw any other exceptions :)
Hope this helps.
Martin
More information about the Freeipa-devel
mailing list