diff --git a/users_ldap_populate/README.rst b/users_ldap_populate/README.rst new file mode 100644 index 000000000..59a1b2be3 --- /dev/null +++ b/users_ldap_populate/README.rst @@ -0,0 +1,68 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +=================== +Users LDAP Populate +=================== + +This module extends the functionality of auth_ldap by adding functionality so +that users can be populated from a LDAP server. + +Installation +============ + +To install this module, you need to: + +#. Install the module users_ldap_populate from the module list. + +Usage +===== + +To use this module, you need to: + +#. Go to 'Settings' -> 'General Settings' +#. In the LDAP category click on or add a LDAP configuration +#. In the pop-up enter all the LDAP settings +#. Click the populate button +#. A new pop-up will notify you of how many users are added + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/repo/149 + +.. repo_id is available in https://github.com/OCA/maintainer-tools/blob/master/tools/repos_with_ids.txt +.. branch is "8.0" for example + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues +`_. In case of trouble, please +check there if your issue has already been reported. If you spotted it first, +help us smashing it by providing a detailed and welcomed feedback. + +Credits +======= + +* Therp BV + +Images +------ + +* Odoo Community Association: `Icon `_. + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +To contribute to this module, please visit https://odoo-community.org. diff --git a/users_ldap_populate/__init__.py b/users_ldap_populate/__init__.py index 9186ee3ad..baf074019 100644 --- a/users_ldap_populate/__init__.py +++ b/users_ldap_populate/__init__.py @@ -1 +1,5 @@ -from . import model +# -*- coding: utf-8 -*- +# © 2012 Therp BV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/gpl.html). + +from . import models diff --git a/users_ldap_populate/__manifest__.py b/users_ldap_populate/__manifest__.py index 2fbea2efa..7e673d634 100644 --- a/users_ldap_populate/__manifest__.py +++ b/users_ldap_populate/__manifest__.py @@ -1,27 +1,14 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# This module copyright (C) 2012 Therp BV (). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## +# © 2012 Therp BV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/gpl.html). + { "name": "LDAP Populate", - "version": "9.0.1.0.0", - "author": "Therp BV,Odoo Community Association (OCA)", + "version": "10.0.1.0.0", + "author": ( + "Therp BV", + "Odoo Community Association (OCA)", + ), "license": "AGPL-3", "category": 'Tools', "description": """ @@ -45,8 +32,8 @@ object you want to query. 'python': ['ldap'], }, "data": [ - 'view/users_ldap.xml', - 'view/populate_wizard.xml', + 'views/users_ldap.xml', + 'views/populate_wizard.xml', ], - 'installable': False, + 'installable': True, } diff --git a/users_ldap_populate/model/__init__.py b/users_ldap_populate/model/__init__.py deleted file mode 100644 index a925c6082..000000000 --- a/users_ldap_populate/model/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -from . import users_ldap -from . import populate_wizard diff --git a/users_ldap_populate/model/populate_wizard.py b/users_ldap_populate/model/populate_wizard.py deleted file mode 100644 index 513516902..000000000 --- a/users_ldap_populate/model/populate_wizard.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# This module copyright (C) 2012 Therp BV (). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## - -from openerp import models, fields, api - - -class CompanyLDAPPopulateWizard(models.TransientModel): - _name = 'res.company.ldap.populate_wizard' - _description = 'Populate users from LDAP' - - name = fields.Char('Name', size=16) - ldap_id = fields.Many2one( - 'res.company.ldap', - 'LDAP Configuration' - ) - users_created = fields.Integer( - 'Number of users created', - readonly=True - ) - - @api.model - @api.returns('self', lambda value: value.id) - def create(self, vals): - if 'ldap_id' in vals: - ldap = self.env['res.company.ldap'].browse(vals['ldap_id']) - vals['users_created'] = ldap.action_populate() - return super(CompanyLDAPPopulateWizard, self).create(vals) diff --git a/users_ldap_populate/models/__init__.py b/users_ldap_populate/models/__init__.py new file mode 100644 index 000000000..64702d822 --- /dev/null +++ b/users_ldap_populate/models/__init__.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# © 2012 Therp BV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/gpl.html). + +from . import users_ldap +from . import populate_wizard diff --git a/users_ldap_populate/models/populate_wizard.py b/users_ldap_populate/models/populate_wizard.py new file mode 100644 index 000000000..84cd6e1bb --- /dev/null +++ b/users_ldap_populate/models/populate_wizard.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +# © 2012 Therp BV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/gpl.html). + +from odoo import models, fields, api + + +class CompanyLDAPPopulateWizard(models.TransientModel): + _name = 'res.company.ldap.populate_wizard' + _description = 'Populate users from LDAP' + + name = fields.Char('Name', size=16) + ldap_id = fields.Many2one( + 'res.company.ldap', + 'LDAP Configuration' + ) + users_created = fields.Integer( + 'Number of users created', + readonly=True + ) + + @api.model + @api.returns('self', lambda value: value.id) + def create(self, vals): + if 'ldap_id' in vals: + ldap = self.env['res.company.ldap'].browse(vals['ldap_id']) + vals['users_created'] = ldap.action_populate() + return super(CompanyLDAPPopulateWizard, self).create(vals) diff --git a/users_ldap_populate/model/users_ldap.py b/users_ldap_populate/models/users_ldap.py similarity index 70% rename from users_ldap_populate/model/users_ldap.py rename to users_ldap_populate/models/users_ldap.py index 065afbeec..2c1155499 100644 --- a/users_ldap_populate/model/users_ldap.py +++ b/users_ldap_populate/models/users_ldap.py @@ -1,28 +1,11 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# This module copyright (C) 2012 Therp BV (). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## +# © 2012 Therp BV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/gpl.html). import re -from openerp import models, api, _ -from openerp.exceptions import UserError +from odoo import models, api, _ +from odoo.exceptions import UserError import logging _logger = logging.getLogger(__name__) diff --git a/users_ldap_populate/view/populate_wizard.xml b/users_ldap_populate/view/populate_wizard.xml deleted file mode 100644 index 766e49f6d..000000000 --- a/users_ldap_populate/view/populate_wizard.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - Add populate button to ldap view - res.company.ldap.populate_wizard - -
- - -