jcasbin icon indicating copy to clipboard operation
jcasbin copied to clipboard

Batch Enforce Limits Arguments

Open DonnC opened this issue 6 months ago • 5 comments

I noticed that batchEnforce(...) uses the enforce method which takes varargs but batchEnforce only passes 3 arguments to the enforce method. https://github.com/casbin/jcasbin/blob/4abeb4a37abae2657a870d8f82a3e48506c24fde/src/main/java/org/casbin/jcasbin/main/Enforcer.java#L626

I have a model as below

[request_definition]
r = sub, dom, act, status

[policy_definition]
p = sub, dom, act, status

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

[role_definition]
g = _, _, _

[matchers]
m = g(r.sub, p.sub, r.dom) && r.act == p.act && r.status == p.status || r.sub == "admin"

My Policy

p, viewer, *, read, not_draft_not_final
p, viewer, *, read, final
p, viewer, *, comment, not_draft_not_final

p, auditor, *, read, not_draft
p, auditor, *, read, not_draft_not_final

g, user:1, viewer, document:1

When i use batchEnforce im getting the exception message as below I am passing a list of list of user:1, document:1, read, not_draft

invalid request size: expected 4, got 3, rvals: [user:1, document:1, read]

but it works if i the .enforce(user:1, document:1, read, not_draft) directly

DonnC avatar Aug 06 '24 15:08 DonnC