Open tom2nonames opened 1 year ago
@Edmond-J-A @rushitote @techoner
@tom2nonames what Casbin version are you using? I noticed that you are using openresty, so is it a customzized Casbin version shipped by openresty?
The official latest release is v1.41.8: https://github.com/casbin/lua-casbin/releases/tag/v1.41.8 , you should try this
what Casbin version are you using? I noticed that you are using openresty, so is it a customzized Casbin version shipped by openresty?
The casbin version I am using is v1.41.1-1, installed using the Lualocks package manager and running in the openrest/1.21.4.2RC1 environment. I will try v1.41.8-1 first.
what Casbin version are you using? I noticed that you are using openresty, so is it a customzized Casbin version shipped by openresty?
The casbin version I am using is v1.41.1-1, installed using the Lualocks package manager and running in the openrest/1.21.4.2RC1 environment. I will try v1.41.8-1 first.
I have updated the version and still have the same issue.
local model1 = [[ [request_definition] r = path, method
]]
local policy1 =[[ p, ^/cate/sample/gen_label_no, POST, allow p, ^/cate/sample/.*/[print|reprint], PUT, allow ]]
local model2 = [[ [request_definition] r = user, path, method
[policy_definition] p = role, path, method
[roledefinition] g = , _
[policy_effect] e = some(where (p.eft == allow))
[matchers] m = (g(r.user, p.role) || keyMatch(r.user, p.role)) && regexMatch(r.path, p.path) && keyMatch(r.method, p.method) ]]
local policy2 =[[
p, , ^/$, GET p, , ^/portal, GET p, *, ^/admin, GET
p, sys-admin, , g, sys-admin, guests ]]
local ex2 = Enforcer2:newEnforcerFromText(model2, policy2)
local pass2 = ex2:enforce("guests", "/", "GET") print( "pass2:",pass2)
local ex1 = Enforcer1:newEnforcerFromText(model1, policy1)
local pass1 = ex1:enforce("/cate/sample/gen_label_no", "POST") print( "pass1: ",pass1)
local pass3 = ex2:enforce("guests", "/", "GET")
print( "pass3: ",pass3)