Modify

Opened 14 months ago

Last modified 14 months ago

#11361 new defect

name_attr ldap field is not being caught properly

Reported by: Estopero Owned by: sandinak
Priority: normal Component: DirectoryAuthPlugin
Severity: normal Keywords: ldap, custom fields
Cc: Trac Release: 1.0

Description (last modified by rjollos)

First of all thanks for the plugin, is being very useful for us :)

I think some custom fields are not being caught properly, we are using openLDAP and these are our three fields for user, name and email:

[account-manager]
user_attr = uid
name_attr = cn
email_attr = mail

The user_attr is rightly mapped, and I think the email_attr field works because is similar to the ActiveDirectory one, however the name_attr is not being defined and is empty in the user list panel.

I think the problem is that the "displayName" is hardcoded in the attr list

auth.py: line 121
def check_password(self, user, password):
...
attrs = [ self.user_attr, 'mail', 'proxyAddress', 'displayName']
...
userinfo = self._get_userinfo(users[0][1])

directoryauthplugin/trunk/tracext/dirauth/auth.py@13391#L121

And in the _get_userinfo function you are looking for a attr field that will never exist if is not called "displayName":

auth.py: line 294
def _get_userinfo(self, attrs):
...
displayname = attrs.get(self.name_attr, [''])[0]

directoryauthplugin/trunk/tracext/dirauth/auth.py@13391#L294

I'm not a python developer so I'm not sure if this is being the problem but could be. What do you think? :)

Thanks and great work

Attachments (0)

Change History (2)

comment:1 Changed 14 months ago by Estopero

To solve the name_attr mapping issue is enough changing in the linea 121 of auth.py

attrs = [ self.user_attr, 'mail', 'proxyAddress', 'displayName']

by

attrs = [ self.user_attr, 'mail', 'proxyAddress', self.name_attr]

Probably the same happens with 'mail' but didn't try.

I've tried to do a commit but I have no permissions :). sandinak, Would you mind to fix it?

Thanks!

comment:2 Changed 14 months ago by rjollos

  • Description modified (diff)

Add Comment

Modify Ticket

Action
as new The owner will remain sandinak.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.