-
Notifications
You must be signed in to change notification settings - Fork 25
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
FR: Add more concise methods of specifying similar tuples in tests #193
Comments
What if we supported an object/relation/user hierarchy like the one below?
|
Interesting, though since the config file is YAML I'd assume it would look like: tuples:
- group: foo
- member:
- user: alice
- user: bob However, this syntax wouldn't support specifying multiple objects or relations, which is something I'd also like to see. |
We could try to get smart and recognize the following syntax too:
I'm thinking of using this format for scenarios where you want to use OpenFGA for infrastructure scenarios and you want to provide a YAML file that configures permissions. If we can get rid of the "user/object/relation" keywords it will look closer to a YAML configuration file. |
I made a mistake and accidentally provided invalid YAML in my last comment as well. tuples:
- user:
- user:alice
- user:bob
relation: member
object:
- group:foo
- group:bar
- user: user:alice
relation: admin
object:
- group:baz
- group:qux
- user: user:bob
relation:
- update
- read
- delete
object: file:foo |
I really like that suggestion @netthier as it allows us to be flexible and support multiple use csaes, so each can use it whoever they need. Though maybe, we'd change the field names to the plural form when they are an array
On the CLI it would be easier, because we can either ignore or error out when a duplicate fields are set. In VS Code having mutually exclusive fields may be harder to get done, but I don't believe that'll be a big issue |
Currently, all tuples must be written out fully, e.g.
I noticed that to fully test a model, I had often specified multiple tuples where 2 of the elements were identical, e.g. assigning multiple users as members of the same group.
This feature request is for a way of specifying such groups of tuples more concisely, e.g. by including arrays in the tuple definition:
with the same optimally being possible for
object[s]
. Maybe allowing to specify multiple relations could make sense too, though I haven't had such a need yet.The text was updated successfully, but these errors were encountered: