Skip to content

Commit 953de38

Browse files
committed
[MIG] Migrate the base_user_effective_permissions module to 18.0
1 parent 4e0e191 commit 953de38

11 files changed

Lines changed: 68 additions & 68 deletions

File tree

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
.. image:: https://odoo-community.org/readme-banner-image
2-
:target: https://odoo-community.org/get-involved?utm_source=readme
3-
:alt: Odoo Community Association
4-
51
=====================
62
Effective permissions
73
=====================
@@ -11,30 +7,28 @@ Effective permissions
117
!! This file is generated by oca-gen-addon-readme !!
128
!! changes will be overwritten. !!
139
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
14-
!! source digest: sha256:6ab0c6da14468468b84fa735a100b0e9148e2c6a2afc7ad9c5be8f644078ea21
10+
!! source digest: sha256:5108ef47acdaa695d28924080b90d6d1c72304a18c7cd09f4314fa0ecdeab7b0
1511
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1612
1713
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
1814
:target: https://odoo-community.org/page/development-status
1915
:alt: Alpha
20-
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
2117
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
2218
:alt: License: AGPL-3
2319
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--backend-lightgray.png?logo=github
24-
:target: https://github.com/OCA/server-backend/tree/18.0/base_user_effective_permissions
20+
:target: https://github.com/OCA/server-backend/tree/16.0/base_user_effective_permissions
2521
:alt: OCA/server-backend
2622
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
27-
:target: https://translation.odoo-community.org/projects/server-backend-18-0/server-backend-18-0-base_user_effective_permissions
23+
:target: https://translation.odoo-community.org/projects/server-backend-16-0/server-backend-16-0-base_user_effective_permissions
2824
:alt: Translate me on Weblate
2925
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
30-
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-backend&target_branch=18.0
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-backend&target_branch=16.0
3127
:alt: Try me on Runboat
3228

3329
|badge1| |badge2| |badge3| |badge4| |badge5|
3430

35-
This module shows administrators a combined view of access rights and
36-
record rules per model with expressions expanded. This is convenient for
37-
reviewing permissions.
31+
This module shows administrators a combined view of access rights and record rules per model with expressions expanded. This is convenient for reviewing permissions.
3832

3933
.. IMPORTANT::
4034
This is an alpha version, the data model and design can change at any time without warning.
@@ -51,38 +45,36 @@ Usage
5145

5246
To use this module, you need to be in developer mode and:
5347

54-
1. Go to Settings/Users & Companies
55-
2. Open a user
56-
3. Click the Effective permissions button
57-
4. Note you can switch between the rule domains in text form or as
58-
domain widget
48+
#. Go to Settings/Users & Companies
49+
#. Open a user
50+
#. Click the `Effective permissions` button
51+
#. Note you can switch between the rule domains in text form or as domain widget
5952

6053
Bug Tracker
6154
===========
6255

6356
Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-backend/issues>`_.
6457
In case of trouble, please check there if your issue has already been reported.
6558
If you spotted it first, help us to smash it by providing a detailed and welcomed
66-
`feedback <https://github.com/OCA/server-backend/issues/new?body=module:%20base_user_effective_permissions%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
59+
`feedback <https://github.com/OCA/server-backend/issues/new?body=module:%20base_user_effective_permissions%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
6760

6861
Do not contact contributors directly about support or help with technical issues.
6962

7063
Credits
7164
=======
7265

7366
Authors
74-
-------
67+
~~~~~~~
7568

7669
* Hunki Enterprises BV
7770

7871
Contributors
79-
------------
72+
~~~~~~~~~~~~
8073

81-
- Holger Brunn <mail@hunki-enterprises.com>
82-
(https://hunki-enterprises.com)
74+
* Holger Brunn <mail@hunki-enterprises.com> (https://hunki-enterprises.com)
8375

8476
Maintainers
85-
-----------
77+
~~~~~~~~~~~
8678

8779
This module is maintained by the OCA.
8880

@@ -102,6 +94,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
10294

10395
|maintainer-hbrunn|
10496

105-
This module is part of the `OCA/server-backend <https://github.com/OCA/server-backend/tree/18.0/base_user_effective_permissions>`_ project on GitHub.
97+
This module is part of the `OCA/server-backend <https://github.com/OCA/server-backend/tree/16.0/base_user_effective_permissions>`_ project on GitHub.
10698

10799
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

