我有一个在此集合中共享的集合,我将拥有一个文档,该文档将用作管理员和客户之间的联系(因此客户可以推动其在线状态,因此管理员也是如此),我想制定的是一个安全规则管理员仅修改他的提交
(Onlineadmin:true)
和客户端仅修改其文档(OnlineClients:{clientId:true})。
可以使用规则完成吗?如果是这样,如何将写作限制为每个用户类型,并且取决于在这种情况下的内容?
doc model
I have a collection called shared in this collection I will have a doc that will serve as a connection between admin and clients (so clients can push theirs online status so does the the admin) , what I want to make is a security rule that allows the admin to modify his filed only
(onlineAdmin : true)
and clients to modify theirs doc only (onlineClients : {clientID : true}).
can this be done using rules ? if so how to limit the writing to each of the user types and depending on what in this case ?
Doc Model
发布评论
评论(1)
是的,这是完全可能的,并且在。从那里有这些示例规则,以定义Firestore文档中的角色时:
以及定义自定义属性中的角色时的这些规则:
我还建议从该主题的Firebase专家查看此视频:
Yup, that is totally possible and covered quite well in the Firebase documentation on role based access control. From there come these example rules for when you define the roles in Firestore documents:
And these rules for when you define the roles in custom attributes:
I also recommend checking out this video from a Firebase expert on the topic: Implementing Authorization Models