You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/pages/cli/graphql/authorization-rules.mdx
+21Lines changed: 21 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -321,6 +321,27 @@ In the example above:
321
321
-**any signed in user** is allowed to read the list of employees' `name` and `email` fields
322
322
-**only the employee/owner themselves** have CRUD access to their `ssn` field
323
323
324
+
<Calloutwarning>
325
+
326
+
To prevent unintended loss of data, the user or role that attempts to `delete` a record should have delete permissions on every field of the `@model` annotated GraphQL type.
327
+
For example, in the schema below:
328
+
```graphql
329
+
typeTodo@model@auth(rules: [
330
+
{ allow: private, provider: iam },
331
+
{ allow: groups, groups: ["Admin"] }
332
+
]) {
333
+
id: ID!
334
+
name: String!@auth(rules: [
335
+
{ allow: private, provider: iam },
336
+
{ allow: groups, groups: ["Admin"] }
337
+
])
338
+
description: String@auth(rules: [{ allow: private, provider: iam }])
339
+
}
340
+
```
341
+
Sincethe `description` fieldisnotaccessibleby"Admin"Cognitogroupusers, theycannotdeleteany `Todo` records.
0 commit comments