Hi I'm wondering whether using hasIntersection bet...
# help
k
Hi I'm wondering whether using hasIntersection between a list and a map works? Will the items of a list be compared with the keys of a map?
d
Hi Kevin, No, it takes only lists, but you can convert a map to a list of keys using the
map
function:
hasIntersection(["a", "b"], {"a":1}.map(x, x))
k
thanks I just found that your method worked!
🙌 1
d
You can run
cerbos repl
to get the Cerbos REPL.
🙏 1
k
looks like filter also converts map to list
d
Yes. I think all built-in CEL functions do that. I wanted to double-check that, but GitHub is down!
hasIntersection
is a custom Cerbos function. CEL is a language (developed by Google) that Cerbos uses in the policies.
By “all built-in CEL functions” I meant
map
,
filter
,
exists
etc. 🙂
k
Hi, what does hasIntersection return when comparing empty sets?
false right?
d
Yes, it returns false in that case.
k
thanks