casbin / node-casbin

An authorization library that supports access control models like ACL, RBAC, ABAC in Node.js and Browser
https://casbin.org
Apache License 2.0
2.63k stars 219 forks source link

[Bug] Policy definition contains 2 different policy sets (p and p2) doesn't work in Casbin editor #472

Open taksedo opened 8 months ago

taksedo commented 8 months ago

Want to prioritize this issue? Try:

issuehunt-to-marktext


Describe the bug The case from the doc with to types of policies (p and p2) doesn't work on https://editor.casbin.org.

Link to the case: https://editor.casbin.org/#2YLC95Q57

To Reproduce Establish following Model:

[request_definition]
r = sub, obj, act

[policy_definition]
p = sub, obj, act
p2 = sub, act

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

[matchers]
m = r.sub == p.sub && r.obj == p.obj && r.act == p.act

and Policy:

p, alice, data1, read
p2, bob, write-all-objects

Requests:

alice, data1, read
bob, data1, write-all-objects

Expected behavior all requests should return true, but 2nd request returns false

Screenshots image

casbin-bot commented 8 months ago

@tangyang9464 @JalinWang

casbin-bot commented 8 months ago

@nodece @Shivansh-yadav13

hsluoyz commented 8 months ago

@taksedo the Casbin editor is based on Node.js version Casbin, which currently doesn't support p2 yet. This Go Casbin supports it.

taksedo commented 8 months ago

Thank you!