Skip to content

[19.0][FIX] base_tier_validation: AccessError in systray when reviewer lacks model ACL#30

Open
bosd wants to merge 1 commit into
OCA:19.0from
bosd:19.0-fix-base_tier_validation-systray-accesserror
Open

[19.0][FIX] base_tier_validation: AccessError in systray when reviewer lacks model ACL#30
bosd wants to merge 1 commit into
OCA:19.0from
bosd:19.0-fix-base_tier_validation-systray-accesserror

Conversation

@bosd
Copy link
Copy Markdown
Contributor

@bosd bosd commented May 13, 2026

Summary

The reviewer systray endpoint res.users.review_user_count() iterates the current user's pending tier reviews, groups them by model, and for each model does:

records = (
    Model.with_user(user)
    .with_context(active_test=False)
    .search(records_domain)
)

When the user is a reviewer on a model they have no ir.model.access read on (e.g. a tier definition on account.move assigned to a non-accounting user), that search() raises AccessError. Because the systray fetches the count on every component mount, every page refresh in that user's session crashes with:

You are not allowed to access 'Journal Entry' (account.move) records.

Repro on runboat

  1. As admin: create a tier definition on account.move with the demo user as reviewer.
  2. Log in as demo in another browser.
  3. As admin: request validation on a journal entry.
  4. Refresh demo's browser → AccessError on every page.

Fix

Catch AccessError per model inside the loop and skip silently (debug log). The user can't act on records they have no read access to anyway, so the right behaviour is to drop the model from the count rather than crash the whole systray.

Test plan

  • Run the new test_16b_review_user_count_no_model_access: it unlinks the tester model's ir.model.access, requests validation, and asserts review_user_count() returns [] (was raising AccessError before).
  • On runboat: install a fresh DB, follow the reproduction steps above. Before the fix every refresh blew up; after, the systray shows no count (or shows counts only for models the user can read) and the page loads.

…odel ACL

The reviewer systray endpoint res.users.review_user_count() iterates
over the user's pending tier reviews, groups them by model, and for
each model runs Model.with_user(user).search(records_domain) to gather
the records the user can still act on.

When the tier definition targets a model the reviewer has no read
access to (e.g. a definition on account.move assigned to a user who
is not in any accounting group), that search raises AccessError -- and
because the systray fetches the count on every page mount, every
refresh of the reviewer's session blew up with:

    You are not allowed to access 'Journal Entry' (account.move) records.

Reproduction (runboat):
  1. As admin, create a tier definition on account.move with the demo
     user as reviewer.
  2. Log in as demo in another browser.
  3. As admin, request validation on a journal entry.
  4. Refresh demo's browser -> AccessError on every page.

Fix: catch AccessError per model in the loop and skip silently with a
debug log. The user couldn't have acted on those records anyway
without read access, so silently dropping them from the count is the
right behaviour -- and it stops the systray from breaking every page.

Includes a regression test that revokes the validated model's
ir.model.access for non-admins, requests validation, and asserts
review_user_count() returns [] instead of raising.
@OCA-git-bot
Copy link
Copy Markdown
Contributor

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

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