Model Storage
Models in Casbin are load-only: they define your access control logic and are treated as static at runtime. There is no API to save or update the model in storage.
You can load a model in three ways:
Load from a CONF file
Loading from a .conf file is the usual approach and makes it easy to share and discuss models.
Example: examples/rbac_model.conf
[request_definition]
r = sub, obj, act
[policy_definition]
p = sub, obj, act
[role_definition]
g = _, _
[policy_effect]
e = some(where (p.eft == allow))
[matchers]
m = g(r.sub, p.sub) && r.obj == p.obj && r.act == p.act
Use it when creating the enforcer:
e := casbin.NewEnforcer("examples/rbac_model.conf", "examples/rbac_policy.csv")