Skip to content

Commit

Permalink
Skip fetching fields with static fieldMode: 'hidden' on the item view (
Browse files Browse the repository at this point in the history
  • Loading branch information
emmatown authored Sep 10, 2021
1 parent a645861 commit 8388452
Show file tree
Hide file tree
Showing 33 changed files with 164 additions and 202 deletions.
5 changes: 5 additions & 0 deletions .changeset/wise-garlics-swim.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-next/keystone': major
---

The Admin UI will skip fetching fields that have a statically set `itemView.fieldMode: 'hidden'` on the item view. The `id` argument to the `KeystoneAdminUIFieldMeta.itemView` GraphQL field can now be omitted which will make `KeystoneAdminUIFieldMetaItemView.fieldMode` return null when there isn't a static field mode. The `itemView` also no longer uses a sudo context when fetching the item in the `KeystoneAdminUIFieldMetaItemView.fieldMode`. Previously, if someone had access to the Admin UI(`ui.isAccessAllowed`) and a field had a `itemView.fieldMode` function that used the `item` argument, someone could bypass access control to determine whether or not an item with a given id exists.
4 changes: 2 additions & 2 deletions examples-staging/assets-cloud/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ type KeystoneAdminUIFieldMeta {
customViewsIndex: Int
createView: KeystoneAdminUIFieldMetaCreateView!
listView: KeystoneAdminUIFieldMetaListView!
itemView(id: ID!): KeystoneAdminUIFieldMetaItemView
itemView(id: ID): KeystoneAdminUIFieldMetaItemView
search: QueryMode
}

Expand All @@ -303,7 +303,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {
}

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode!
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand Down
4 changes: 2 additions & 2 deletions examples-staging/assets-local/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ type KeystoneAdminUIFieldMeta {
customViewsIndex: Int
createView: KeystoneAdminUIFieldMetaCreateView!
listView: KeystoneAdminUIFieldMetaListView!
itemView(id: ID!): KeystoneAdminUIFieldMetaItemView
itemView(id: ID): KeystoneAdminUIFieldMetaItemView
search: QueryMode
}

Expand All @@ -281,7 +281,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {
}

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode!
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand Down
4 changes: 2 additions & 2 deletions examples-staging/auth/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ type KeystoneAdminUIFieldMeta {
customViewsIndex: Int
createView: KeystoneAdminUIFieldMetaCreateView!
listView: KeystoneAdminUIFieldMetaListView!
itemView(id: ID!): KeystoneAdminUIFieldMetaItemView
itemView(id: ID): KeystoneAdminUIFieldMetaItemView
search: QueryMode
}

Expand All @@ -224,7 +224,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {
}

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode!
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand Down
4 changes: 2 additions & 2 deletions examples-staging/basic/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ type KeystoneAdminUIFieldMeta {
customViewsIndex: Int
createView: KeystoneAdminUIFieldMetaCreateView!
listView: KeystoneAdminUIFieldMetaListView!
itemView(id: ID!): KeystoneAdminUIFieldMetaItemView
itemView(id: ID): KeystoneAdminUIFieldMetaItemView
search: QueryMode
}

Expand All @@ -470,7 +470,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {
}

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode!
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand Down
4 changes: 2 additions & 2 deletions examples-staging/ecommerce/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ type KeystoneAdminUIFieldMeta {
customViewsIndex: Int
createView: KeystoneAdminUIFieldMetaCreateView!
listView: KeystoneAdminUIFieldMetaListView!
itemView(id: ID!): KeystoneAdminUIFieldMetaItemView
itemView(id: ID): KeystoneAdminUIFieldMetaItemView
search: QueryMode
}

Expand All @@ -853,7 +853,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {
}

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode!
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand Down
4 changes: 2 additions & 2 deletions examples-staging/embedded-nextjs/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ type KeystoneAdminUIFieldMeta {
customViewsIndex: Int
createView: KeystoneAdminUIFieldMetaCreateView!
listView: KeystoneAdminUIFieldMetaListView!
itemView(id: ID!): KeystoneAdminUIFieldMetaItemView
itemView(id: ID): KeystoneAdminUIFieldMetaItemView
search: QueryMode
}

Expand All @@ -148,7 +148,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {
}

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode!
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand Down
4 changes: 2 additions & 2 deletions examples-staging/graphql-api-endpoint/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ type KeystoneAdminUIFieldMeta {
customViewsIndex: Int
createView: KeystoneAdminUIFieldMetaCreateView!
listView: KeystoneAdminUIFieldMetaListView!
itemView(id: ID!): KeystoneAdminUIFieldMetaItemView
itemView(id: ID): KeystoneAdminUIFieldMetaItemView
search: QueryMode
}

Expand All @@ -399,7 +399,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {
}

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode!
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand Down
4 changes: 2 additions & 2 deletions examples-staging/roles/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ type KeystoneAdminUIFieldMeta {
customViewsIndex: Int
createView: KeystoneAdminUIFieldMetaCreateView!
listView: KeystoneAdminUIFieldMetaListView!
itemView(id: ID!): KeystoneAdminUIFieldMetaItemView
itemView(id: ID): KeystoneAdminUIFieldMetaItemView
search: QueryMode
}

Expand All @@ -409,7 +409,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {
}

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode!
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand Down
4 changes: 2 additions & 2 deletions examples-staging/sandbox/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ type KeystoneAdminUIFieldMeta {
customViewsIndex: Int
createView: KeystoneAdminUIFieldMetaCreateView!
listView: KeystoneAdminUIFieldMetaListView!
itemView(id: ID!): KeystoneAdminUIFieldMetaItemView
itemView(id: ID): KeystoneAdminUIFieldMetaItemView
search: QueryMode
}

Expand All @@ -252,7 +252,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {
}

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode!
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand Down
4 changes: 2 additions & 2 deletions examples/blog/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ type KeystoneAdminUIFieldMeta {
customViewsIndex: Int
createView: KeystoneAdminUIFieldMetaCreateView!
listView: KeystoneAdminUIFieldMetaListView!
itemView(id: ID!): KeystoneAdminUIFieldMetaItemView
itemView(id: ID): KeystoneAdminUIFieldMetaItemView
search: QueryMode
}

Expand All @@ -270,7 +270,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {
}

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode!
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand Down
4 changes: 2 additions & 2 deletions examples/custom-admin-ui-logo/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ type KeystoneAdminUIFieldMeta {
customViewsIndex: Int
createView: KeystoneAdminUIFieldMetaCreateView!
listView: KeystoneAdminUIFieldMetaListView!
itemView(id: ID!): KeystoneAdminUIFieldMetaItemView
itemView(id: ID): KeystoneAdminUIFieldMetaItemView
search: QueryMode
}

Expand All @@ -308,7 +308,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {
}

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode!
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand Down
4 changes: 2 additions & 2 deletions examples/custom-admin-ui-navigation/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ type KeystoneAdminUIFieldMeta {
customViewsIndex: Int
createView: KeystoneAdminUIFieldMetaCreateView!
listView: KeystoneAdminUIFieldMetaListView!
itemView(id: ID!): KeystoneAdminUIFieldMetaItemView
itemView(id: ID): KeystoneAdminUIFieldMetaItemView
search: QueryMode
}

Expand All @@ -308,7 +308,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {
}

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode!
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand Down
4 changes: 2 additions & 2 deletions examples/custom-admin-ui-pages/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ type KeystoneAdminUIFieldMeta {
customViewsIndex: Int
createView: KeystoneAdminUIFieldMetaCreateView!
listView: KeystoneAdminUIFieldMetaListView!
itemView(id: ID!): KeystoneAdminUIFieldMetaItemView
itemView(id: ID): KeystoneAdminUIFieldMetaItemView
search: QueryMode
}

Expand All @@ -308,7 +308,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {
}

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode!
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand Down
4 changes: 2 additions & 2 deletions examples/custom-field-view/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ type KeystoneAdminUIFieldMeta {
customViewsIndex: Int
createView: KeystoneAdminUIFieldMetaCreateView!
listView: KeystoneAdminUIFieldMetaListView!
itemView(id: ID!): KeystoneAdminUIFieldMetaItemView
itemView(id: ID): KeystoneAdminUIFieldMetaItemView
search: QueryMode
}

Expand All @@ -311,7 +311,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {
}

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode!
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand Down
4 changes: 2 additions & 2 deletions examples/custom-field/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ type KeystoneAdminUIFieldMeta {
customViewsIndex: Int
createView: KeystoneAdminUIFieldMetaCreateView!
listView: KeystoneAdminUIFieldMetaListView!
itemView(id: ID!): KeystoneAdminUIFieldMetaItemView
itemView(id: ID): KeystoneAdminUIFieldMetaItemView
search: QueryMode
}

Expand All @@ -244,7 +244,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {
}

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode!
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand Down
4 changes: 2 additions & 2 deletions examples/default-values/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ type KeystoneAdminUIFieldMeta {
customViewsIndex: Int
createView: KeystoneAdminUIFieldMetaCreateView!
listView: KeystoneAdminUIFieldMetaListView!
itemView(id: ID!): KeystoneAdminUIFieldMetaItemView
itemView(id: ID): KeystoneAdminUIFieldMetaItemView
search: QueryMode
}

Expand All @@ -308,7 +308,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {
}

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode!
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand Down
4 changes: 2 additions & 2 deletions examples/document-field/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ type KeystoneAdminUIFieldMeta {
customViewsIndex: Int
createView: KeystoneAdminUIFieldMetaCreateView!
listView: KeystoneAdminUIFieldMetaListView!
itemView(id: ID!): KeystoneAdminUIFieldMetaItemView
itemView(id: ID): KeystoneAdminUIFieldMetaItemView
search: QueryMode
}

Expand All @@ -255,7 +255,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {
}

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode!
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand Down
4 changes: 2 additions & 2 deletions examples/extend-graphql-schema/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ type KeystoneAdminUIFieldMeta {
customViewsIndex: Int
createView: KeystoneAdminUIFieldMetaCreateView!
listView: KeystoneAdminUIFieldMetaListView!
itemView(id: ID!): KeystoneAdminUIFieldMetaItemView
itemView(id: ID): KeystoneAdminUIFieldMetaItemView
search: QueryMode
}

Expand All @@ -263,7 +263,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {
}

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode!
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand Down
4 changes: 2 additions & 2 deletions examples/json/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ type KeystoneAdminUIFieldMeta {
customViewsIndex: Int
createView: KeystoneAdminUIFieldMetaCreateView!
listView: KeystoneAdminUIFieldMetaListView!
itemView(id: ID!): KeystoneAdminUIFieldMetaItemView
itemView(id: ID): KeystoneAdminUIFieldMetaItemView
search: QueryMode
}

Expand All @@ -233,7 +233,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {
}

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode!
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand Down
4 changes: 2 additions & 2 deletions examples/task-manager/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ type KeystoneAdminUIFieldMeta {
customViewsIndex: Int
createView: KeystoneAdminUIFieldMetaCreateView!
listView: KeystoneAdminUIFieldMetaListView!
itemView(id: ID!): KeystoneAdminUIFieldMetaItemView
itemView(id: ID): KeystoneAdminUIFieldMetaItemView
search: QueryMode
}

Expand All @@ -308,7 +308,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {
}

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode!
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand Down
4 changes: 2 additions & 2 deletions examples/testing/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ type KeystoneAdminUIFieldMeta {
customViewsIndex: Int
createView: KeystoneAdminUIFieldMetaCreateView!
listView: KeystoneAdminUIFieldMetaListView!
itemView(id: ID!): KeystoneAdminUIFieldMetaItemView
itemView(id: ID): KeystoneAdminUIFieldMetaItemView
search: QueryMode
}

Expand All @@ -365,7 +365,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {
}

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode!
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand Down
Loading

0 comments on commit 8388452

Please sign in to comment.