Skip to content

feat: add examples for RBAC combined with ABAC context rules#525

Open
AlabLan wants to merge 4 commits into
apache:masterfrom
AlabLan:add-example
Open

feat: add examples for RBAC combined with ABAC context rules#525
AlabLan wants to merge 4 commits into
apache:masterfrom
AlabLan:add-example

Conversation

@AlabLan

@AlabLan AlabLan commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

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 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.
@hsluoyz

hsluoyz commented Jun 16, 2026

Copy link
Copy Markdown
Member

@AlabLan you should add go test

AlabLan added 2 commits June 22, 2026 14:28
Add coverage for examples/rbac_with_abac_rule_model.conf in AbacAPIUnitTest#testRBACWithABACRule, verifying that the combined RBAC + ABAC context rule model correctly enforces allow/deny based on request context (minor, network, RiskStatus) alongside role inheritance and wildcard actions.
@AlabLan

AlabLan commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

@hsluoyz I have already added the corresponding test code. Later, I will add the test code for the Go repository. Here is the link to the online editor: https://editor.casbin.org/#EN25Q5ZZC

Add coverage for examples/rbac_with_abac_rule_model.conf in AbacAPIUnitTest#testRBACWithABACRule, ported from casbin Go's rbac_with_abac_rule_test.go so the two suites stay assertion-compatible (13 enforce calls with matching sub/obj/act/ctx/res tuples, plus matching helper names: makeRBACABACCtx and testRBACWithABACRuleEnforce, the latter promoted to TestUtil alongside testEnforce / testEnforceWithContext).
Also remove examples/rbac_with_abac_rule_request_example.csv from both repos. The file was unused (zero references in either codebase) and the only request_example of its kind, so it served no documentation or fixture role.
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.

2 participants