feat: add examples for RBAC combined with ABAC context rules#1735
Open
AlabLan wants to merge 2 commits into
Open
feat: add examples for RBAC combined with ABAC context rules#1735AlabLan wants to merge 2 commits into
AlabLan wants to merge 2 commits into
Conversation
Add model, policy and request example files demonstrating how context-based ABAC rules can be layered on top of RBAC roles in a single combined model.
Add TestRBACWithABACRule covering RBAC roles combined with per-request ABAC context rules, mirroring the jcasbin test. The matcher evaluates p.ctx_rule as a per-request allow/deny filter against the request ctx. Switch the example policy to single-quoted string literals so it parses under Go's stricter encoding/csv reader, which rejects bare double quotes. The single-quoted form is also valid in jcasbin's govaluate, so the example stays cross-compatible. Because Go's govaluate errors on missing map keys (unlike jcasbin's lenient evaluator), the test uses a neutral ctx that supplies every ctx_rule field with a non-matching value for the no-special-context cases.
Author
|
I have already added the corresponding test code. Here is the link to the online editor: https://editor.casbin.org/#EN25Q5ZZC |
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.
Add model, policy and request example files demonstrating how context-based ABAC rules can be layered on top of RBAC roles in a single combined model.