Farzad Soltani
09/19/2023, 12:30 PMexpr: request.resource.attr.roles == null
Jesum Yip
09/19/2023, 12:32 PMFarzad Soltani
09/19/2023, 12:36 PMexpr: has(request.resource.attr.roles) == false
I was thinking that there should be a better way to write it.Jesum Yip
09/19/2023, 12:36 PMFarzad Soltani
09/19/2023, 12:37 PMJesum Yip
09/19/2023, 12:37 PMCharith (Cerbos)
!
operator should work. You can try out expressions in our REPL
-> :let x = {"foo": "bar"}
x = {
"foo": "bar"
}
-> has(x.foo)
_ = true
-> !has(x.foo)
_ = false
-> !has(x.bar)
_ = true
Farzad Soltani
09/19/2023, 2:00 PMFarzad Soltani
09/19/2023, 2:01 PMCharith (Cerbos)
- expr: >
!has(request.resource.attr.roles)
Michael
09/19/2023, 2:26 PM!
has special meaning in YAML, so in your case !has
gets interpreted as YAML tag, and not as CEL. Check out the YAML spec for more info: https://yaml.org/spec/1.2-old/spec.html#id2784064Farzad Soltani
09/19/2023, 3:22 PM