Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not support keys with colon (:) characters #53

Open
marefr opened this issue Apr 6, 2020 · 2 comments
Open

Does not support keys with colon (:) characters #53

marefr opened this issue Apr 6, 2020 · 2 comments

Comments

@marefr
Copy link

marefr commented Apr 6, 2020

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: grafana/grafana#22986

@nevins-b
Copy link

nevins-b commented Oct 6, 2020

this is similar to #58 contains(\"custom:groups\"[*], 'foo') && 'Admin' || 'Editor' should work.

@weir-it-services
Copy link

weir-it-services commented Oct 21, 2020

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'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants