diff --git a/document_page_access_group/__init__.py b/document_page_access_group/__init__.py new file mode 100644 index 00000000..18143cb9 --- /dev/null +++ b/document_page_access_group/__init__.py @@ -0,0 +1,4 @@ +# Copyright 2022 Manuel Regidor +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import models diff --git a/document_page_access_group/__manifest__.py b/document_page_access_group/__manifest__.py new file mode 100644 index 00000000..fe6e28d0 --- /dev/null +++ b/document_page_access_group/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright 2022 Manuel Regidor +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Document Page Access Group", + "summary": "Choose groups to access document pages", + "version": "14.0.1.0.0", + "category": "Knowledge", + "website": "https://github.com/OCA/knowledge", + "author": "Sygel, Odoo Community Association (OCA)", + "license": "AGPL-3", + "application": False, + "installable": True, + "depends": [ + "document_page", + "knowledge", + ], + "data": ["views/document_page.xml", "security/security.xml"], +} diff --git a/document_page_access_group/models/__init__.py b/document_page_access_group/models/__init__.py new file mode 100644 index 00000000..5aedcf2a --- /dev/null +++ b/document_page_access_group/models/__init__.py @@ -0,0 +1,4 @@ +# Copyright 2022 Manuel Regidor +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import document_page diff --git a/document_page_access_group/models/document_page.py b/document_page_access_group/models/document_page.py new file mode 100644 index 00000000..e8ff91e9 --- /dev/null +++ b/document_page_access_group/models/document_page.py @@ -0,0 +1,10 @@ +# Copyright 2022 Manuel Regidor +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class DocumentPage(models.Model): + _inherit = "document.page" + + groups_id = fields.Many2many(comodel_name="res.groups", string="Groups") diff --git a/document_page_access_group/readme/CONTRIBUTORS.rst b/document_page_access_group/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..9a191ccc --- /dev/null +++ b/document_page_access_group/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Manuel Regidor diff --git a/document_page_access_group/readme/DESCRIPTION.rst b/document_page_access_group/readme/DESCRIPTION.rst new file mode 100644 index 00000000..ecf456b6 --- /dev/null +++ b/document_page_access_group/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module allows to select which users groups have access to the +document pages. diff --git a/document_page_access_group/readme/USAGE.rst b/document_page_access_group/readme/USAGE.rst new file mode 100644 index 00000000..082de78c --- /dev/null +++ b/document_page_access_group/readme/USAGE.rst @@ -0,0 +1,9 @@ +To select the users that have access to a given document page +you need to open a document, go to the 'Security' tab +and select which groups will have access. + +Only users that belong to the 'Knowledge / Manager' group can +manage access groups to documents. + +If no groups are selected in a document, all users that can access +document pages can access this document. diff --git a/document_page_access_group/security/security.xml b/document_page_access_group/security/security.xml new file mode 100644 index 00000000..74366d60 --- /dev/null +++ b/document_page_access_group/security/security.xml @@ -0,0 +1,24 @@ + + + + + Document Page Access + + + + ['|', ('groups_id', '=', False), ('groups_id', 'in', [g.id for g in user.groups_id])] + + + Document Page Full Access + + + + [(1, '=', 1)] + + diff --git a/document_page_access_group/static/description/icon.png b/document_page_access_group/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/document_page_access_group/static/description/icon.png differ diff --git a/document_page_access_group/views/document_page.xml b/document_page_access_group/views/document_page.xml new file mode 100644 index 00000000..b09cba7d --- /dev/null +++ b/document_page_access_group/views/document_page.xml @@ -0,0 +1,21 @@ + + + + + document.page.access.group.view.wiki.form + document.page + + + + + + + + + +