我不知道如何访问KeystoneJS 6中的KeystoneJS对象。
我有5份清单:
UserBlogPostCommentLabel让我们关注Blog列表。我只希望允许一个User更新和删除他/她的Blog,如果他/她拥有它。我还希望只为当前Post所拥有的Blog创建一个User。
如何在KeystoneJS 6中实现这一点?
我试图实现这样的东西:
const blogBelongsToUser = ({ session, item }) => {}但我没有成功。
发布于 2022-11-11 20:40:11
我认为您可以在模式中使用access字段。
const Blog = new keystone.List('Blog', {
access: ({ authentication: { item: user } }) => ({
create: user ? true : false,
read: true,
update: user ? user.id === blog.author : false,
delete: user ? user.id === blog.author : false,
}),
});https://stackoverflow.com/questions/74400141
复制相似问题