|
|
@ -24,13 +24,16 @@ from openerp.osv import fields, orm |
|
|
|
import logging |
|
|
|
_log = logging.getLogger(__name__) |
|
|
|
|
|
|
|
|
|
|
|
class CompanyLDAP(orm.Model): |
|
|
|
_inherit = 'res.company.ldap' |
|
|
|
_columns = { |
|
|
|
'name_attribute': fields.char('Name Attribute', size=64, |
|
|
|
'name_attribute': fields.char( |
|
|
|
'Name Attribute', size=64, |
|
|
|
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="LDAP attribute to use to retrieve em-mail address."), |
|
|
|
} |
|
|
|
_defaults = { |
|
|
@ -39,7 +42,7 @@ class CompanyLDAP(orm.Model): |
|
|
|
} |
|
|
|
|
|
|
|
def get_ldap_dicts(self, cr, ids=None): |
|
|
|
""" |
|
|
|
""" |
|
|
|
Copy of auth_ldap's funtion, changing only the SQL, so that it returns |
|
|
|
all fields in the table. |
|
|
|
""" |
|
|
@ -58,7 +61,7 @@ class CompanyLDAP(orm.Model): |
|
|
|
|
|
|
|
def map_ldap_attributes(self, cr, uid, conf, login, ldap_entry): |
|
|
|
values = super(CompanyLDAP, self).map_ldap_attributes(cr, uid, conf, |
|
|
|
login, ldap_entry) |
|
|
|
login, ldap_entry) |
|
|
|
mapping = [ |
|
|
|
('name', 'name_attribute'), |
|
|
|
('email', 'mail_attribute'), |
|
|
@ -71,4 +74,3 @@ class CompanyLDAP(orm.Model): |
|
|
|
_log.warning('No LDAP attribute "%s" found for login "%s"' % ( |
|
|
|
conf.get(conf_name), values.get('login'))) |
|
|
|
return values |
|
|
|
|