|
@ -28,9 +28,10 @@ class CompanyLDAP(orm.Model): |
|
|
_inherit = 'res.company.ldap' |
|
|
_inherit = 'res.company.ldap' |
|
|
_columns = { |
|
|
_columns = { |
|
|
'name_attribute': fields.char('Name Attribute', size=64, |
|
|
'name_attribute': fields.char('Name Attribute', size=64, |
|
|
help="Default in 'cn'. For an AD you could use 'displayName' instead."), |
|
|
|
|
|
|
|
|
help="By default 'cn' is used. " |
|
|
|
|
|
"For ActiveDirectory you might use 'displayName' instead."), |
|
|
'mail_attribute': fields.char('E-mail attribute', size=64, |
|
|
'mail_attribute': fields.char('E-mail attribute', size=64, |
|
|
help="Active Directory uses the 'mail' attribute."), |
|
|
|
|
|
|
|
|
help="LDAP attribute to use to retrieve em-mail address."), |
|
|
} |
|
|
} |
|
|
_defaults = { |
|
|
_defaults = { |
|
|
'mail_attribute': 'mail', |
|
|
'mail_attribute': 'mail', |
|
@ -63,7 +64,8 @@ class CompanyLDAP(orm.Model): |
|
|
] |
|
|
] |
|
|
for value_key, conf_name in mapping: |
|
|
for value_key, conf_name in mapping: |
|
|
try: |
|
|
try: |
|
|
values[value_key] = ldap_entry[1][conf[conf_name]][0] |
|
|
|
|
|
|
|
|
if conf[conf_name]: |
|
|
|
|
|
values[value_key] = ldap_entry[1][conf[conf_name]][0] |
|
|
except KeyError: |
|
|
except KeyError: |
|
|
_log.warning('No LDAP attribute "%s" found for login "%s"' % ( |
|
|
_log.warning('No LDAP attribute "%s" found for login "%s"' % ( |
|
|
conf.get(conf_name), values.get('login'))) |
|
|
conf.get(conf_name), values.get('login'))) |
|
|