Skip to content
Merged
Show file tree
Hide file tree
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 Jan 14, 2015
ccca803
[RFR] new api/views
hbrunn Jan 14, 2015
36780d0
[FIX] pylint
hbrunn Jan 14, 2015
30fd50e
[ADD] example
hbrunn Jan 14, 2015
bffeb0d
[REN] README.rst
hbrunn Jan 15, 2015
49fbd2e
[FIX] browse and search groups with superuser permissions
hbrunn Mar 4, 2015
a36f139
[FIX] when evaluating the dynamic group, sudo to the user
hbrunn Jun 4, 2015
402fadc
Revert "[FIX] when evaluating the dynamic group, sudo to the user"
hbrunn Jun 4, 2015
b66cb33
[FIX] use correct user when evaluating group condition
hbrunn Jun 4, 2015
c932923
fix runbot warning
gurneyalex Jul 17, 2015
30916ea
Add missing default oca icons
yvaucher Aug 18, 2015
ede996d
[FIX] don't error out on empty group condition
hbrunn Aug 26, 2015
b4df6bf
[FIX] use a nonserialized cursor for updating user groups
hbrunn Sep 8, 2015
f41644f
[FIX] actually use a nonserialized cursor
hbrunn Sep 8, 2015
11f2974
[FIX] update groups with sql
hbrunn Sep 8, 2015
79d154a
[FIX] don't do anything for admin
hbrunn Sep 8, 2015
3ba753f
[UPD] prefix versions with 8.0
sbidoul Oct 9, 2015
4668a6a
[FIX] we need to call our login method old style
hbrunn Feb 24, 2016
5a8ff42
OCA Transbot updated translations from Transifex
oca-transbot Oct 5, 2015
f49a35a
[FIX] rst syntax errors
sbidoul Jun 2, 2018
bdb39fa
[UPD] Update auth_dynamic_groups.pot
oca-travis Jun 24, 2018
8ebd93a
[FIX] don't break when there are no dynamic groups
hbrunn Dec 11, 2018
96032da
[FIX] linting issues
hbrunn Dec 11, 2018
47f6568
[FIX] add OCA as author
hbrunn Dec 11, 2018
4a66463
[MIG] auth_dynamic_groups to v10
hbrunn May 13, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 107 additions & 0 deletions auth_dynamic_groups/README.rst
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.
3 changes: 3 additions & 0 deletions auth_dynamic_groups/__init__.py
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
19 changes: 19 additions & 0 deletions auth_dynamic_groups/__manifest__.py
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",

Copy link
Copy Markdown
Member

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/

"website": "https://github.com/OCA/server-auth",
"depends": [
'base',
],
"data": [
'views/res_groups.xml',
],
}
69 changes: 69 additions & 0 deletions auth_dynamic_groups/i18n/ar.po
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 ""
61 changes: 61 additions & 0 deletions auth_dynamic_groups/i18n/auth_dynamic_groups.pot
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 ""

68 changes: 68 additions & 0 deletions auth_dynamic_groups/i18n/ca.po
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 ""
Loading