【发布时间】:2020-04-23 21:11:05
【问题描述】:
我正在创建一个具有 firebase 集成的 ionic 应用程序,其中我在应用程序中创建了一个帖子部分。用户可以像 facebook 这样写帖子,任何经过身份验证的用户都可以对帖子发表评论, 以下是我如何存储数据的数据库设计:-posts/{postsDocument}/cmets/{cmetsDocument} Comments 是 postsDocument 的子集合,其中包含特定帖子的所有 cmets。 postDocument 和 cmetsDocument 还包含用户的 Firebase uid。 我已经写了规则,任何用户都可以评论帖子并阅读其他 cmets,但我想要用户可以更新自己的评论而不是其他人的规则,并且只有帖子所有者可以删除评论。 检查下面的规则。请帮我解决我所缺少的
match /posts/{postId} {
allow read, write: if request.auth.uid != null;
match /{comments}/{commentId} {
allow read, create: if request.auth.uid != null;
allow update: if ;
allow delete: if ;
}
}
【问题讨论】:
标签: firebase google-cloud-firestore firebase-security