You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[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) && keyMatch4(r.obj, p.obj) && regexMatch(r.act, p.act)
localEnforcer=require("casbin")
locale=Enforcer:new("/opt/openresty/nginx/conf/lua/casbin/rbac_model.conf", "/opt/openresty/nginx/conf/lua/casbin/examples/rbac_policy.csv")
localcjson=require"cjson"localresponse= {}
localsub="alice" -- the user that wants to access a resource.localobj="data1" -- the resource that is going to be accessed.localact="read" -- the operation that the user performs on the resource.ife:enforce(sub, obj, act) thenresponse['code'] =200response['result'] =trueresponse['msg'] =e:GetPolicy()
ngx.say(cjson.encode(response))
end
2023/12/12 18:42:33 [error] 208585#0: *4 lua entry thread aborted: runtime error:
...openresty/luajit/share/lua/5.1/src/main/CoreEnforcer.lua:449: attempt to concatenate field 'message' (a nil value)
stack traceback:
coroutine 0:
...openresty/luajit/share/lua/5.1/src/main/CoreEnforcer.lua: infunction'enforceEx'
...openresty/luajit/share/lua/5.1/src/main/CoreEnforcer.lua:534: infunction'enforce'
The text was updated successfully, but these errors were encountered:
@transtone it seems that your error doesn't match with your source code, the error shows enforceEx and a field called message, but your code never mentioned those. So why is that?
there is a error when use keymatch4 in model.conf
The text was updated successfully, but these errors were encountered: