Casbin requires a model configuration file (model.conf) and a policy file (policy.csv) to define authorization rules.
Example model.conf structure:
Defines request, policy, effect, and matcher logic.
Example policy.csv structure:
Maps subjects (users) to objects (paths) and actions (HTTP methods).
For detailed policy writing, refer to the official Casbin documentation.
[request_definition]
r = sub, obj, act
[policy_definition]
p = sub, obj, act
[policy_effect]
e = some(where (p.eft == allow))
[matchers]
m = r.sub == p.sub && keyMatch(r.obj, p.obj) && (r.act == p.act || p.act == "*")
p, alice, /dataset1/*, *
p, bob, /dataset1/*, GET