Skip to content

[19.0][FIX] base_tier_validation: gate exception field_ids to Settings users - #98

Open
bosd wants to merge 1 commit into
OCA:19.0from
bosd:19.0-fix-base_tier_validation-exception-field-ids-acl
Open

bosd wants to merge 1 commit into
OCA:19.0from
bosd:19.0-fix-base_tier_validation-exception-field-ids-acl

Conversation

@bosd

@bosd bosd commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Problem

Opening the Tier Validation Exception list or form as a non-Settings internal user raises a hard Access Error:

You are not allowed to access 'Fields' (ir.model.fields) records.
This operation is allowed for the following groups: - Access Rights

tier.validation.exception.field_ids is a Many2many to ir.model.fields. The model's read ACL is granted to base.group_user (access_tier_validation_exceptions_all) so the validation logic can check exceptions as the acting user. But the list, form and search views expose field_ids with no groups=, so the web client reads the co-records' display_name as that user, which triggers the ir.model.fields ACL read check and fails for anyone outside base.group_system.

(A Many2one to the same model would be read with sudo() by the web client and would not raise — this is specific to the x2many path.)

Fix

Only base.group_system can create/edit exceptions (access_tier_validation_exceptions_settings), so field_ids is effectively a Settings-level config field. Gate it with groups="base.group_system" in the list, form and search views. Non-Settings users (who only have read for the internal exception check) no longer load the field, so no Access Error; Settings users are unaffected.

Adds a test asserting field_ids is absent from the exception views for a base.group_user user and present for a Settings user.

Notes

  • No behaviour change for Settings users; non-Settings users could only ever read (not edit) exceptions anyway.
  • Surfaced by a lint rule that flags x2many fields to admin-only comodels exposed in views without a groups= gate.

tier.validation.exception.field_ids is a Many2many to ir.model.fields, and
the model is readable by base.group_user (the validation logic checks
exceptions as the acting user). Exposing field_ids in the exception list,
form and search views without a groups= gate makes any non-Settings user who
opens one of those views hit an Access Error:

  You are not allowed to access 'Fields' (ir.model.fields) records.

The web client reads the co-records' display_name as the acting user, and a
many2many triggers the ir.model.fields ACL read check (a many2one would be
read with sudo and not raise). The exception config is Settings-level anyway
-- only base.group_system can create/edit it -- so gate field_ids with
groups="base.group_system" in the list, form and search views. Adds a test
asserting field_ids is absent from the views for a base.group_user user and
present for a Settings user.
@OCA-git-bot

Copy link
Copy Markdown
Contributor

Hi @LoisRForgeFlow,
some modules you are maintaining are being modified, check this out!

@OCA-git-bot OCA-git-bot added mod:base_tier_validation Module base_tier_validation series:19.0 labels Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:base_tier_validation Module base_tier_validation series:19.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants