How to GLob properly #596
-
Globbing has received quite a lot of documentation in the docs but I still don't understand it, despite 40 odd years of doing this stuff!. I assume that if I set a glob (glob.match(p.resource, [], resource)) where p.resource == "portal:user" and resource == "portal:config" to fail, but it returns true. My use case: {
"user": "bob",
"permission": "portal:config:bar"
} I parse .permission into 2 separate parts:
e.g.
Then I run
Is OPA globbing doing something different? Should I be using regexes instead? full code:
Any help appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Hey @chippyash, I've responded to your query on the other thread, but here's a simple example showing how globbing works: https://play.openpolicyagent.org/p/JELG8geA7n glob_ok := glob.match("portal:**", [":"], "portal:config:bar")
glob_not_ok := glob.match("portal:*", [":"], "portal:config:bar")
Would you be able to have a go at setting up an example on https://play.openpolicyagent.org so we can see the data too? https://play.openpolicyagent.org |
Beta Was this translation helpful? Give feedback.
Hey @chippyash, I've responded to your query on the other thread, but here's a simple example showing how globbing works:
https://play.openpolicyagent.org/p/JELG8geA7n
glob_not_ok
is false since the * only matches a single part.Would you be able to have a go at setting up an example on https://play.openpolicyagent.org so we can see the data too? https://play.openpolicyagent.org