base_user_effective_permissions/__manifest__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Copyright 2023 Hunki Enterprises BV
22
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0)
3-
43
{
54
"name": "Effective permissions",
65
"summary": "Inspect effective permissions applying to a user",

base_user_effective_permissions/i18n/base_user_effective_permissions.pot

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
msgid ""
66
msgstr ""
7-
"Project-Id-Version: Odoo Server 18.0\n"
7+
"Project-Id-Version: Odoo Server 16.0\n"
88
"Report-Msgid-Bugs-To: \n"
99
"Last-Translator: \n"
1010
"Language-Team: \n"
@@ -71,6 +71,7 @@ msgstr ""
7171
#. module: base_user_effective_permissions
7272
#. odoo-python
7373
#: code:addons/base_user_effective_permissions/models/res_users.py:0
74+
#, python-format
7475
msgid "Effective permissions for %s"
7576
msgstr ""
7677

@@ -84,6 +85,11 @@ msgstr ""
8485
msgid "ID"
8586
msgstr ""
8687

88+
#. module: base_user_effective_permissions
89+
#: model:ir.model.fields,field_description:base_user_effective_permissions.field_res_users_effective_permission____last_update
90+
msgid "Last Modified on"
91+
msgstr ""
92+
8793
#. module: base_user_effective_permissions
8894
#: model:ir.model.fields,field_description:base_user_effective_permissions.field_res_users_effective_permission__write_uid
8995
msgid "Last Updated by"

base_user_effective_permissions/models/res_users.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0)
33

44

5-
from odoo import _, models
5+
from odoo import models
66

77

88
class ResUsers(models.Model):
@@ -15,9 +15,8 @@ def action_show_effective_permissions(self):
1515
)
1616
return {
1717
"type": "ir.actions.act_window",
18-
"name": _("Effective permissions for %s") % self.name,
18+
"name": self.env._("Effective permissions for %s") % self.name,
1919
"res_model": "res.users.effective.permission",
2020
"view_mode": "list",
21-
"views": [[False, "list"]],
2221
"domain": [("id", "in", permissions.ids)],
2322
}

