diff --git a/auth_dynamic_groups/README.rst b/auth_dynamic_groups/README.rst deleted file mode 100644 index 051e80c0e..000000000 --- a/auth_dynamic_groups/README.rst +++ /dev/null @@ -1,30 +0,0 @@ -Description ------------ -This module allows defining groups whose membership is a condition expressed as -python code. For every user, it is evaluated during login if she belongs to -the group or not. - -Usage ------ -Check `Dynamic` on a group you want to be dynamic. Now fill in the condition, -using `user` which is a browse record of the user in question that evaluates -truthy if the user is supposed to be a member of the group and falsy if not. - -There is a constraint on the field to check for validity if this expression. -When you're satisfied, click the button `Evaluate` to prefill the group's -members. The condition will be checked now for every user who logs in. - -Example -------- -We have a group called `Amsterdam` and want it to contain all users from -city of Amsterdam. So we use the membership condition - -``` -user.partner_id.city == 'Amsterdam' -``` - -Now we can be sure every user living in this city is in the right group, and we -can start assigning local menus to it, adjust permissions, etc. Keep in mind -that view overrides can also be restricted by a group id, this gives a lot of -possibilities to dynamically adapt views based on arbitrary properties -reachable via the user record. diff --git a/auth_dynamic_groups/__init__.py b/auth_dynamic_groups/__init__.py deleted file mode 100644 index 9da2ac3b6..000000000 --- a/auth_dynamic_groups/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# This module copyright (C) 2013 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 . import model diff --git a/auth_dynamic_groups/__manifest__.py b/auth_dynamic_groups/__manifest__.py deleted file mode 100644 index 6f519ef6b..000000000 --- a/auth_dynamic_groups/__manifest__.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# This module copyright (C) 2013-2015 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 . -# -############################################################################## -{ - "name": "Dynamic groups", - "version": "8.0.1.0.0", - "author": "Therp BV", - "complexity": "normal", - 'summary': 'Have membership conditions for certain groups', - "category": "Tools", - "depends": [ - 'base', - ], - "data": [ - 'view/res_groups.xml', - ], - "auto_install": False, - 'installable': False, - "external_dependencies": { - 'python': [], - }, -} diff --git a/auth_dynamic_groups/i18n/de.po b/auth_dynamic_groups/i18n/de.po deleted file mode 100644 index a64d78ab5..000000000 --- a/auth_dynamic_groups/i18n/de.po +++ /dev/null @@ -1,67 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * auth_dynamic_groups -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: server-tools (8.0)\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-09-29 11:14+0000\n" -"PO-Revision-Date: 2015-09-18 13:53+0000\n" -"Last-Translator: <>\n" -"Language-Team: German (http://www.transifex.com/oca/OCA-server-tools-8-0/language/de/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Language: de\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#. module: auth_dynamic_groups -#: model:ir.model,name:auth_dynamic_groups.model_res_groups -msgid "Access Groups" -msgstr "" - -#. module: auth_dynamic_groups -#: field:res.groups,dynamic_group_condition:0 -msgid "Condition" -msgstr "" - -#. module: auth_dynamic_groups -#: field:res.groups,is_dynamic:0 -msgid "Dynamic" -msgstr "" - -#. module: auth_dynamic_groups -#: view:res.groups:auth_dynamic_groups.view_groups_form -msgid "Evaluate" -msgstr "" - -#. module: auth_dynamic_groups -#: view:res.groups:auth_dynamic_groups.view_groups_form -msgid "Fill in your condition..." -msgstr "" - -#. module: auth_dynamic_groups -#: code:addons/auth_dynamic_groups/model/res_groups.py:57 -#, python-format -msgid "The condition doesn't evaluate correctly!" -msgstr "" - -#. module: auth_dynamic_groups -#: help:res.groups,dynamic_group_condition:0 -msgid "" -"The condition to be met for a user to be a member of this group. It is " -"evaluated as python code at login time, you get `user` passed as a browse " -"record" -msgstr "" - -#. module: auth_dynamic_groups -#: model:ir.model,name:auth_dynamic_groups.model_res_users -msgid "Users" -msgstr "Benutzer" - -#. module: auth_dynamic_groups -#: view:res.groups:auth_dynamic_groups.view_groups_form -msgid "{'readonly': [('is_dynamic', '=', True)]}" -msgstr "" diff --git a/auth_dynamic_groups/i18n/es.po b/auth_dynamic_groups/i18n/es.po deleted file mode 100644 index b661eb717..000000000 --- a/auth_dynamic_groups/i18n/es.po +++ /dev/null @@ -1,67 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * auth_dynamic_groups -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: server-tools (8.0)\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-09-29 11:14+0000\n" -"PO-Revision-Date: 2015-09-18 13:53+0000\n" -"Last-Translator: <>\n" -"Language-Team: Spanish (http://www.transifex.com/oca/OCA-server-tools-8-0/language/es/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Language: es\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#. module: auth_dynamic_groups -#: model:ir.model,name:auth_dynamic_groups.model_res_groups -msgid "Access Groups" -msgstr "" - -#. module: auth_dynamic_groups -#: field:res.groups,dynamic_group_condition:0 -msgid "Condition" -msgstr "" - -#. module: auth_dynamic_groups -#: field:res.groups,is_dynamic:0 -msgid "Dynamic" -msgstr "" - -#. module: auth_dynamic_groups -#: view:res.groups:auth_dynamic_groups.view_groups_form -msgid "Evaluate" -msgstr "" - -#. module: auth_dynamic_groups -#: view:res.groups:auth_dynamic_groups.view_groups_form -msgid "Fill in your condition..." -msgstr "" - -#. module: auth_dynamic_groups -#: code:addons/auth_dynamic_groups/model/res_groups.py:57 -#, python-format -msgid "The condition doesn't evaluate correctly!" -msgstr "" - -#. module: auth_dynamic_groups -#: help:res.groups,dynamic_group_condition:0 -msgid "" -"The condition to be met for a user to be a member of this group. It is " -"evaluated as python code at login time, you get `user` passed as a browse " -"record" -msgstr "" - -#. module: auth_dynamic_groups -#: model:ir.model,name:auth_dynamic_groups.model_res_users -msgid "Users" -msgstr "Usuarios" - -#. module: auth_dynamic_groups -#: view:res.groups:auth_dynamic_groups.view_groups_form -msgid "{'readonly': [('is_dynamic', '=', True)]}" -msgstr "" diff --git a/auth_dynamic_groups/i18n/fr.po b/auth_dynamic_groups/i18n/fr.po deleted file mode 100644 index 3c5eb038a..000000000 --- a/auth_dynamic_groups/i18n/fr.po +++ /dev/null @@ -1,67 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * auth_dynamic_groups -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: server-tools (8.0)\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-09-29 11:14+0000\n" -"PO-Revision-Date: 2015-09-18 13:53+0000\n" -"Last-Translator: <>\n" -"Language-Team: French (http://www.transifex.com/oca/OCA-server-tools-8-0/language/fr/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Language: fr\n" -"Plural-Forms: nplurals=2; plural=(n > 1);\n" - -#. module: auth_dynamic_groups -#: model:ir.model,name:auth_dynamic_groups.model_res_groups -msgid "Access Groups" -msgstr "" - -#. module: auth_dynamic_groups -#: field:res.groups,dynamic_group_condition:0 -msgid "Condition" -msgstr "" - -#. module: auth_dynamic_groups -#: field:res.groups,is_dynamic:0 -msgid "Dynamic" -msgstr "" - -#. module: auth_dynamic_groups -#: view:res.groups:auth_dynamic_groups.view_groups_form -msgid "Evaluate" -msgstr "" - -#. module: auth_dynamic_groups -#: view:res.groups:auth_dynamic_groups.view_groups_form -msgid "Fill in your condition..." -msgstr "" - -#. module: auth_dynamic_groups -#: code:addons/auth_dynamic_groups/model/res_groups.py:57 -#, python-format -msgid "The condition doesn't evaluate correctly!" -msgstr "" - -#. module: auth_dynamic_groups -#: help:res.groups,dynamic_group_condition:0 -msgid "" -"The condition to be met for a user to be a member of this group. It is " -"evaluated as python code at login time, you get `user` passed as a browse " -"record" -msgstr "" - -#. module: auth_dynamic_groups -#: model:ir.model,name:auth_dynamic_groups.model_res_users -msgid "Users" -msgstr "Utilisateurs" - -#. module: auth_dynamic_groups -#: view:res.groups:auth_dynamic_groups.view_groups_form -msgid "{'readonly': [('is_dynamic', '=', True)]}" -msgstr "" diff --git a/auth_dynamic_groups/i18n/pt_BR.po b/auth_dynamic_groups/i18n/pt_BR.po deleted file mode 100644 index ee171a221..000000000 --- a/auth_dynamic_groups/i18n/pt_BR.po +++ /dev/null @@ -1,68 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * auth_dynamic_groups -# -# Translators: -# Armando Vulcano Junior , 2015 -msgid "" -msgstr "" -"Project-Id-Version: server-tools (8.0)\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-09-29 11:14+0000\n" -"PO-Revision-Date: 2015-09-18 20:45+0000\n" -"Last-Translator: Armando Vulcano Junior \n" -"Language-Team: Portuguese (Brazil) (http://www.transifex.com/oca/OCA-server-tools-8-0/language/pt_BR/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Language: pt_BR\n" -"Plural-Forms: nplurals=2; plural=(n > 1);\n" - -#. module: auth_dynamic_groups -#: model:ir.model,name:auth_dynamic_groups.model_res_groups -msgid "Access Groups" -msgstr "Grupos de Acesso" - -#. module: auth_dynamic_groups -#: field:res.groups,dynamic_group_condition:0 -msgid "Condition" -msgstr "Condição" - -#. module: auth_dynamic_groups -#: field:res.groups,is_dynamic:0 -msgid "Dynamic" -msgstr "Dinâmico" - -#. module: auth_dynamic_groups -#: view:res.groups:auth_dynamic_groups.view_groups_form -msgid "Evaluate" -msgstr "Avaliar" - -#. module: auth_dynamic_groups -#: view:res.groups:auth_dynamic_groups.view_groups_form -msgid "Fill in your condition..." -msgstr "Preencha na sua condição..." - -#. module: auth_dynamic_groups -#: code:addons/auth_dynamic_groups/model/res_groups.py:57 -#, python-format -msgid "The condition doesn't evaluate correctly!" -msgstr "Condição não avalia corretamente!" - -#. module: auth_dynamic_groups -#: help:res.groups,dynamic_group_condition:0 -msgid "" -"The condition to be met for a user to be a member of this group. It is " -"evaluated as python code at login time, you get `user` passed as a browse " -"record" -msgstr "A condição a ser cumprida para um usuário ser um membro deste grupo. É avaliado como código python no momento do login, você pega `user` passado como um registro de procura" - -#. module: auth_dynamic_groups -#: model:ir.model,name:auth_dynamic_groups.model_res_users -msgid "Users" -msgstr "Usuários" - -#. module: auth_dynamic_groups -#: view:res.groups:auth_dynamic_groups.view_groups_form -msgid "{'readonly': [('is_dynamic', '=', True)]}" -msgstr "{'readonly': [('is_dynamic', '=', True)]}" diff --git a/auth_dynamic_groups/i18n/sl.po b/auth_dynamic_groups/i18n/sl.po deleted file mode 100644 index d55faaafa..000000000 --- a/auth_dynamic_groups/i18n/sl.po +++ /dev/null @@ -1,68 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * auth_dynamic_groups -# -# Translators: -# Matjaž Mozetič , 2015 -msgid "" -msgstr "" -"Project-Id-Version: server-tools (8.0)\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-09-29 11:14+0000\n" -"PO-Revision-Date: 2015-09-24 11:47+0000\n" -"Last-Translator: Matjaž Mozetič \n" -"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-server-tools-8-0/language/sl/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Language: sl\n" -"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n" - -#. module: auth_dynamic_groups -#: model:ir.model,name:auth_dynamic_groups.model_res_groups -msgid "Access Groups" -msgstr "Dostopne skupine" - -#. module: auth_dynamic_groups -#: field:res.groups,dynamic_group_condition:0 -msgid "Condition" -msgstr "Pogoj" - -#. module: auth_dynamic_groups -#: field:res.groups,is_dynamic:0 -msgid "Dynamic" -msgstr "Dinamične" - -#. module: auth_dynamic_groups -#: view:res.groups:auth_dynamic_groups.view_groups_form -msgid "Evaluate" -msgstr "Ovrednoti" - -#. module: auth_dynamic_groups -#: view:res.groups:auth_dynamic_groups.view_groups_form -msgid "Fill in your condition..." -msgstr "Izpolnite svoj pogoj..." - -#. module: auth_dynamic_groups -#: code:addons/auth_dynamic_groups/model/res_groups.py:57 -#, python-format -msgid "The condition doesn't evaluate correctly!" -msgstr "Pogoj se ne ovrednoti pravilno!" - -#. module: auth_dynamic_groups -#: help:res.groups,dynamic_group_condition:0 -msgid "" -"The condition to be met for a user to be a member of this group. It is " -"evaluated as python code at login time, you get `user` passed as a browse " -"record" -msgstr "Pogoj, ki ga mora uporabnik izpolniti, da bi bil član te skupine. Ovrednoten je kot python koda ob prijavi. Uporabnik je spuščen kot brskalni zapis." - -#. module: auth_dynamic_groups -#: model:ir.model,name:auth_dynamic_groups.model_res_users -msgid "Users" -msgstr "Uporabniki" - -#. module: auth_dynamic_groups -#: view:res.groups:auth_dynamic_groups.view_groups_form -msgid "{'readonly': [('is_dynamic', '=', True)]}" -msgstr "{'readonly': [('is_dynamic', '=', True)]}" diff --git a/auth_dynamic_groups/model/__init__.py b/auth_dynamic_groups/model/__init__.py deleted file mode 100644 index ad311212d..000000000 --- a/auth_dynamic_groups/model/__init__.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# This module copyright (C) 2013 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 . import res_users -from . import res_groups diff --git a/auth_dynamic_groups/model/res_groups.py b/auth_dynamic_groups/model/res_groups.py deleted file mode 100644 index d528da80a..000000000 --- a/auth_dynamic_groups/model/res_groups.py +++ /dev/null @@ -1,63 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# This module copyright (C) 2013 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, exceptions -from openerp.tools.safe_eval import safe_eval -from openerp import _ - - -class res_groups(models.Model): - _inherit = 'res.groups' - - is_dynamic = fields.Boolean('Dynamic') - dynamic_group_condition = fields.Text( - 'Condition', help='The condition to be met for a user to be a ' - 'member of this group. It is evaluated as python code at login ' - 'time, you get `user` passed as a browse record') - - @api.multi - def eval_dynamic_group_condition(self, uid=None): - user = self.env['res.users'].browse([uid]) if uid else self.env.user - result = all( - self.mapped( - lambda this: safe_eval( - this.dynamic_group_condition or 'False', - { - 'user': user.sudo(), - 'any': any, - 'all': all, - 'filter': filter, - }))) - return result - - @api.multi - @api.constrains('dynamic_group_condition') - def _check_dynamic_group_condition(self): - try: - self.filtered('is_dynamic').eval_dynamic_group_condition() - except (NameError, SyntaxError, TypeError): - raise exceptions.ValidationError( - _('The condition doesn\'t evaluate correctly!')) - - @api.multi - def action_evaluate(self): - res_users = self.env['res.users'] - for user in res_users.search([]): - res_users.update_dynamic_groups(user.id, self.env.cr.dbname) diff --git a/auth_dynamic_groups/model/res_users.py b/auth_dynamic_groups/model/res_users.py deleted file mode 100644 index ee96be56b..000000000 --- a/auth_dynamic_groups/model/res_users.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# This module copyright (C) 2013 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.models import Model -from openerp.modules.registry import RegistryManager -from openerp import SUPERUSER_ID - - -class res_users(Model): - _inherit = 'res.users' - - def _login(self, db, login, password): - uid = super(res_users, self)._login(db, login, password) - - if uid: - self.update_dynamic_groups(uid, db) - - return uid - - def update_dynamic_groups(self, uid, db): - pool = RegistryManager.get(db) - cr = pool._db.cursor() - user = pool.get('res.users').browse(cr, SUPERUSER_ID, uid) - groups_obj = pool.get('res.groups') - user.write( - { - 'groups_id': [ - (4, dynamic_group.id) - if dynamic_group.eval_dynamic_group_condition(uid=uid) - else (3, dynamic_group.id) - for dynamic_group in groups_obj.browse( - cr, SUPERUSER_ID, - groups_obj.search(cr, SUPERUSER_ID, - [('is_dynamic', '=', True)])) - ], - }) - cr.commit() - cr.close() diff --git a/auth_dynamic_groups/static/description/icon.png b/auth_dynamic_groups/static/description/icon.png deleted file mode 100644 index 3a0328b51..000000000 Binary files a/auth_dynamic_groups/static/description/icon.png and /dev/null differ diff --git a/auth_dynamic_groups/view/res_groups.xml b/auth_dynamic_groups/view/res_groups.xml deleted file mode 100644 index 348d66be1..000000000 --- a/auth_dynamic_groups/view/res_groups.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - res.groups - - - - - - - {'readonly': [('is_dynamic', '=', True)]} - - - - -