-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Add check expresion to update permissions (close #384) #3804
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
Conversation
|
Review app for commit 53318dd deployed to Heroku: https://hge-ci-pull-3804.herokuapp.com |
|
Review app for commit 228f398 deployed to Heroku: https://hge-ci-pull-3804.herokuapp.com |
|
Review app for commit 680e836 deployed to Heroku: https://hge-ci-pull-3804.herokuapp.com |
|
Review app for commit 54d4a85 deployed to Heroku: https://hge-ci-pull-3804.herokuapp.com |
|
Review app for commit f84f874 deployed to Heroku: https://hge-ci-pull-3804.herokuapp.com |
|
Review app for commit da5a362 deployed to Heroku: https://hge-ci-pull-3804.herokuapp.com |
|
@0x777 Current status: I'm trying to figure out why Edit: the problem is that |
Ah! That makes sense! So if we unconditionally include the |
|
|
|
@0x777 One more question is what to do if there is an insert check, but no update check, and the |
|
Deploy preview for hasura-docs ready! Built with commit c0a42ef |
|
Review app for commit 148dfd2 deployed to Heroku: https://hge-ci-pull-3804.herokuapp.com |
Interesting! I did a little bit of digging: db> create table genre (id serial primary key, name text not null unique);
CREATE TABLE
db> create view genre_view as select * from genre;
CREATE VIEW
db> insert into genre (id, name) values (DEFAULT, 'drama');
INSERT 0 1
db> insert into genre_view (id, name) values (DEFAULT, 'crime');
INSERT 0 1
db> insert into genre (id, name) values (DEFAULT, 'drama') on conflict on constraint genre_name_key DO NOTHING;
INSERT 0 0
db> insert into genre_view (id, name) values (DEFAULT, 'drama') on conflict on constraint genre_name_key DO NOTHING;
ERROR: constraint "genre_name_key" for table "genre_view" does not existWhat's interesting is that this works: db> insert into genre_view (id, name) values (DEFAULT, 'drama') on conflict (name) DO NOTHING;
INSERT 0 0
Oh yes, I guess it makes sense to use insert |
Correct. |
|
Review app for commit 5772eee deployed to Heroku: https://hge-ci-pull-3804.herokuapp.com |
|
Review app for commit 5f0fb0c deployed to Heroku: https://hge-ci-pull-3804.herokuapp.com |
|
@0x777 This is ready for another review when you have time, please. I'm not planning to implement the console changes or documentation changes yet (since the docs only seem to describe the console UI anyway), but I think this could be merged without those while we decide on the right approach to the UI. |
beerose
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm approving since there are no changes in the console code except for linting.
| @@ -0,0 +1,26 @@ | |||
| description: Try to change the published flag on a published article | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test doesn't seem to be testing the check constraint defined above. We should testing for both a success and an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, thanks. I forgot to finish this and got confused because the tests were passing and I had uncommitted work locally.
|
@paf31 LGTM except for the test case. |
|
Review app for commit b08c277 deployed to Heroku: https://hge-ci-pull-3804.herokuapp.com |
| - extensions: | ||
| path: $ | ||
| code: permission-error | ||
| message: Check constraint violation. insert check constraint failed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we'll need to change the message appropriately for update checks, .. update check constraint failed?
|
Review app for commit 9881cac deployed to Heroku: https://hge-ci-pull-3804.herokuapp.com |
|
Review app for commit 0766959 deployed to Heroku: https://hge-ci-pull-3804.herokuapp.com |
|
Review app https://hge-ci-pull-3804.herokuapp.com is deleted |
Description
checkconstraint property to the update permission data structureThe console UI has not yet been updated and I was hoping someone could pair with me on that. It is still possible to test this using direct changes to
hdb_permissionright now, or presumably using the CLI.Left for a later PR:
Affected components
Related Issues
Solution and Design
See https://github.com/0x777/graphql-engine/blob/rfc-update-permission-check-condition/rfcs/update-permission-check-condition.md
Steps to test and verify
Limitations, known bugs & workarounds
Server checklist
Catalog upgrade
Does this PR change Hasura Catalog version?
Metadata
Does this PR add a new Metadata feature?
run_sqlauto manages the new metadata through schema diffing?run_sqlauto manages the definitions of metadata on renaming?export_metadata/replace_metadatasupports the new metadata added?GraphQL
Breaking changes