Closed brunodomenici closed 4 years ago
Hi @brunodomenici I didn't see "viewer" is granted permission anywhere..
@hsluoyz ooops, my bad on copy & paste, sorry... I corrected issue description... Thanks
@tldyl please test this issue.
@brunodomenici your code looks OK.
Can you troubleshoot it by removing a part from the matcher? Like chaning:
[matchers]
m = g(r.sub, p.sub) && keyMatch(r.act, p.act) && regexMatch(r.artifact, p.artifact)
into:
[matchers]
m = keyMatch(r.act, p.act) && regexMatch(r.artifact, p.artifact)
So we can know which part doesn't work as expected.
@hsluoyz I did the the test and is definitely && regexMatch(r.artifact, p.artifact)
which not validate. Without that, the enforce returns true
Well, I got it. The problem was my regular expression.
To achieve what I want, it should be .*APP1.*
instead of .*APP1
.
This works in Casbin Editor because I supposed that it's implemented in GO. In jCasbin you use Java's flavor regex (of course). What makes sense, but I need to pay attention because I'm planing to use Casbin in several Microservices, implemented in several platforms (JAVA, GO, NodeJS) this could be an issue if I reuse policies with regex in those platforms.
Thanks a lot!
@brunodomenici one thing to clarify is that Casbin Editor is based on Node-Casbin instead of Golang Casbin, see: https://github.com/casbin/casbin-editor . It is actually calculated totally in your own browser (Node-Casbin can run on both browser and Node.js environment). There's no backend for it.
About regex, yes we usually use the built-in or std regex for that language. Maybe it is an issue for cross-language applications. We are open to all suggestions that like using a unified regex dialect by replacing the regex lib for some languages.
Hi,
I'm not able to enforce a policy that is working on Casbin Editor with jCasbin.
I have this conf:
This policy file:
My code:
My application log:
Any ideas?
Thanks a lot!