Firestore Rules Simulator-资源未定义 [英] Firestore Rules Simulator - Resource undefined
问题描述
我正在尝试使用firebase提供的新规则模拟器工具,但是我在使它工作时遇到问题
I'm trying to use the new Rules Simulator Tool provided by firebase, however I'm having problems getting it to work
在模拟器面板中设置这样的路径时
When setting the path like this in the simulator panel
/users/Gd9jd3jd8sSixxx38djSs
然后选择身份验证选项,并将授权用户的uid输入为相同的字符串Gd9jd3jd8sSixxx38djSs.使用此Firestore规则时出现以下错误
And then selecting the authentication options and inputting the uid of the authorised user as the same string Gd9jd3jd8sSixxx38djSs. I'm getting the following error when using this firestore rule
match /users/{user}{
allow read: if request.auth.uid == resource.id
}
错误:模拟器.规则第[4]行,第[41]列.在对象上未定义属性ID."
"Error: simulator.rules line [4], column [41]. Property id is undefined on object. "
此文档确实存在于我的Firestore数据库中,并且位于指定的正确路径中.
This document does exist inside my firestore database and is in the correct path specified.
有人有什么想法吗?谢谢
Anyone have any ideas? Thanks
推荐答案
听起来您只想使用定义的user
占位符:
It sounds like you just want to use the user
placeholder you defined:
allow read: if request.auth.uid == user
这篇关于Firestore Rules Simulator-资源未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!