Skip to content

Commit cc8bd3f

Browse files
Apply suggestions from code review
Co-authored-by: Richard Sill <[email protected]>
1 parent c871709 commit cc8bd3f

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

modules/ROOT/pages/security/authorization.adoc

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,9 @@ type Post @authorization(validate: [
174174

175175
== Authorization on fields
176176

177-
The `@authorization` directive can be used either on either object types or their fields, with the former being used in examples for the most part on this page. When applied to a field, the authorization rules are only evaluated if the matching operations are performed on that field. For example, consider a `User` type with a `password` field:
177+
The `@authorization` directive can be used either on object types or their fields, with the former being used in examples for the most part on this page.
178+
When applied to a field, the authorization rules are only evaluated if the matching operations are performed on that field.
179+
For example, consider a `User` type with a `password` field:
178180

179181
[source, graphql, indent=0]
180182
----
@@ -208,7 +210,8 @@ However, consider the following query:
208210
}
209211
----
210212

211-
This will require a valid JWT to have been provided with the request, and the matching users will be filtered down according to the JWT subject. The same will apply for attempting to update the `password` field, the update will only apply to the user matching the JWT.
213+
This will require a valid JWT to have been provided with the request, and the matching users will be filtered down according to the JWT subject.
214+
The same applies for attempting to update the `password` field, the update will only apply to the user matching the JWT.
212215

213216

214217
== Authorization without authentication
@@ -237,9 +240,10 @@ type Post @authorization(filter: [
237240

238241
== Ordering of rules
239242

240-
In each ruleset (`filter` and `validate`), rules are joined with an `OR`. The two rulesets are joined with an `AND`.
243+
In each ruleset (`filter` and `validate`), rules are joined with an `OR`.
244+
The two rulesets are joined with an `AND`.
241245

242-
An example pseudo-logic would be `(filterRule1 OR filterRule2) AND (validateRule1 OR validateRule2)`.
246+
For example: `(filterRule1 OR filterRule2) AND (validateRule1 OR validateRule2)`.
243247

244248
If ever there are two rules which you would like to be combined with an `AND`, these should be combined into a single rule. Take for instance the following example:
245249

@@ -254,7 +258,7 @@ type User @authorization(validate: [
254258
}
255259
----
256260

257-
Say in this example we wanted it to be that a user needs to be an admin _and_ the `locked` property must be `false` in order to update a `User` node. We would need to combine these predicates into a single rule:
261+
If you want to combine the rule that a user must be an admin with the rule that the `locked` property must be `false` in order to update a `User` node, add them both to the `where` field using `AND` in a single rule:
258262

259263
[source, graphql, indent=0]
260264
----

modules/ROOT/pages/types/relationships.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ You can add relationship properties to the example in two steps:
6565
. Add a type definition decorated with the `@relationshipProperties` directive, containing the desired relationship properties.
6666
. Add a `properties` argument to both "sides" (or just one side, if you prefer) of the `@relationship` directive which points to the newly defined interface.
6767

68-
Relationship properties fields can only be primitive types or their list variants. You cannot map complex types such as object types into the types modelling relationship properties.
68+
Relationship properties fields can only be primitive types or their list variants.
69+
You cannot map complex types such as object types into the types modelling relationship properties.
6970

7071
For example, suppose you want to distinguish which roles an actor played in a movie:
7172

0 commit comments

Comments
 (0)