diff options
| author | Nans Lefebvre <len@odoo.com> | 2019-10-08 12:34:40 +0000 |
|---|---|---|
| committer | fw-bot <otis@odoo.com> | 2019-10-11 18:27:30 +0000 |
| commit | 60534c65ae1ea65a86fa12b344a4a0f55c41d8f6 (patch) | |
| tree | 3b01c985c57695382adca1714d6611441d63f486 /odoo/addons/test_access_rights/security.xml | |
| parent | 212294fe1c8278851023bfe2913ea675c6cd2ddb (diff) | |
[FIX] models, test_access_rights: restore normal ACL check
Because of 4b1cb41cf7a3f936a1e6d00a2bb6a6a29e82d711, we might try to read
the field 'active' on a record on which we can't read fields besides the name.
This thus triggers an access error where there should not have been.
In particular, this is the case for portal users: most often the records they
can access point to records that they can't read
(e.g. the partner of the internal user assigned to the ticket).
As a result, clicking on any link creates an ACL, and thus redirects to the
home page.
It turns out that filtered_domain was primarily used on already loaded records,
typically for the write, so it was assumed that the records could be read
in the first place.
However in the use-case of the portal, there is an explicit check on the read
rights with the portal user, explaining the discrepancy.
Since in the general case filtered_domain should be able to read all fields
to evaluate the domain, we put it in sudo.
fix co-authored with @rco
closes odoo/odoo#38540
X-original-commit: cff5cc8cc78a32eb204368e84ec4980324046405
Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
Diffstat (limited to 'odoo/addons/test_access_rights/security.xml')
| -rw-r--r-- | odoo/addons/test_access_rights/security.xml | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/odoo/addons/test_access_rights/security.xml b/odoo/addons/test_access_rights/security.xml new file mode 100644 index 00000000000..d71e815cf95 --- /dev/null +++ b/odoo/addons/test_access_rights/security.xml @@ -0,0 +1,12 @@ +<odoo> + <record id="test_access_right_fake_ticket" model="ir.rule"> + <field name="name">Fake Ticket: portal or following</field> + <field name="model_id" ref="model_test_access_right_ticket"/> + <field name="domain_force">[ + '|', + ('message_partner_ids', 'child_of', [user.partner_id.commercial_partner_id.id]), + ('message_partner_ids', 'in', [user.partner_id.id]) + ]</field> + <field name="groups" eval="[(4, ref('base.group_portal'))]"/> + </record> +</odoo> |
