Browse Source

[PEP8] users_ldap_mail

pull/21/head
Sandy Carter 10 years ago
committed by Sandy Carter
parent
commit
a2b37d8d2e
  1. 21
      users_ldap_mail/__openerp__.py
  2. 12
      users_ldap_mail/users_ldap_model.py

21
users_ldap_mail/__openerp__.py

@ -20,21 +20,20 @@
############################################################################## ##############################################################################
{ {
'name': "LDAP mapping for user name and e-mail",
'version': "1.0",
'depends': ["auth_ldap"],
'author': "Daniel Reis (https://launchpad.com/~dreis-pt)",
'description': """\
'name': "LDAP mapping for user name and e-mail",
'version': "1.0",
'depends': ["auth_ldap"],
'author': "Daniel Reis (https://launchpad.com/~dreis-pt)",
'description': """\
Allows to define the LDAP attributes to use to retrieve user name and e-mail address. Allows to define the LDAP attributes to use to retrieve user name and e-mail address.
The default attribute used for the name is "cn". The default attribute used for the name is "cn".
For Active Directory, you might prefer to use "displayName" instead. For Active Directory, you might prefer to use "displayName" instead.
AD also supports the "mail" attribute, so it can be mapped into OpenERP. AD also supports the "mail" attribute, so it can be mapped into OpenERP.
""", """,
'category': "Tools",
'data': [
'users_ldap_view.xml',
],
'installable': True,
'category': "Tools",
'data': [
'users_ldap_view.xml',
],
'installable': True,
} }
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

12
users_ldap_mail/users_ldap_model.py

@ -24,13 +24,16 @@ from openerp.osv import fields, orm
import logging import logging
_log = logging.getLogger(__name__) _log = logging.getLogger(__name__)
class CompanyLDAP(orm.Model): 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="By default 'cn' is used. " help="By default 'cn' is used. "
"For ActiveDirectory you might use 'displayName' instead."), "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."), help="LDAP attribute to use to retrieve em-mail address."),
} }
_defaults = { _defaults = {
@ -39,7 +42,7 @@ class CompanyLDAP(orm.Model):
} }
def get_ldap_dicts(self, cr, ids=None): def get_ldap_dicts(self, cr, ids=None):
"""
"""
Copy of auth_ldap's funtion, changing only the SQL, so that it returns Copy of auth_ldap's funtion, changing only the SQL, so that it returns
all fields in the table. all fields in the table.
""" """
@ -58,7 +61,7 @@ class CompanyLDAP(orm.Model):
def map_ldap_attributes(self, cr, uid, conf, login, ldap_entry): def map_ldap_attributes(self, cr, uid, conf, login, ldap_entry):
values = super(CompanyLDAP, self).map_ldap_attributes(cr, uid, conf, values = super(CompanyLDAP, self).map_ldap_attributes(cr, uid, conf,
login, ldap_entry)
login, ldap_entry)
mapping = [ mapping = [
('name', 'name_attribute'), ('name', 'name_attribute'),
('email', 'mail_attribute'), ('email', 'mail_attribute'),
@ -71,4 +74,3 @@ class CompanyLDAP(orm.Model):
_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')))
return values return values
Loading…
Cancel
Save