[FIX] web_field_tooltip: make computed helper flag self-readable#3606
Open
amarcosg wants to merge 1 commit into
Open
[FIX] web_field_tooltip: make computed helper flag self-readable#3606amarcosg wants to merge 1 commit into
amarcosg wants to merge 1 commit into
Conversation
`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.
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.
tooltip_show_add_helper_allowedis a computed field added to the user preferences form (base.view_users_form_simple_modif), but it was not listed inSELF_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 byhr), reading one's own preferences raises anAccessErrorfor users that are not in those groups.Add the computed (read-only) field to
SELF_READABLE_FIELDSso the self-read shortcut is preserved. It is intentionally not added toSELF_WRITEABLE_FIELDSsince the field is computed.