Skip to content

Commit

Permalink
Remove itemId from FieldAccessArgs (#4935)
Browse files Browse the repository at this point in the history
  • Loading branch information
timleslie authored Feb 25, 2021
1 parent 7c25896 commit 562cccb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/mean-lions-suffer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystonejs-next/keystone': major
---

Removed `itemId` from `FieldAccessArgs` and no longer pass this value into field level imperative access control rules.
2 changes: 0 additions & 2 deletions docs-next/pages/apis/access-control.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,6 @@ Imperative access control functions are passed a collection of arguments which c
| `session` | The current session object. See the [Sessions API](./session) for details |
| `originalInput` | For `create` and `update` operations, this is the value of `data` passed into the mutation. For `read` operations this value is `undefined`. |
| `gqlName` | The name of the query or mutation being called. |
| `itemId` | The `id` of the item being updated, deleted, or read. |
| `context` | The [`KeystoneContext`](./context) object of the originating GraphQL operation. |
| `item` | The item being updated, deleted, or read. This object is an unresolved list item. See the [list item API](./list-items) for more details on unresolved list items. |

Expand All @@ -320,7 +319,6 @@ export default config({
session,
originalInput,
gqlName,
itemId,
context,
item,
}) => {
Expand Down
4 changes: 1 addition & 3 deletions packages-next/keystone/src/lib/createAccessControlContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ type FieldAccessArgs = {
session: any;
originalInput: any;
gqlName: string;
itemId: any;
context: KeystoneContext;
item: any;
fieldKey: string;
Expand Down Expand Up @@ -123,7 +122,7 @@ export const accessControlContext = {
originalInput: FieldAccessArgs['originalInput'],
item: FieldAccessArgs['item'],
operation: FieldAccessArgs['operation'],
{ gqlName, itemId, context }: Pick<FieldAccessArgs, 'gqlName' | 'itemId' | 'context'>
{ gqlName, context }: Pick<FieldAccessArgs, 'gqlName' | 'context'>
) {
return validateFieldAccessControl({
access: access[context.schemaName],
Expand All @@ -134,7 +133,6 @@ export const accessControlContext = {
fieldKey,
listKey,
gqlName,
itemId,
context,
});
},
Expand Down

1 comment on commit 562cccb

@vercel
Copy link

@vercel vercel bot commented on 562cccb Feb 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.