[IMP] dms: enforce record access in code instead of computed-permission ir.rules - #31
Open
dnplkndll wants to merge 1 commit into
Open
[IMP] dms: enforce record access in code instead of computed-permission ir.rules#31dnplkndll wants to merge 1 commit into
dnplkndll wants to merge 1 commit into
Conversation
…on ir.rules Replace the eight `permission_<op>` ir.rules and the overrides that compensated for them (`filtered_domain`, `_filtered_access`, `_filtered_access_no_recursion`, `_check_access_dms_record` and the manual `write`/`unlink` checks) with the pattern core uses for dynamic per-user visibility: `_search` ANDs the DMS access domain into SQL and `_check_access` subtracts the forbidden records. `create`, `write` and `unlink` are then enforced by core through `check_access`. The access rules themselves are unchanged: `_get_domain_by_access_groups()` and `_get_domain_by_inheritance()` are untouched, and the `permission_<op>` fields keep their `search=` methods for use in field domains. Behaviour verified equivalent to the previous implementation on a 19.0 database with demo data: same records visible to a restricted user, same `sudo()` bypass, same AccessError on forbidden read/write, and the same 65 passing dms tests. Assisted-by: Claude Fable 5
dnplkndll
force-pushed
the
19.0-mig-dms-access-tighten
branch
from
July 26, 2026 21:21
e76da03 to
99a908e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Parked here for review after OCA#475 merges. This is the access modernization that was previously the last commit on the OCA#475 branch; it was dropped from the migration so the MIG stays scope-clean, and rebuilt here as one commit on top of that branch.
What it does
Replaces the eight
permission_<op>ir.rules — and the overrides that existed to compensate for them (filtered_domain,_filtered_access,_filtered_access_no_recursion,_check_access_dms_record, manualwrite/unlink) — with the pattern core uses for dynamic per-user visibility:_searchANDs the DMS access domain into SQL,_check_accesssubtracts forbidden records, andcreate/write/unlinkare enforced by core viacheck_access. Same shape asmail.message(which has no read ir.rule at all) andir.attachment.Access rules themselves are unchanged:
_get_domain_by_access_groups()and_get_domain_by_inheritance()untouched,permission_<op>fields keep theirsearch=for field domains.Why it is NOT in the migration
It is a refactor, not a fix. Verified against the
[MIG]commit alone on a 19.0 DB with demo data, using a user withdms.group_dms_userand no DMS access groups:[MIG]onlysudo()bypassread()/write()on forbidden recordAccessErrorAccessErrorpermission_createdmstests, demo onThe
[MIG]commit already adapts the 19.0 sentinel coercion (it keys onenv.su+ non-rootenv.uidrather than reading the coerced value), so nothing here is required by 19.0.The case for it, on its own merits
env.su/env.uidheuristic infers "we are inside ir.rule evaluation" from core internals rather than from a contract — it breaks silently if core changes how rule domains are evaluated.filtered_domain()returningselfundersusuppresses filtering for all domains on every DMS model, not just the permission ones.Assisted-by: Claude Fable 5