mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-14 01:41:26 -06:00
[ADD]document_page_access_group: Add access groups to document pages
This commit is contained in:
parent
d9562de03b
commit
6f9a23f99e
4
document_page_access_group/__init__.py
Normal file
4
document_page_access_group/__init__.py
Normal 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
|
19
document_page_access_group/__manifest__.py
Normal file
19
document_page_access_group/__manifest__.py
Normal 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"],
|
||||||
|
}
|
4
document_page_access_group/models/__init__.py
Normal file
4
document_page_access_group/models/__init__.py
Normal 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
|
10
document_page_access_group/models/document_page.py
Normal file
10
document_page_access_group/models/document_page.py
Normal 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")
|
1
document_page_access_group/readme/CONTRIBUTORS.rst
Normal file
1
document_page_access_group/readme/CONTRIBUTORS.rst
Normal file
@ -0,0 +1 @@
|
|||||||
|
* Manuel Regidor <manuel.regidor@sygel.es>
|
2
document_page_access_group/readme/DESCRIPTION.rst
Normal file
2
document_page_access_group/readme/DESCRIPTION.rst
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
This module allows to select which users groups have access to the
|
||||||
|
document pages.
|
9
document_page_access_group/readme/USAGE.rst
Normal file
9
document_page_access_group/readme/USAGE.rst
Normal 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.
|
24
document_page_access_group/security/security.xml
Normal file
24
document_page_access_group/security/security.xml
Normal 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>
|
BIN
document_page_access_group/static/description/icon.png
Normal file
BIN
document_page_access_group/static/description/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.2 KiB |
21
document_page_access_group/views/document_page.xml
Normal file
21
document_page_access_group/views/document_page.xml
Normal 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>
|
Loading…
Reference in New Issue
Block a user