Casbin Forum runs on Casnode, the open-source Discourse-style forum. Try the Casnode demo →
Casbin Forum

Hi, I wanted to implement an authentication system with users, roles, resources and actions. While i found documentation for this i couldn't find any documentation regarding how one action can inherit another like write can also read and manage can write and read. is there a way to implement this? can anyone help?

[request_definition]
r = sub, obj, act

[policy_definition]
p = role, obj, act
p2 = act, act # Action inheritance (e.g., write > read)

[role_definition]
g = _, _ # User to role assignment

[policy_effect]
e = some(where (p.eft == allow))

[matchers]
m = g(r.sub, p.role) && (p(r.obj, r.act) || p2(r.act, p2.act) && p(r.obj, p2.obj))

My idea is something like this

1views
2users
1 minread
1 / 2
Aug 2024