[PEP8] users_ldap_populate
parent
dfd92bb466
commit
50af2cc47e
|
@ -19,9 +19,10 @@
|
||||||
#
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
from osv import osv, fields
|
from osv import orm, fields
|
||||||
|
|
||||||
class CompanyLDAPPopulateWizard(osv.TransientModel):
|
|
||||||
|
class CompanyLDAPPopulateWizard(orm.TransientModel):
|
||||||
_name = 'res.company.ldap.populate_wizard'
|
_name = 'res.company.ldap.populate_wizard'
|
||||||
_description = 'Populate users from LDAP'
|
_description = 'Populate users from LDAP'
|
||||||
_columns = {
|
_columns = {
|
||||||
|
@ -34,7 +35,6 @@ class CompanyLDAPPopulateWizard(osv.TransientModel):
|
||||||
|
|
||||||
def create(self, cr, uid, vals, context=None):
|
def create(self, cr, uid, vals, context=None):
|
||||||
ldap_pool = self.pool.get('res.company.ldap')
|
ldap_pool = self.pool.get('res.company.ldap')
|
||||||
users_pool = self.pool.get('res.users')
|
|
||||||
if 'ldap_id' in vals:
|
if 'ldap_id' in vals:
|
||||||
vals['users_created'] = ldap_pool.action_populate(
|
vals['users_created'] = ldap_pool.action_populate(
|
||||||
cr, uid, vals['ldap_id'], context=context)
|
cr, uid, vals['ldap_id'], context=context)
|
||||||
|
|
|
@ -21,18 +21,18 @@
|
||||||
|
|
||||||
import re
|
import re
|
||||||
from ldap.filter import filter_format
|
from ldap.filter import filter_format
|
||||||
from openerp.osv import orm, fields
|
from openerp.osv import orm
|
||||||
import openerp.exceptions
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
|
||||||
class CompanyLDAP(orm.Model):
|
class CompanyLDAP(orm.Model):
|
||||||
_inherit = 'res.company.ldap'
|
_inherit = 'res.company.ldap'
|
||||||
|
|
||||||
def action_populate(self, cr, uid, ids, context=None):
|
def action_populate(self, cr, uid, ids, context=None):
|
||||||
"""
|
"""
|
||||||
Prepopulate the user table from one or more LDAP resources.
|
Prepopulate the user table from one or more LDAP resources.
|
||||||
|
|
||||||
Obviously, the option to create users must be toggled in
|
Obviously, the option to create users must be toggled in
|
||||||
the LDAP configuration.
|
the LDAP configuration.
|
||||||
|
|
||||||
Return the number of users created (as far as we can tell).
|
Return the number of users created (as far as we can tell).
|
||||||
|
@ -54,7 +54,7 @@ class CompanyLDAP(orm.Model):
|
||||||
if attribute_match:
|
if attribute_match:
|
||||||
login_attr = attribute_match.group(1)
|
login_attr = attribute_match.group(1)
|
||||||
else:
|
else:
|
||||||
raise osv.except_osv(
|
raise orm.except_orm(
|
||||||
"No login attribute found",
|
"No login attribute found",
|
||||||
"Could not extract login attribute from filter %s" %
|
"Could not extract login attribute from filter %s" %
|
||||||
conf['ldap_filter'])
|
conf['ldap_filter'])
|
||||||
|
|
Loading…
Reference in New Issue