-
Notifications
You must be signed in to change notification settings - Fork 409
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
Doc: access policy fix and expansion #6573
Conversation
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.
Great additions, @Dhghomon! I have some minor suggestions and one concern about an access policy result that I don't follow.
docs/datamodel/access_policies.rst
Outdated
edgedb error: AccessPolicyError: access policy violation on insert of | ||
default::BlogPost (User must have same ID as blog author) |
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 confused how this would be prevented by the access policy. This error message would only trigger if current_user
is different from .author.id
, but the User
for .author
is being selected here based on current_user
, so they would have to match, right?
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.
Yeah, not a good example as we discussed last week. A better idea struck me which requires two globals but still simple enough and feels much more like a real world example.
Co-authored-by: Devon Campbell <[email protected]>
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.
Looks good. A few minor changes, and this is ready to go!
Co-authored-by: Devon Campbell <[email protected]>
Okay, I think I got them all! |
…-policy-fix-and-expansion
@raddevon Forgot all about this PR! In the meantime a small merge conflict popped up but has now been resolved. |
Okay, just added f005df8 on which operations return empty sets vs. which will show errors. Adding this is pretty nice as it allows a more thorough explanation on |
Fixes #6389 where a user noticed that the syntax declaration for access policies makes it look like annotations should be outside the braces when they should be inside, and that we don't have any access policy examples that show where annotations belong either so it took some experimentation to figure it out.
In our current example there is a bit of new learning to do so instead of declaring a new annotation at the same time, it uses the built-in
errmessage
to show where to add such notes and then mentions in the breakdown below that other annotations can go in this space as well. Plus adds an example where you might see this error: where an app is configured wrongly such that a user is allowed to try to write a post but is prevented by the access policy.