【发布时间】:2020-04-10 09:44:23
【问题描述】:
假设我有以下 AppSync GraphQL 架构,其类型为 User,Post 类型的 editors 字段设置为 Users 数组:
type User
@model
@auth(rules: [
{ allow: owner }
])
{
id: ID!
owner: String!
username: String!
}
type Post
@model
@auth(rules: [
{ allow: owner },
# Can I do this?
# { allow: owner, ownerField: "editors.owner", operations: [update] }
])
{
id: ID!
owner: String!
title: String!
content: String
editors: [User]
}
如何创建@auth 规则以授予editors 数组中Users 的更新权限?
【问题讨论】:
-
@Hoarce 你找到解决方案了吗?
-
@ataravati,你找到解决方案了吗?
-
@HackRx 我最终做的是用
@function创建一个lambda解析器。 -
@ataravati lambda resolver on queries/mutation 对吗?
-
是的,没错。
标签: graphql aws-appsync