-
-
Notifications
You must be signed in to change notification settings - Fork 538
[MIG] auth_dynamic_groups to v10 #96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
3a60309
[ADD] auth_dynamic_groups
hbrunn ccca803
[RFR] new api/views
hbrunn 36780d0
[FIX] pylint
hbrunn 30fd50e
[ADD] example
hbrunn bffeb0d
[REN] README.rst
hbrunn 49fbd2e
[FIX] browse and search groups with superuser permissions
hbrunn a36f139
[FIX] when evaluating the dynamic group, sudo to the user
hbrunn 402fadc
Revert "[FIX] when evaluating the dynamic group, sudo to the user"
hbrunn b66cb33
[FIX] use correct user when evaluating group condition
hbrunn c932923
fix runbot warning
gurneyalex 30916ea
Add missing default oca icons
yvaucher ede996d
[FIX] don't error out on empty group condition
hbrunn b4df6bf
[FIX] use a nonserialized cursor for updating user groups
hbrunn f41644f
[FIX] actually use a nonserialized cursor
hbrunn 11f2974
[FIX] update groups with sql
hbrunn 79d154a
[FIX] don't do anything for admin
hbrunn 3ba753f
[UPD] prefix versions with 8.0
sbidoul 4668a6a
[FIX] we need to call our login method old style
hbrunn 5a8ff42
OCA Transbot updated translations from Transifex
oca-transbot f49a35a
[FIX] rst syntax errors
sbidoul bdb39fa
[UPD] Update auth_dynamic_groups.pot
oca-travis 8ebd93a
[FIX] don't break when there are no dynamic groups
hbrunn 96032da
[FIX] linting issues
hbrunn 47f6568
[FIX] add OCA as author
hbrunn 4a66463
[MIG] auth_dynamic_groups to v10
hbrunn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| ============== | ||
| Dynamic groups | ||
| ============== | ||
|
|
||
| .. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
| !! This file is generated by oca-gen-addon-readme !! | ||
| !! changes will be overwritten. !! | ||
| !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
|
|
||
| .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png | ||
| :target: https://odoo-community.org/page/development-status | ||
| :alt: Beta | ||
| .. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png | ||
| :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
| :alt: License: AGPL-3 | ||
| .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--auth-lightgray.png?logo=github | ||
| :target: https://github.com/OCA/server-auth/tree/10.0/auth_dynamic_groups | ||
| :alt: OCA/server-auth | ||
| .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
| :target: https://translation.odoo-community.org/projects/server-auth-10-0/server-auth-10-0-auth_dynamic_groups | ||
| :alt: Translate me on Weblate | ||
| .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png | ||
| :target: https://runbot.odoo-community.org/runbot/251/10.0 | ||
| :alt: Try me on Runbot | ||
|
|
||
| |badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
|
||
| 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. | ||
|
|
||
| **Table of contents** | ||
|
|
||
| .. contents:: | ||
| :local: | ||
|
|
||
| Configuration | ||
| ============= | ||
|
|
||
| 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. | ||
|
|
||
| Usage | ||
| ===== | ||
|
|
||
| We have a group called `Amsterdam` and want it to contain all users from | ||
| city of Amsterdam. So we use the membership condition | ||
|
|
||
| .. code:: python | ||
|
|
||
| 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. | ||
|
|
||
| Bug Tracker | ||
| =========== | ||
|
|
||
| Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-auth/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 <https://github.com/OCA/server-auth/issues/new?body=module:%20auth_dynamic_groups%0Aversion:%2010.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
|
||
| Do not contact contributors directly about support or help with technical issues. | ||
|
|
||
| Credits | ||
| ======= | ||
|
|
||
| Authors | ||
| ~~~~~~~ | ||
|
|
||
| * Therp BV | ||
|
|
||
| Contributors | ||
| ~~~~~~~~~~~~ | ||
|
|
||
| * Holger Brunn <hbrunn@therp.nl> | ||
|
|
||
| Other credits | ||
| ~~~~~~~~~~~~~ | ||
|
|
||
| * Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_. | ||
|
|
||
| Maintainers | ||
| ~~~~~~~~~~~ | ||
|
|
||
| This module is maintained by the OCA. | ||
|
|
||
| .. image:: https://odoo-community.org/logo.png | ||
| :alt: Odoo Community Association | ||
| :target: https://odoo-community.org | ||
|
|
||
| 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. | ||
|
|
||
| This module is part of the `OCA/server-auth <https://github.com/OCA/server-auth/tree/10.0/auth_dynamic_groups>`_ project on GitHub. | ||
|
|
||
| You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # -*- coding: utf-8 -*- | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
| from . import models |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # -*- coding: utf-8 -*- | ||
| # Copyright 2013-2019 Therp BV <https://therp.nl> | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
| { | ||
| "name": "Dynamic groups", | ||
| "version": "10.0.1.0.0", | ||
| "author": "Odoo Community Association (OCA),Therp BV", | ||
| "license": "AGPL-3", | ||
| "complexity": "normal", | ||
| 'summary': 'Have membership conditions for certain groups', | ||
| "category": "Tools", | ||
| "website": "https://github.com/OCA/server-auth", | ||
| "depends": [ | ||
| 'base', | ||
| ], | ||
| "data": [ | ||
| 'views/res_groups.xml', | ||
| ], | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| # 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: 2017-01-12 03:50+0000\n" | ||
| "PO-Revision-Date: 2015-09-18 13:53+0000\n" | ||
| "Last-Translator: <>\n" | ||
| "Language-Team: Arabic (http://www.transifex.com/oca/OCA-server-tools-8-0/" | ||
| "language/ar/)\n" | ||
| "Language: ar\n" | ||
| "MIME-Version: 1.0\n" | ||
| "Content-Type: text/plain; charset=UTF-8\n" | ||
| "Content-Transfer-Encoding: \n" | ||
| "Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 " | ||
| "&& n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\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 "المستخدمون" | ||
|
|
||
| #. module: auth_dynamic_groups | ||
| #: view:res.groups:auth_dynamic_groups.view_groups_form | ||
| msgid "{'readonly': [('is_dynamic', '=', True)]}" | ||
| msgstr "" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| # Translation of Odoo Server. | ||
| # This file contains the translation of the following modules: | ||
| # * auth_dynamic_groups | ||
| # | ||
| msgid "" | ||
| msgstr "" | ||
| "Project-Id-Version: Odoo Server 8.0\n" | ||
| "Report-Msgid-Bugs-To: \n" | ||
| "Last-Translator: <>\n" | ||
| "Language-Team: \n" | ||
| "MIME-Version: 1.0\n" | ||
| "Content-Type: text/plain; charset=UTF-8\n" | ||
| "Content-Transfer-Encoding: \n" | ||
| "Plural-Forms: \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 "" | ||
|
|
||
| #. module: auth_dynamic_groups | ||
| #: view:res.groups:auth_dynamic_groups.view_groups_form | ||
| msgid "{'readonly': [('is_dynamic', '=', True)]}" | ||
| msgstr "" | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| # 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: 2017-01-17 07:51+0000\n" | ||
| "PO-Revision-Date: 2015-09-18 13:53+0000\n" | ||
| "Last-Translator: <>\n" | ||
| "Language-Team: Catalan (http://www.transifex.com/oca/OCA-server-tools-8-0/" | ||
| "language/ca/)\n" | ||
| "Language: ca\n" | ||
| "MIME-Version: 1.0\n" | ||
| "Content-Type: text/plain; charset=UTF-8\n" | ||
| "Content-Transfer-Encoding: \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 "Usuaris" | ||
|
|
||
| #. module: auth_dynamic_groups | ||
| #: view:res.groups:auth_dynamic_groups.view_groups_form | ||
| msgid "{'readonly': [('is_dynamic', '=', True)]}" | ||
| msgstr "" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add the website attribute with the value https://github.com/OCA/server-auth/