ADD defsult and sugegsted values; auto-install
parent
f7ac5cf999
commit
50e82c307a
|
@ -2,7 +2,7 @@
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#
|
#
|
||||||
# OpenERP, Open Source Management Solution
|
# OpenERP, Open Source Management Solution
|
||||||
# This module copyright (C) 2013 Daniel Reis.
|
# Copyright (C) 2013 Daniel Reis (https://launchpad.com/~dreis-pt)
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU Affero General Public License as
|
# it under the terms of the GNU Affero General Public License as
|
||||||
|
@ -20,21 +20,22 @@
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
{
|
{
|
||||||
"name" : "LDAP mapping for user name and e-mail",
|
'name': "LDAP mapping for user name and e-mail",
|
||||||
"version" : "1.0",
|
'version': "1.0",
|
||||||
"depends" : ["auth_ldap"],
|
'depends': ["auth_ldap"],
|
||||||
"author" : "Daniel Reis",
|
'author': "Daniel Reis (https://launchpad.com/~dreis-pt)",
|
||||||
"description": """\
|
'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",
|
'category': "Tools",
|
||||||
"data" : [
|
'data': [
|
||||||
'users_ldap_view.xml',
|
'users_ldap_view.xml',
|
||||||
],
|
],
|
||||||
"installable": True,
|
'installable': True,
|
||||||
|
'auto_install': True,
|
||||||
}
|
}
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -23,21 +23,22 @@ from openerp.osv import fields, orm
|
||||||
|
|
||||||
|
|
||||||
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="Default in 'cn'. For an AD you could use 'displayName' instead."),
|
help="Default in 'cn'. For an AD you could 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="Active Directory uses the 'mail' attribute."),
|
||||||
}
|
}
|
||||||
|
_defaults = {
|
||||||
|
'mail_attribute': 'mail',
|
||||||
|
}
|
||||||
|
|
||||||
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.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if ids:
|
if ids:
|
||||||
id_clause = 'AND id IN (%s)'
|
id_clause = 'AND id IN (%s)'
|
||||||
args = [tuple(ids)]
|
args = [tuple(ids)]
|
||||||
|
@ -51,7 +52,6 @@ class CompanyLDAP(orm.Model):
|
||||||
""", args)
|
""", args)
|
||||||
return cr.dictfetchall()
|
return cr.dictfetchall()
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
|
|
||||||
<field name="ldap_filter" position="after">
|
<field name="ldap_filter" position="after">
|
||||||
<field name="name_attribute"/>
|
<field name="name_attribute" placeholder="e.g. displayName"/>
|
||||||
<field name="mail_attribute"/>
|
<field name="mail_attribute"/>
|
||||||
</field>
|
</field>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue