Skip to content

Commit f699dc9

Browse files
phani-srikarRachel Lee Nabors
authored andcommitted
fix: add callout for delete mutation permissions (#4973)
* fix: add callout for delete mutation permissions * fix: minor nits
1 parent 3c94b47 commit f699dc9

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/pages/cli/graphql/authorization-rules.mdx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,27 @@ In the example above:
321321
- **any signed in user** is allowed to read the list of employees' `name` and `email` fields
322322
- **only the employee/owner themselves** have CRUD access to their `ssn` field
323323

324+
<Callout warning>
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+
type Todo @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+
Since the `description` field is not accessible by "Admin" Cognito group users, they cannot delete any `Todo` records.
342+
343+
</Callout>
344+
324345
## Advanced
325346

326347
### Review and print access control matrix

0 commit comments

Comments
 (0)