Get all v2 based on v0,v1,v3 values
mesanubi opened this issue · 3 comments
mesanubi commented
I'd like to retrive an array of v2 values based on v0,v1,v3 values, is there a function that I can't find in docs or have I to create a custom Enforcer?
This is my conf:
[request_definition]
r = sub, clt, obj, act
[policy_definition]
p = sub, clt, obj, act
[role_definition]
g = _, _
[policy_effect]
e = some(where (p.eft == allow))
[matchers]
m = g(r.sub, p.sub) && ((r.clt == p.clt && r.obj == p.obj) || (r.clt == p.clt && r.obj == "*")) && r.act == p.act
Where sub is my user, clt is the table like (posts), obj is the id of obj in ctl and act is my action like index, edit, create, update, store, restore, destroy.
Can someone help me, pls?
leeqvip commented
@RafGiammario You can use $e->getFilteredPolicy(1, "obj.id") to filter out the corresponding policies.
see: https://casbin.org/docs/en/management-api#filtered-api
RafGiammario commented
Thanks