Last active
August 22, 2022 16:50
-
-
Save ghstahl/0f11da95c034ccdcf56ec5c670600967 to your computer and use it in GitHub Desktop.
medium_openfga_features_and_permissions_all_features_in_an_org_query.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //------------------------ | |
| // Request, find all plans that our org has subscribed to | |
| //------------------------ | |
| { | |
| "tuple_key": { | |
| "object": "plan:", | |
| "relation": "subscriber", | |
| "user": "org:A" | |
| }, | |
| "page_size": 50 | |
| } | |
| // Response | |
| { | |
| "tuples": [ | |
| { | |
| "key": { | |
| "object": "plan:pro", | |
| "relation": "subscriber", | |
| "user": "org:A" | |
| }, | |
| "timestamp": "2022-08-22T14:16:35.137761Z" | |
| }, | |
| { | |
| "key": { | |
| "object": "plan:free", | |
| "relation": "subscriber", | |
| "user": "org:A" | |
| }, | |
| "timestamp": "2022-08-22T14:16:49.799598Z" | |
| } | |
| ], | |
| "continuation_token": "" | |
| } | |
| //------------------------ | |
| // Request, for each plan, find the features, they may be duplicates | |
| //------------------------ | |
| { | |
| "tuple_key": { | |
| "object": "feature:", | |
| "relation": "associated_plan", | |
| "user": "plan:free" | |
| }, | |
| "page_size": 50 | |
| } | |
| // Response | |
| { | |
| "tuples": [ | |
| { | |
| "key": { | |
| "object": "feature:status", | |
| "relation": "associated_plan", | |
| "user": "plan:free" | |
| }, | |
| "timestamp": "2022-08-22T14:15:18.384675Z" | |
| } | |
| ], | |
| "continuation_token": "" | |
| } | |
| //------------------------ | |
| // Request, for each feature, find all the permissions, and here there may be duplicates | |
| //------------------------ | |
| { | |
| "tuple_key": { | |
| "object": "permission:", | |
| "relation": "associated_feature", | |
| "user": "feature:status" | |
| }, | |
| "page_size": 50 | |
| } | |
| // Response | |
| { | |
| "tuples": [ | |
| { | |
| "key": { | |
| "object": "permission:orgs_micro/status/*", | |
| "relation": "associated_feature", | |
| "user": "feature:status" | |
| }, | |
| "timestamp": "2022-08-22T14:15:18.384675Z" | |
| } | |
| ], | |
| "continuation_token": "" | |
| } | |
| //------------------------ | |
| // Request, for each permission, we can check to see if our user has access | |
| //------------------------ | |
| { | |
| "tuple_key": { | |
| "object": "permission:orgs_micro/status/*", | |
| "relation": "access", | |
| "user": "anne" | |
| }, | |
| "contextual_tuples": { | |
| "tuple_keys": [ | |
| { | |
| "object": "org:A", | |
| "relation": "user_in_context", | |
| "user": "anne" | |
| } | |
| ] | |
| } | |
| } | |
| // Response | |
| { | |
| "allowed": true, | |
| "resolution": "" | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment