Skip to content

Commit 71412d5

Browse files
committed
[ADD] model_access_restriction
1 parent 3471ce2 commit 71412d5

20 files changed

+1092
-0
lines changed

model_access_restriction/README.rst

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
========================
2+
Model Access Restriction
3+
========================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:6337b5f5fe7be747949769f4c064d9a6ca5495d905fa33e50b868be80bde4557
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--backend-lightgray.png?logo=github
20+
:target: https://github.com/OCA/server-backend/tree/15.0/model_access_restriction
21+
:alt: OCA/server-backend
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/server-backend-15-0/server-backend-15-0-model_access_restriction
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-backend&target_branch=15.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module adds a new model to configure Odoo permissions, the "Model
32+
Access Restrictions"
33+
34+
This model allows to restrict the access to a model for all users except
35+
the ones that belong to at least one group of a list of allowed groups.
36+
37+
While Odoo's default access rules provide permissions, and having one
38+
already gives you access, these new rules remove them, and failing to
39+
comply with one restricts your access.
40+
41+
**Table of contents**
42+
43+
.. contents::
44+
:local:
45+
46+
Configuration
47+
=============
48+
49+
To configure this module, you need to:
50+
51+
- Go to Settings / Technical / Security / Model Access Restrictions
52+
- Create a new access restriction
53+
- Select the model to restrict the access
54+
- Select the operations the rule applies to. If the operation is not
55+
selected the restriction won't apply to that operation which means
56+
users will access the model as always.
57+
- Select the groups that will have access to the model. The rest of
58+
groups will have the access disabled.
59+
60+
**Interaction between access records**
61+
62+
Normal access records give permissions. Access restriction records
63+
remove permissions. If a user does not have one group of a restriction,
64+
the access will be forbidden.
65+
66+
Detailed algorithm:
67+
68+
1. Normal access records are combined together with a logical OR
69+
operator. If a user has the group of an access record, access will be
70+
granted.
71+
2. Access restriction records are applied before normal access, and
72+
combined together with a logical AND operator. If a restriction is
73+
not met, the access is forbidden.
74+
3. A restriction is not met if the user does not belong to any of the
75+
allowed groups.
76+
77+
Example:
78+
``ACCESS_1 OR ACCESS_2 AND (ACCESS_RESTRICTION_1 AND ACCESS_RESTRICTION_2)``
79+
80+
- ACCESS_1: Group: Internal Users
81+
- ACCESS_2 Group: Administrator
82+
- \***\*: Allowed Groups: Internal Users
83+
- ACCESS_RESTRICTION_2 Allowed Groups: Administrator
84+
85+
| An internal user won't have access in this example because they do not
86+
meet the requirement of ACCESS_RESTRICTION_2.
87+
| ``TRUE OR FALSE AND (TRUE AND FALSE) = TRUE AND (FALSE) = FALSE``
88+
89+
Known issues / Roadmap
90+
======================
91+
92+
- Read and write permissions are not implemented yet.
93+
94+
Bug Tracker
95+
===========
96+
97+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-backend/issues>`_.
98+
In case of trouble, please check there if your issue has already been reported.
99+
If you spotted it first, help us to smash it by providing a detailed and welcomed
100+
`feedback <https://github.com/OCA/server-backend/issues/new?body=module:%20model_access_restriction%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
101+
102+
Do not contact contributors directly about support or help with technical issues.
103+
104+
Credits
105+
=======
106+
107+
Authors
108+
-------
109+
110+
* Sygel
111+
112+
Contributors
113+
------------
114+
115+
- `Sygel <https://www.sygel.es>`__:
116+
117+
- Alberto Martínez
118+
- Manuel Regidor
119+
- Valentin Vinagre
120+
- Harald Panten
121+
122+
Maintainers
123+
-----------
124+
125+
This module is maintained by the OCA.
126+
127+
.. image:: https://odoo-community.org/logo.png
128+
:alt: Odoo Community Association
129+
:target: https://odoo-community.org
130+
131+
OCA, or the Odoo Community Association, is a nonprofit organization whose
132+
mission is to support the collaborative development of Odoo features and
133+
promote its widespread use.
134+
135+
.. |maintainer-tisho99| image:: https://github.com/tisho99.png?size=40px
136+
:target: https://github.com/tisho99
137+
:alt: tisho99
138+
139+
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
140+
141+
|maintainer-tisho99|
142+
143+
This module is part of the `OCA/server-backend <https://github.com/OCA/server-backend/tree/15.0/model_access_restriction>`_ project on GitHub.
144+
145+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

model_access_restriction/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
2+
3+
from . import models
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright 2025 Alberto Martínez <[email protected]>
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
{
4+
"name": "Model Access Restriction",
5+
"summary": "New type of access rule to restrict permissions based on groups",
6+
"version": "15.0.1.0.0",
7+
"category": "Tools",
8+
"website": "https://github.com/OCA/server-backend",
9+
"author": "Sygel, Odoo Community Association (OCA)",
10+
"maintainers": ["tisho99"],
11+
"license": "AGPL-3",
12+
"application": False,
13+
"installable": True,
14+
"depends": [
15+
"base",
16+
],
17+
"data": [
18+
"security/ir.model.access.csv",
19+
"views/ir_model_access_restriction_views.xml",
20+
],
21+
}

0 commit comments

Comments
 (0)