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

Support prefix rewrites for zed import just like the playground does #81

Closed
glorious-beard opened this issue Jan 26, 2022 · 2 comments · Fixed by #93
Closed

Support prefix rewrites for zed import just like the playground does #81

glorious-beard opened this issue Jan 26, 2022 · 2 comments · Fixed by #93
Labels
area/CLI Affects the command line area/tooling Affects the dev or user toolchain

Comments

@glorious-beard
Copy link

When one edits a schema in the playground then imports it back into a permissions system via the "import" button, the playground automatically prepends the permission system's prefix to each reference in the schema.

However, that rewrite doesn't happen on zed import operations, making it difficult to share a common schema file with multiple permission systems; each reference in the schema has to be manually modified to include the prefix for the destination permission system.

This is a request to either:

  • fetch the prefix from the destination permissions system and then automatically prepend the prefix to each reference, just like the playground (ideal)
  • pass in the prefix via a command line option (not as ideal)
@glorious-beard
Copy link
Author

@josephschorr josephschorr added the area/CLI Affects the command line label Jan 26, 2022
@jzelinskie jzelinskie added the area/tooling Affects the dev or user toolchain label Jan 27, 2022
@jzelinskie
Copy link
Member

I've actually raised this in the past, so I'm glad to see that my failure to create an issue was accounted for, haha.
We've discussed having a button to help rewrite prefixes in the playground, which is another "non-ideal" way to handle the prefixes.

One downside with looking up the the prefix for the given credential is that if there is ever a future where Authzed.com users can share/bridge their schemas with each other, this could lead to some very subtle bugs.

josephschorr added a commit to josephschorr/zed that referenced this issue Mar 2, 2022
Following this change, `zed import` now supports two modes for handling prefixes:

1) A new CLI flag `--schema-definition-prefix` which will automatically rewrite the schema and test relationships with that prefix
2) If not specified, `zed import` will first call `ReadSchema` for the permissions system and, if a prefix is found, use that prefix automatically

Fixes authzed#81
josephschorr added a commit to josephschorr/zed that referenced this issue Mar 2, 2022
Following this change, `zed import` now supports two modes for handling prefixes:

1) A new CLI flag `--schema-definition-prefix` which will automatically rewrite the schema and test relationships with that prefix
2) If not specified, `zed import` will first call `ReadSchema` for the permissions system and, if a prefix is found, use that prefix automatically

Fixes authzed#81
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/CLI Affects the command line area/tooling Affects the dev or user toolchain
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants