Skip to content

Fix examples in authorization #278

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

Merged
merged 1 commit into from
Aug 19, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions modules/ROOT/pages/security/authorization.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ If you want to check that after the update the author of the post is still the c
[source, graphql, indent=0]
----
type Post @node @authorization(validate: [
{ operations: [UPDATE], when: [AFTER], where: { node: { author: { id: "$jwt.sub" } } } }
{ operations: [UPDATE], when: [AFTER], where: { node: { author: { id: { eq: "$jwt.sub" } } } } }
]) {
title: String!
content: String!
Expand All @@ -190,7 +190,7 @@ For example, consider a `User` type with a `password` field:
type User @node {
id: ID!
username: String!
password: String! @authorization(where: [{ operations: [READ, UPDATE], where: { node: { id: "$jwt.sub" } } }])
password: String! @authorization(validate: [{ operations: [READ, UPDATE], where: { node: { id: { eq: "$jwt.sub" } } } }])
}
----

Expand Down Expand Up @@ -259,7 +259,7 @@ For example, the following would allow for the update of a `User` node if the JW
----
type User @node @authorization(validate: [
{ operations: [UPDATE], where: { jwt: { roles: { includes: "admin" } } } }
{ operations: [UPDATE], where: { node: { locked: false } } }
{ operations: [UPDATE], where: { node: { locked: { eq: false } } } }
]) {
id: ID!
locked: Boolean!
Expand All @@ -271,7 +271,7 @@ If you want to combine the rule that a user must be an admin with the rule that
[source, graphql, indent=0]
----
type User @node @authorization(validate: [
{ operations: [UPDATE], where: { AND: [{ jwt: { roles: { includes: "admin" } } }, { node: { locked: false } }] } }
{ operations: [UPDATE], where: { AND: [{ jwt: { roles: { includes: "admin" } } }, { node: { locked: {eq: false} } }] } }
]) {
id: ID!
locked: Boolean!
Expand Down