k0f*_*f33 5 firebase firebase-security google-cloud-firestore
我想suspendedProfile
在一个user
文档中调用一个只读属性,其中所有其他属性都具有当前登录用户的读/写访问权限.有没有办法用简单的安全规则来做到这一点?
我想到了两个解决方案:
allow write: if request.resource.data.suspendedProfile == null;
/secure
与集合allow read;
内部user
文件我认为第一个选项是更好的所有与用户相关的属性都在一个单独的文件中,但我很想听听你的想法.有没有其他更简单的方法来实现这一目标?
我想我设法使用Firebase文档为我自己的答案找到了解决方案.
// A user can update a product reviews, but they can't change
// the headline.
// Also, they should only be able up update their own product review,
// and they still have to list themselves as an author
allow update: if request.resource.data.headline == resource.data.headline
&& resource.data.authorID == request.auth.userID
&& request.resource.data.authorID == request.auth.userID;
Run Code Online (Sandbox Code Playgroud)
所以在我的情况下,我会 allow update: if request.resource.data.suspendedProfile == resource.data.suspendedProfile
归档时间: |
|
查看次数: |
1253 次 |
最近记录: |