Files
odoo_source/addons/website/security/website_security.xml
T
Victor Feyens fba6ea5a47 [IMP] *: do not force admins to be app admins
For bugfix purposes, app administration groups have been given to
(implied by) the "Settings" group because without those rights,
opening/saving the settings crashed.

1) Do not load hidden view content

This commit uses the conditional inheritance of views
(depending on user groups) to avoid loading unnecessary view
& record content client-side.

This improves performance for admins without the specific application
admin rights, but also fixes the main bugfix problem,
caused by the webclient querying name_get for the records in relational
fields content.

Example:

sale_management adds a res.config.settings field to specify
the default sale.order.template for the current company.

If a 'Settings' user without 'sale.group_sale_manager' opens the
settings, he won't see this setting, but if a default template is
specified for the current company, the webclient will still request
the name_get of this template to the server, because the field
was present in the view, only hidden with a groups attribute.

With this commit change in sale, the field won't be in the view unless
you have the Sale manager group, avoiding the error/traceback/bug.

2) Remove implied application administration groups

Do not force the specific application groups on all 'Settings' user,
they globally do not need those rights, and if they need it, they
can add it to their account themselves.

3) Add a test to make sure settings user are able to manage settings.

4) Enforce 'settings' -> 'access rights' -> 'internal user' groups

As the previous test highlighted some 'false positives' because
it considered a settings user unable to read `crm.team`
and `stock.warehouse` records, we also took the opportunity to enforce
the fact that 'Settings' & 'Access rights' users must be internal users.

It makes no sense for a portal/public user to have access to the
settings, and didn't work anyway.

Part-of: odoo/odoo#91909
2022-06-23 23:48:29 +02:00

88 lines
4.4 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record model="ir.module.category" id="base.module_category_website_website">
<field name="sequence">23</field>
</record>
<record id="group_website_publisher" model="res.groups">
<field name="name">Restricted Editor</field>
<field name="category_id" ref="base.module_category_website_website"/>
</record>
<record id="group_website_designer" model="res.groups">
<field name="name">Editor and Designer</field>
<field name="users" eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"/>
<field name="implied_ids" eval="[(4, ref('group_website_publisher'))]"/>
<field name="category_id" ref="base.module_category_website_website"/>
</record>
<record id="base.default_user" model="res.users">
<field name="groups_id" eval="[(4, ref('group_website_designer'))]"/>
</record>
<!-- FIXME: groups on existing users should probably be updated when implied_ids is, or existing users don't get the relevant implied groups on module installation... -->
<record id="base.user_admin" model="res.users">
<field name="groups_id" eval="[(4, ref('website.group_website_designer'))]"/>
</record>
<data noupdate="1">
<record id="website_designer_edit_qweb" model="ir.rule">
<field name="name">website_designer: Manage Website and qWeb view</field>
<field name="model_id" ref="base.model_ir_ui_view"/>
<field name="domain_force">[('type', '=', 'qweb')]</field>
<field name="groups" eval="[(4, ref('group_website_designer'))]"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_unlink" eval="True"/>
</record>
<record id="website_designer_view" model="ir.rule">
<field name="name">website_designer: global view</field>
<field name="model_id" ref="base.model_ir_ui_view"/>
<field name="domain_force">[('type', '!=', 'qweb')]</field>
<field name="groups" eval="[(4, ref('group_website_designer'))]"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="False"/>
<field name="perm_create" eval="False"/>
<field name="perm_unlink" eval="False"/>
</record>
<record id="website_group_system_edit_all_views" model="ir.rule">
<field name="name">Administration Settings: Manage all views</field>
<field name="model_id" ref="base.model_ir_ui_view"/>
<field name="domain_force">[(1, '=', 1)]</field>
<field name="groups" eval="[(4, ref('base.group_system'))]"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_unlink" eval="True"/>
</record>
<record id="website_page_rule_public" model="ir.rule">
<field name="name">website.page: portal/public: read published pages</field>
<field name="model_id" ref="website.model_website_page"/>
<field name="domain_force">[('website_published', '=', True)]</field>
<field name="groups" eval="[(4, ref('base.group_portal')), (4, ref('base.group_public'))]"/>
</record>
<record id="view_rule_visibility_public" model="ir.rule">
<field name="name">Website View Visibility Public</field>
<field name="model_id" ref="base.model_ir_ui_view"/>
<field name="domain_force">['|', ('type', '!=', 'qweb'), ('visibility', 'in', ('public', False))]</field>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="False"/>
<field name="perm_create" eval="False"/>
<field name="perm_unlink" eval="False"/>
<field name="groups" eval="[(4, ref('base.group_public'))]"/>
</record>
<record id="view_rule_visibility_connected" model="ir.rule">
<field name="name">Website View Visibility Connected</field>
<field name="model_id" ref="base.model_ir_ui_view"/>
<field name="domain_force">['|', ('type', '!=', 'qweb'), ('visibility', 'in', ('public', 'connected', False))]</field>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="False"/>
<field name="perm_create" eval="False"/>
<field name="perm_unlink" eval="False"/>
<field name="groups" eval="[(4, ref('base.group_portal'))]"/>
</record>
</data>
</odoo>