Skip to content
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