Browse Source

10.0 migrate users_ldap_populate (#657)

* [MIG] migrate users_ldap_populate to 10.0

Changes include:
 - move views to views folder
 - move models to models folder
 - in views rename openerp to odoo
 - __openerp__.py to __manifest__.py

* [FIX] Add read me to module users_ldap_populate

* [FIX] users_ldap_populate: cleanup manifest file

Cleanup of the author list

* [FIX] users_ldap_populate: More modern copyright in .py files

* [FIX] users_ldap_populate: Update read me

Fixes include:
 - more human module name
 - Fix web links
pull/682/head
Stephan 8 years ago
committed by Daniel Reis
parent
commit
0e310b7bdd
  1. 68
      users_ldap_populate/README.rst
  2. 6
      users_ldap_populate/__init__.py
  3. 35
      users_ldap_populate/__manifest__.py
  4. 2
      users_ldap_populate/model/__init__.py
  5. 45
      users_ldap_populate/model/populate_wizard.py
  6. 6
      users_ldap_populate/models/__init__.py
  7. 28
      users_ldap_populate/models/populate_wizard.py
  8. 25
      users_ldap_populate/models/users_ldap.py
  9. 17
      users_ldap_populate/view/populate_wizard.xml
  10. 19
      users_ldap_populate/view/users_ldap.xml
  11. 15
      users_ldap_populate/views/populate_wizard.xml
  12. 17
      users_ldap_populate/views/users_ldap.xml

68
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
<https://github.com/OCA/server-tools/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 <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
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.

6
users_ldap_populate/__init__.py

@ -1 +1,5 @@
from . import model
# -*- coding: utf-8 -*-
# © 2012 Therp BV (<http://therp.nl>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/gpl.html).
from . import models

35
users_ldap_populate/__manifest__.py

@ -1,27 +1,14 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2012 Therp BV (<http://therp.nl>).
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
# © 2012 Therp BV (<http://therp.nl>)
# 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,
}

2
users_ldap_populate/model/__init__.py

@ -1,2 +0,0 @@
from . import users_ldap
from . import populate_wizard

45
users_ldap_populate/model/populate_wizard.py

@ -1,45 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2012 Therp BV (<http://therp.nl>).
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
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)

6
users_ldap_populate/models/__init__.py

@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
# © 2012 Therp BV (<http://therp.nl>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/gpl.html).
from . import users_ldap
from . import populate_wizard

28
users_ldap_populate/models/populate_wizard.py

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# © 2012 Therp BV (<http://therp.nl>)
# 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)

25
users_ldap_populate/model/users_ldap.py → 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 (<http://therp.nl>).
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
# © 2012 Therp BV (<http://therp.nl>)
# 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__)

17
users_ldap_populate/view/populate_wizard.xml

@ -1,17 +0,0 @@
<?xml version="1.0"?>
<openerp>
<data>
<record model="ir.ui.view" id="populate_wizard_view">
<field name="name">Add populate button to ldap view</field>
<field name="model">res.company.ldap.populate_wizard</field>
<field name="arch" type="xml">
<form string="Add populate button to ldap view">
<group>
<field name="users_created"/>
<button icon="gtk-ok" string="OK" special="cancel"/>
</group>
</form>
</field>
</record>
</data>
</openerp>

19
users_ldap_populate/view/users_ldap.xml

@ -1,19 +0,0 @@
<?xml version="1.0"?>
<openerp>
<data>
<record model="ir.ui.view" id="company_form_view">
<field name="name">Add populate button to ldap view</field>
<field name="model">res.company</field>
<field name="inherit_id" ref="auth_ldap.company_form_view"/>
<field name="arch" type="xml">
<xpath name="populate_ldap" expr="//field[@name='ldaps']/form" position="inside">
<separator string="Populate user database" colspan="4"/>
<button name="populate_wizard"
string="Populate"
type="object"
colspan="2"/>
</xpath>
</field>
</record>
</data>
</openerp>

15
users_ldap_populate/views/populate_wizard.xml

@ -0,0 +1,15 @@
<?xml version="1.0"?>
<odoo>
<record model="ir.ui.view" id="populate_wizard_view">
<field name="name">Add populate button to ldap view</field>
<field name="model">res.company.ldap.populate_wizard</field>
<field name="arch" type="xml">
<form string="Add populate button to ldap view">
<group>
<field name="users_created"/>
<button icon="gtk-ok" string="OK" special="cancel"/>
</group>
</form>
</field>
</record>
</odoo>

17
users_ldap_populate/views/users_ldap.xml

@ -0,0 +1,17 @@
<?xml version="1.0"?>
<odoo>
<record model="ir.ui.view" id="company_form_view">
<field name="name">Add populate button to ldap view</field>
<field name="model">base.config.settings</field>
<field name="inherit_id" ref="auth_ldap.view_general_configuration_form_inherit_auth_ldap"/>
<field name="arch" type="xml">
<xpath name="populate_ldap" expr="//field[@name='ldaps']/form" position="inside">
<separator name="Populate user database" colspan="4"/>
<button name="populate_wizard"
string="Populate"
type="object"
colspan="2"/>
</xpath>
</field>
</record>
</odoo>
Loading…
Cancel
Save