KeystoneJS 中意外的字段访问控制行为
Unexpected field access control behaviour in KeystoneJS
我正在尝试根据 these instructions.
在 KeystoneJS 中应用字段级访问逻辑
以下对管理员 UI 隐藏了一个字段 fieldName
:
fieldName: {
type: Text,
access: {
read: false,
update: false,
create: false
},
},
但是如果我使用 imperative approach,该字段 不会 对管理员 UI 隐藏。见下文,我希望产生与上述静态方法相同的结果:
fieldName: {
type: Text,
access: {
read: ({ authentication: { item, listKey } }) => {
return false;
},
update: ({ authentication: { item, listKey } }) => {
return false;
},
create: ({ authentication: { item, listKey } }) => {
return false;
}
},
},
我是不是遗漏了什么或者这是一个错误?
命令式方法使用了一个不能传递给客户端的函数。
Keystone 为此可能使用 true
false
值。这意味着在为列表中的字段生成管理 ui 元数据时 !!(() => {})
变为真。
"Granular Imperative Boolean" 部分中有一条注释,解释了这些字段确实包含在 graphql 和 ui 中,但在执行期间被排除在外。
我正在尝试根据 these instructions.
在 KeystoneJS 中应用字段级访问逻辑以下对管理员 UI 隐藏了一个字段 fieldName
:
fieldName: {
type: Text,
access: {
read: false,
update: false,
create: false
},
},
但是如果我使用 imperative approach,该字段 不会 对管理员 UI 隐藏。见下文,我希望产生与上述静态方法相同的结果:
fieldName: {
type: Text,
access: {
read: ({ authentication: { item, listKey } }) => {
return false;
},
update: ({ authentication: { item, listKey } }) => {
return false;
},
create: ({ authentication: { item, listKey } }) => {
return false;
}
},
},
我是不是遗漏了什么或者这是一个错误?
命令式方法使用了一个不能传递给客户端的函数。
Keystone 为此可能使用 true
false
值。这意味着在为列表中的字段生成管理 ui 元数据时 !!(() => {})
变为真。
"Granular Imperative Boolean" 部分中有一条注释,解释了这些字段确实包含在 graphql 和 ui 中,但在执行期间被排除在外。