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

Fix the has_claim Liquid filter #16863

Merged
merged 2 commits into from
Oct 10, 2024
Merged

Fix the has_claim Liquid filter #16863

merged 2 commits into from
Oct 10, 2024

Conversation

MikeAlhayek
Copy link
Member

No description provided.

@MikeAlhayek
Copy link
Member Author

Another way we can do this is by using the IAuthorizationService instead of checking the claims. But maybe we should just have another filter that does the check.

@gvkries
Copy link
Contributor

gvkries commented Oct 10, 2024

Is this conceptually the right way to do it? The user has the admin role claim, using code should check against that claim instead of faking to have claims here.

@MikeAlhayek
Copy link
Member Author

MikeAlhayek commented Oct 10, 2024

@gvkries we are trying to solve for use cases like this

{% assign user_perm = User | has_claim: "Permission", "AccessAdminPanel" %}

Admin roles has all permissions by design so checking if admin has permission to X will always be true.

@MikeAlhayek MikeAlhayek merged commit 96919f2 into main Oct 10, 2024
17 checks passed
@MikeAlhayek MikeAlhayek deleted the ma/fix-has-claim-filter branch October 10, 2024 18:28
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.

3 participants