Skip to content

Commit 0b6fc0e

Browse files
committed
Fix examples in authorization
1 parent 3323629 commit 0b6fc0e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

modules/ROOT/pages/security/authorization.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ If you want to check that after the update the author of the post is still the c
171171
[source, graphql, indent=0]
172172
----
173173
type Post @node @authorization(validate: [
174-
{ operations: [UPDATE], when: [AFTER], where: { node: { author: { id: "$jwt.sub" } } } }
174+
{ operations: [UPDATE], when: [AFTER], where: { node: { author: { id: { eq: "$jwt.sub" } } } } }
175175
]) {
176176
title: String!
177177
content: String!
@@ -190,7 +190,7 @@ For example, consider a `User` type with a `password` field:
190190
type User @node {
191191
id: ID!
192192
username: String!
193-
password: String! @authorization(where: [{ operations: [READ, UPDATE], where: { node: { id: "$jwt.sub" } } }])
193+
password: String! @authorization(validate: [{ operations: [READ, UPDATE], where: { node: { id: { eq: "$jwt.sub" } } } }])
194194
}
195195
----
196196

@@ -259,7 +259,7 @@ For example, the following would allow for the update of a `User` node if the JW
259259
----
260260
type User @node @authorization(validate: [
261261
{ operations: [UPDATE], where: { jwt: { roles: { includes: "admin" } } } }
262-
{ operations: [UPDATE], where: { node: { locked: false } } }
262+
{ operations: [UPDATE], where: { node: { locked: { eq: false } } } }
263263
]) {
264264
id: ID!
265265
locked: Boolean!
@@ -271,7 +271,7 @@ If you want to combine the rule that a user must be an admin with the rule that
271271
[source, graphql, indent=0]
272272
----
273273
type User @node @authorization(validate: [
274-
{ operations: [UPDATE], where: { AND: [{ jwt: { roles: { includes: "admin" } } }, { node: { locked: false } }] } }
274+
{ operations: [UPDATE], where: { AND: [{ jwt: { roles: { includes: "admin" } } }, { node: { locked: {eq: false} } }] } }
275275
]) {
276276
id: ID!
277277
locked: Boolean!

0 commit comments

Comments
 (0)