ADD defsult and sugegsted values; auto-install

pull/2/head
Daniel Reis 2013-07-29 08:57:18 +01:00
parent f7ac5cf999
commit 50e82c307a
3 changed files with 17 additions and 16 deletions

View File

@ -2,7 +2,7 @@
##############################################################################
#
# 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
# 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",
"version" : "1.0",
"depends" : ["auth_ldap"],
"author" : "Daniel Reis",
"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.
The default attribute used for the name is "cn".
For Active Directory, you might prefer to use "displayName" instead.
AD also supports the "mail" attribute, so it can be mapped into OpenERP.
""",
"category" : "Tools",
"data" : [
'category': "Tools",
'data': [
'users_ldap_view.xml',
],
"installable": True,
'installable': True,
'auto_install': True,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -23,21 +23,22 @@ from openerp.osv import fields, orm
class CompanyLDAP(orm.Model):
_inherit='res.company.ldap'
_columns={
_inherit = 'res.company.ldap'
_columns = {
'name_attribute': fields.char('Name Attribute', size=64,
help="Default in 'cn'. For an AD you could use 'displayName' instead."),
'mail_attribute': fields.char('E-mail attribute', size=64,
help="Active Directory uses the 'mail' attribute."),
}
}
_defaults = {
'mail_attribute': 'mail',
}
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.
"""
if ids:
id_clause = 'AND id IN (%s)'
args = [tuple(ids)]
@ -51,7 +52,6 @@ class CompanyLDAP(orm.Model):
""", args)
return cr.dictfetchall()
def map_ldap_attributes(self, cr, uid, conf, login, ldap_entry):
values = super(CompanyLDAP, self).map_ldap_attributes(cr, uid, conf,
login, ldap_entry)

View File

@ -8,7 +8,7 @@
<field name="arch" type="xml">
<field name="ldap_filter" position="after">
<field name="name_attribute"/>
<field name="name_attribute" placeholder="e.g. displayName"/>
<field name="mail_attribute"/>
</field>