Skip to content

feat(query): support running a query against list-users api#314

Merged
ewanharris merged 4 commits into
mainfrom
feat/query-list-users
May 2, 2024
Merged

feat(query): support running a query against list-users api#314
ewanharris merged 4 commits into
mainfrom
feat/query-list-users

Conversation

@ewanharris

Copy link
Copy Markdown
Member

Description

Adds support for fga query list-users which will call the ListUsers API and return the list of users and excluded users for the stated object and relation.

There's a demo below and the command is as follows

# Specify a type as the filter
fga query list-users --store-id 01HWQ7ARKQ2SWXK35R2HADMDH0 --object document:1 --relation viewer --user-filter user --contextual-tuple "user:bob member group:fga-core"

# Specify a userset as the filter
fga query list-users --store-id 01HWQ7ARKQ2SWXK35R2HADMDH0 --object document:1 --relation viewer --user-filter group#member --contextual-tuple "group:fga-int#member member group:fga"

# Specify a userset as the filter and provide multiple contextual tuples
fga query list-users --store-id 01HWQ7ARKQ2SWXK35R2HADMDH0 --object document:1 --relation viewer --user-filter user --contextual-tuple "group:fga-int#member member group:fga" --contextual-tuple "user:bob member group:fga-int"

fga query list users demo

References

Closes #311

Review Checklist

  • I have clicked on "allow edits by maintainers".
  • I have added documentation for new/changed functionality in this PR or in a PR to openfga.dev [Provide a link to any relevant PRs in the references section above]
  • The correct base branch is being used, if not main
  • I have added tests to validate that the change in functionality is working as expected

@ewanharris
ewanharris requested review from a team as code owners April 30, 2024 13:55
Comment thread README.md
Comment thread README.md
Comment thread cmd/query/list-users.go Outdated
Comment thread cmd/query/list-users.go Outdated
Comment thread cmd/query/list-users.go Outdated
Comment thread cmd/query/list-users.go Outdated
@ewanharris
ewanharris force-pushed the feat/query-list-users branch from 8e26041 to 71223cc Compare May 1, 2024 12:17
@ewanharris
ewanharris added this pull request to the merge queue May 2, 2024
Merged via the queue into main with commit 0c3e725 May 2, 2024
@ewanharris
ewanharris deleted the feat/query-list-users branch May 2, 2024 14:23
@ewanharris ewanharris mentioned this pull request May 7, 2024
4 tasks
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

Successfully merging this pull request may close these issues.

Add support for fga query list-users

2 participants