base_user_effective_permissions/models/res_users_effective_permission.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ class ResUsersEffectivePermission(models.TransientModel):
1313
model_id = fields.Many2one("ir.model", string="Model")
1414
model_name = fields.Char(related="model_id.model", string="Model name")
1515
model_human_name = fields.Char(
16-
related="model_id.name", string="Human readable model name"
16+
related="model_id.name",
17+
store=True,
18+
string="Human readable model name",
19+
translate=False,
1720
)
1821
create_permission = fields.Boolean("Create")
1922
create_domain = fields.Char("Create restrictions")
@@ -48,17 +51,20 @@ def _generate_permissions(self, user):
4851
.with_company(user.company_id)
4952
.with_context(allowed_company_ids=user.company_id.ids)
5053
)
51-
if model._abstract:
52-
continue
5354
vals = {"model_id": model_record.id}
54-
ir_model_access = self.env["ir.model.access"].with_user(user)
55-
for operation in operations:
56-
vals[f"{operation}_permission"] = ir_model_access.check(
57-
model._name, operation, raise_exception=False
58-
)
59-
if vals[f"{operation}_permission"]:
60-
vals[f"{operation}_domain"] = IrRule._compute_domain(
55+
vals.update(
56+
{
57+
"%s_permission" % operation: model.has_access(operation)
58+
for operation in operations
59+
}
60+
)
61+
vals.update(
62+
{
63+
"%s_domain" % operation: IrRule._compute_domain(
6164
model._name, operation
6265
)
66+
for operation in operations
67+
}
68+
)
6369
permissions += self.create(vals)
6470
return permissions
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
- Holger Brunn \<mail@hunki-enterprises.com\>
1+
-OCA Holger Brunn \<mail@hunki-enterprises.com\>
22
(<https://hunki-enterprises.com>)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* Holger Brunn <mail@hunki-enterprises.com> (https://hunki-enterprises.com)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This module shows administrators a combined view of access rights and record rules per model with expressions expanded. This is convenient for reviewing permissions.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
To use this module, you need to be in developer mode and:
2+
3+
#. Go to Settings/Users & Companies
4+
#. Open a user
5+
#. Click the `Effective permissions` button
6+
#. Note you can switch between the rule domains in text form or as domain widget

base_user_effective_permissions/static/description/index.html

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
55
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
6-
<title>README.rst</title>
6+
<title>Effective permissions</title>
77
<style type="text/css">
88

99
/*
@@ -360,24 +360,17 @@
360360
</style>
361361
</head>
362362
<body>
363-
<div class="document">
363+
<div class="document" id="effective-permissions">
364+
<h1 class="title">Effective permissions</h1>
364365

365-
366-
<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
367-
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
368-
</a>
369-
<div class="section" id="effective-permissions">
370-
<h1>Effective permissions</h1>
371366
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
372367
!! This file is generated by oca-gen-addon-readme !!
373368
!! changes will be overwritten. !!
374369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
375-
!! source digest: sha256:6ab0c6da14468468b84fa735a100b0e9148e2c6a2afc7ad9c5be8f644078ea21
370+
!! source digest: sha256:5108ef47acdaa695d28924080b90d6d1c72304a18c7cd09f4314fa0ecdeab7b0
376371
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
377-
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Alpha" src="https://img.shields.io/badge/maturity-Alpha-red.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-backend/tree/18.0/base_user_effective_permissions"><img alt="OCA/server-backend" src="https://img.shields.io/badge/github-OCA%2Fserver--backend-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-backend-18-0/server-backend-18-0-base_user_effective_permissions"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/server-backend&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
378-
<p>This module shows administrators a combined view of access rights and
379-
record rules per model with expressions expanded. This is convenient for
380-
reviewing permissions.</p>
372+
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Alpha" src="https://img.shields.io/badge/maturity-Alpha-red.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-backend/tree/16.0/base_user_effective_permissions"><img alt="OCA/server-backend" src="https://img.shields.io/badge/github-OCA%2Fserver--backend-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-backend-16-0/server-backend-16-0-base_user_effective_permissions"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/server-backend&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373+
<p>This module shows administrators a combined view of access rights and record rules per model with expressions expanded. This is convenient for reviewing permissions.</p>
381374
<div class="admonition important">
382375
<p class="first admonition-title">Important</p>
383376
<p class="last">This is an alpha version, the data model and design can change at any time without warning.
@@ -398,41 +391,39 @@ <h1>Effective permissions</h1>
398391
</ul>
399392
</div>
400393
<div class="section" id="usage">
401-
<h2><a class="toc-backref" href="#toc-entry-1">Usage</a></h2>
394+
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
402395
<p>To use this module, you need to be in developer mode and:</p>
403396
<ol class="arabic simple">
404397
<li>Go to Settings/Users &amp; Companies</li>
405398
<li>Open a user</li>
406-
<li>Click the Effective permissions button</li>
407-
<li>Note you can switch between the rule domains in text form or as
408-
domain widget</li>
399+
<li>Click the <cite>Effective permissions</cite> button</li>
400+
<li>Note you can switch between the rule domains in text form or as domain widget</li>
409401
</ol>
410402
</div>
411403
<div class="section" id="bug-tracker">
412-
<h2><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h2>
404+
<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
413405
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-backend/issues">GitHub Issues</a>.
414406
In case of trouble, please check there if your issue has already been reported.
415407
If you spotted it first, help us to smash it by providing a detailed and welcomed
416-
<a class="reference external" href="https://github.com/OCA/server-backend/issues/new?body=module:%20base_user_effective_permissions%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
408+
<a class="reference external" href="https://github.com/OCA/server-backend/issues/new?body=module:%20base_user_effective_permissions%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
417409
<p>Do not contact contributors directly about support or help with technical issues.</p>
418410
</div>
419411
<div class="section" id="credits">
420-
<h2><a class="toc-backref" href="#toc-entry-3">Credits</a></h2>
412+
<h1><a class="toc-backref" href="#toc-entry-3">Credits</a></h1>
421413
<div class="section" id="authors">
422-
<h3><a class="toc-backref" href="#toc-entry-4">Authors</a></h3>
414+
<h2><a class="toc-backref" href="#toc-entry-4">Authors</a></h2>
423415
<ul class="simple">
424416
<li>Hunki Enterprises BV</li>
425417
</ul>
426418
</div>
427419
<div class="section" id="contributors">
428-
<h3><a class="toc-backref" href="#toc-entry-5">Contributors</a></h3>
420+
<h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
429421
<ul class="simple">
430-
<li>Holger Brunn &lt;<a class="reference external" href="mailto:mail&#64;hunki-enterprises.com">mail&#64;hunki-enterprises.com</a>&gt;
431-
(<a class="reference external" href="https://hunki-enterprises.com">https://hunki-enterprises.com</a>)</li>
422+
<li>Holger Brunn &lt;<a class="reference external" href="mailto:mail&#64;hunki-enterprises.com">mail&#64;hunki-enterprises.com</a>&gt; (<a class="reference external" href="https://hunki-enterprises.com">https://hunki-enterprises.com</a>)</li>
432423
</ul>
433424
</div>
434425
<div class="section" id="maintainers">
435-
<h3><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h3>
426+
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
436427
<p>This module is maintained by the OCA.</p>
437428
<a class="reference external image-reference" href="https://odoo-community.org">
438429
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
@@ -442,11 +433,10 @@ <h3><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h3>
442433
promote its widespread use.</p>
443434
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
444435
<p><a class="reference external image-reference" href="https://github.com/hbrunn"><img alt="hbrunn" src="https://github.com/hbrunn.png?size=40px" /></a></p>
445-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-backend/tree/18.0/base_user_effective_permissions">OCA/server-backend</a> project on GitHub.</p>
436+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-backend/tree/16.0/base_user_effective_permissions">OCA/server-backend</a> project on GitHub.</p>
446437
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
447438
</div>
448439
</div>
449440
</div>
450-
</div>
451441
</body>
452442
</html>

0 commit comments

Comments
 (0)