Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[issue-2953] Fixed access to resources for non-admin Tag Managers (having a 'tag:management' permission) #2432

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

oleg-odysseus
Copy link
Contributor

@oleg-odysseus oleg-odysseus commented Mar 12, 2025

@oleg-odysseus oleg-odysseus requested a review from konstjar March 12, 2025 12:15
@chrisknoll
Copy link
Collaborator

I noticed there's a few places where this was changed:

checkOwnerOrAdminOrGranted(entity);

to:

checkPermissions(entity, ImmutableSet.of(PermissionCheckType.IS_OWNER, PermissionCheckType.IS_ADMIN, PermissionCheckType.HAS_WRITE_ACCESS));

On the surface, it seems it makes sense to have a shared function that does a permission check that is shared across different code contexts. The naming of it seems little odd since the name of the function describes something literal (checking owner, or admin, or granted) vs. something like checkModifyPermissions, where 'modify permissions' can change over time (like adding a new permission role).

Did you think it makes sense to use a shared function in those places where you removed 'checkOwnerOrAdminOrGranted' instead of duplicating the set? I think having a shared function can encapsulate the logic about what the collection of roles implies a certain permission vs. deriving the meaning from an arbitrary collection of permissions/roles.

@chrisknoll chrisknoll closed this Mar 12, 2025
@chrisknoll chrisknoll reopened this Mar 12, 2025
@oleg-odysseus
Copy link
Contributor Author

Hi Chris. I`ve removed the refactoring part from this and issue-2953-2.14 branch to retain only the bug fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tagging administration cannot be done without Admin role assigned
2 participants