diff --git a/document_page_access_group/README.rst b/document_page_access_group/README.rst index 4a1b4de8..5e37f874 100644 --- a/document_page_access_group/README.rst +++ b/document_page_access_group/README.rst @@ -7,7 +7,7 @@ Document Page Access Group !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:e7fc1c256036fc0d9e338952db19ce8abcc9cbb414c5264956fb932d6be80e12 + !! source digest: sha256:c21399e1330aae842cb6046755b0816a2ef30f70268aa70cdf38441c5fded1b2 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png @@ -17,13 +17,13 @@ Document Page Access Group :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fknowledge-lightgray.png?logo=github - :target: https://github.com/OCA/knowledge/tree/14.0/document_page_access_group + :target: https://github.com/OCA/knowledge/tree/15.0/document_page_access_group :alt: OCA/knowledge .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/knowledge-14-0/knowledge-14-0-document_page_access_group + :target: https://translation.odoo-community.org/projects/knowledge-15-0/knowledge-15-0-document_page_access_group :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/knowledge&target_branch=14.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/knowledge&target_branch=15.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -55,7 +55,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -71,6 +71,7 @@ Contributors ~~~~~~~~~~~~ * Manuel Regidor +* Alberto Martínez Maintainers ~~~~~~~~~~~ @@ -85,6 +86,6 @@ 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/knowledge `_ project on GitHub. +This module is part of the `OCA/knowledge `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/document_page_access_group/__manifest__.py b/document_page_access_group/__manifest__.py index fe6e28d0..83d39773 100644 --- a/document_page_access_group/__manifest__.py +++ b/document_page_access_group/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Document Page Access Group", "summary": "Choose groups to access document pages", - "version": "14.0.1.0.0", + "version": "15.0.1.0.0", "category": "Knowledge", "website": "https://github.com/OCA/knowledge", "author": "Sygel, Odoo Community Association (OCA)", diff --git a/document_page_access_group/readme/CONTRIBUTORS.rst b/document_page_access_group/readme/CONTRIBUTORS.rst index 9a191ccc..947896f8 100644 --- a/document_page_access_group/readme/CONTRIBUTORS.rst +++ b/document_page_access_group/readme/CONTRIBUTORS.rst @@ -1 +1,2 @@ * Manuel Regidor +* Alberto Martínez diff --git a/document_page_access_group/static/description/index.html b/document_page_access_group/static/description/index.html index 637712cb..38d0f22a 100644 --- a/document_page_access_group/static/description/index.html +++ b/document_page_access_group/static/description/index.html @@ -367,9 +367,9 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:e7fc1c256036fc0d9e338952db19ce8abcc9cbb414c5264956fb932d6be80e12 +!! source digest: sha256:c21399e1330aae842cb6046755b0816a2ef30f70268aa70cdf38441c5fded1b2 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/knowledge Translate me on Weblate Try me on Runboat

+

Beta License: AGPL-3 OCA/knowledge Translate me on Weblate Try me on Runboat

This module allows to select which users groups have access to the document pages.

Table of contents

@@ -400,7 +400,7 @@ document pages can access this document.

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -feedback.

+feedback.

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

@@ -415,6 +415,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome

Contributors

@@ -424,7 +425,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome

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/knowledge project on GitHub.

+

This module is part of the OCA/knowledge project on GitHub.

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

diff --git a/document_page_access_group/tests/__init__.py b/document_page_access_group/tests/__init__.py new file mode 100644 index 00000000..d2acbb67 --- /dev/null +++ b/document_page_access_group/tests/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import test_document_page_access_group diff --git a/document_page_access_group/tests/test_document_page_access_group.py b/document_page_access_group/tests/test_document_page_access_group.py new file mode 100644 index 00000000..bf5b60a8 --- /dev/null +++ b/document_page_access_group/tests/test_document_page_access_group.py @@ -0,0 +1,27 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo.exceptions import UserError +from odoo.tests import common + + +class TestDocumentPageAccessGroup(common.TransactionCase): + def setUp(self): + super(TestDocumentPageAccessGroup, self).setUp() + self.document_user_group = self.browse_ref("knowledge.group_document_user").id + self.test_group = self.browse_ref("base.group_erp_manager").id + self.user_id = self.env["res.users"].create( + { + "name": "user", + "login": "user_login", + "email": "user_email", + "groups_id": [(4, self.document_user_group)], + } + ) + self.page = self.env["document.page"].create( + {"name": "Page 1", "type": "content"} + ) + + def test_page_access(self): + self.assertIsNone(self.page.with_user(self.user_id).check_access_rule("read")) + self.page.write({"groups_id": [(4, self.test_group)]}) + with self.assertRaises(UserError): + self.page.with_user(self.user_id).check_access_rule("read")