go-jmespath
go-jmespath copied to clipboard
Does not support keys with colon (:) characters
Given following JSON:
{
"custom:groups": [
"foo",
"bar"
]
}
And the following JMESPath expression:
contains(custom:groups[*], 'foo') && 'Admin' || 'Editor'
Expected expression to evaluate to "Admin".
Also tried the following expressions without success:
contains("custom:groups[*]", 'foo') && 'Admin' || 'Editor'
contains('"custom:groups[*]"', 'foo') && 'Admin' || 'Editor'
Doesn't work at https://jmespath.org/ either, but maybe this use case is not supported?
Ref: https://github.com/grafana/grafana/issues/22986
this is similar to #58 contains(\"custom:groups\"[*], 'foo') && 'Admin' || 'Editor'
should work.
For anyone else stumbling on this issue the following worked for me:
role_attribute_path: contains("custom:groups"[*], 'Admin-Users') && 'Admin' || contains("custom:groups"[*], 'Grafana-Editor') && 'Editor' || 'Viewer'