使用keystonejs,我希望仅在当前用户为项目所有者的情况下才允许更新访问。附件中您找到我的方法。我怀疑GraphQlWhere-return Value的语法不太正确。
此外,此刻是否将填充所有者字段?
keystone.createList('Pet', {
access: {
update: ({ authentication: { item: user } }) => {
if (!user) return false;
return { owner: { id: user.id } }; // <--- HOW TO DO THIS RIGHT?
};
},
fields: {
name: { type: Text },
owner: {
type: Relationship,
ref: 'User',
}
}
})