Firestore Rules Simulator - Resource undefined

大兔子大兔子 提交于 2020-01-03 16:59:28

问题


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

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
}

"Error: simulator.rules line [4], column [41]. Property id is undefined on object. "

This document does exist inside my firestore database and is in the correct path specified.

Anyone have any ideas? Thanks


回答1:


It sounds like you just want to use the user placeholder you defined:

 allow read: if request.auth.uid == user


来源:https://stackoverflow.com/questions/51874357/firestore-rules-simulator-resource-undefined

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!