[ADD]document_page_access_group: Add access groups to document pages

This commit is contained in:
manu 2022-05-09 16:09:03 +02:00 committed by Alberto Martínez
parent d9562de03b
commit 6f9a23f99e
10 changed files with 94 additions and 0 deletions

View File

@ -0,0 +1,4 @@
# Copyright 2022 Manuel Regidor <manuel.regidor@sygel.es>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import models

View File

@ -0,0 +1,19 @@
# Copyright 2022 Manuel Regidor <manuel.regidor@sygel.es>
# 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"],
}

View File

@ -0,0 +1,4 @@
# Copyright 2022 Manuel Regidor <manuel.regidor@sygel.es>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import document_page

View File

@ -0,0 +1,10 @@
# Copyright 2022 Manuel Regidor <manuel.regidor@sygel.es>
# 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")

View File

@ -0,0 +1 @@
* Manuel Regidor <manuel.regidor@sygel.es>

View File

@ -0,0 +1,2 @@
This module allows to select which users groups have access to the
document pages.

View File

@ -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.

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2022 Manuel Regidor <manuel.regidor@sygel.es>
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo noupdate="1">
<record id="document_page_rule" model="ir.rule">
<field name="name">Document Page Access</field>
<field name="model_id" ref="model_document_page" />
<field eval="False" name="global" />
<field name="groups" eval="[(4, ref('knowledge.group_document_user'))]" />
<field
name="domain_force"
>['|', ('groups_id', '=', False), ('groups_id', 'in', [g.id for g in user.groups_id])]</field>
</record>
<record id="document_page_rule_full_access" model="ir.rule">
<field name="name">Document Page Full Access</field>
<field name="model_id" ref="model_document_page" />
<field eval="False" name="global" />
<field
name="groups"
eval="[(4, ref('document_page.group_document_manager'))]"
/>
<field name="domain_force">[(1, '=', 1)]</field>
</record>
</odoo>

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2022 Manuel Regidor <manuel.regidor@sygel.es>
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="document_page_access_group_view_wiki_form" model="ir.ui.view">
<field name="name">document.page.access.group.view.wiki.form</field>
<field name="model">document.page</field>
<field name="inherit_id" ref="document_page.view_wiki_form" />
<field name="arch" type="xml">
<xpath expr="//page[@name='history']" position="after">
<page
name="security"
string="Security"
groups="document_page.group_document_manager"
>
<field name="groups_id" />
</page>
</xpath>
</field>
</record>
</odoo>