Skip to content

[FIX] web_field_tooltip: make computed helper flag self-readable#3606

Open
amarcosg wants to merge 1 commit into
OCA:16.0from
factorlibre:16.0-fix-web_field_tooltip-self-readable-computed-field
Open

[FIX] web_field_tooltip: make computed helper flag self-readable#3606
amarcosg wants to merge 1 commit into
OCA:16.0from
factorlibre:16.0-fix-web_field_tooltip-self-readable-computed-field

Conversation

@amarcosg

Copy link
Copy Markdown

tooltip_show_add_helper_allowed is a computed field added to the user preferences form (base.view_users_form_simple_modif), but it was not listed in SELF_READABLE_FIELDS.

res.users.read() only takes the "read your own record as superuser" shortcut when every requested field is self-readable. Because this field was missing from the list, the shortcut was skipped whenever a user reads their own preferences form. On its own that is harmless, but as soon as another installed module contributes group-restricted fields to that same form (for example the private information fields added by hr), reading one's own preferences raises an AccessError for users that are not in those groups.

Add the computed (read-only) field to SELF_READABLE_FIELDS so the self-read shortcut is preserved. It is intentionally not added to SELF_WRITEABLE_FIELDS since the field is computed.

`tooltip_show_add_helper_allowed` is a computed field added to the user
preferences form (`base.view_users_form_simple_modif`), but it was not
listed in `SELF_READABLE_FIELDS`.

`res.users.read()` only takes the "read your own record as superuser"
shortcut when every requested field is self-readable. Because this field
was missing from the list, the shortcut was skipped whenever a user reads
their own preferences form. On its own that is harmless, but as soon as
another installed module contributes group-restricted fields to that same
form (for example the private information fields added by `hr`), reading
one's own preferences raises an `AccessError` for users that are not in
those groups.

Add the computed (read-only) field to `SELF_READABLE_FIELDS` so the
self-read shortcut is preserved. It is intentionally not added to
`SELF_WRITEABLE_FIELDS` since the field is computed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:web_field_tooltip Module web_field_tooltip series:16.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants