简体   繁体   English

Firestore 规则是否区分大小写或我的路径是否包含错误?

[英]Are firestore rules case sensitive or does my path contain an error?

I am new to firestore rules and I encountered a glaring problem.我是 Firestore 规则的新手,遇到了一个明显的问题。

My rules look like this:我的规则如下所示:

在此处输入图像描述

If I uncomment either or both the sections, and comment the part with (document=**), all project calls to the firestore realtime database will fail because of permissions.如果我取消对其中一个或两个部分的注释,并使用 (document=**) 注释该部分,则所有对 firestore 实时数据库的项目调用都将因权限而失败。 I cannot figure out why.我不知道为什么。 In all documentation this is the preferred way.在所有文档中,这是首选方式。 Is it case sensitive?是否区分大小写? I know it is not the auth part that fails, because if I leave the rules like in the image, all project calls work.我知道失败的不是身份验证部分,因为如果我保留图像中的规则,所有项目调用都会起作用。

For clarity, this is what the database structure looks like (yes, Projects has a capital P):为了清楚起见,这就是数据库结构的样子(是的,Projects 有一个大写字母 P):

在此处输入图像描述

Are Firestore rules case sensitive? Firestore 规则是否区分大小写?

Yes, the collection/document IDs are case sensitive.是的,集合/文档 ID 区分大小写。

match /{document=**} {
  allow read, write: if request.auth != null;
}

The above rule allows any user logged in with Firebase authentication to read and write to any collection in the database.上述规则允许任何使用 Firebase 身份验证登录的用户读取和写入数据库中的任何集合。 If you still get permission errors, check if the user is logged in or no.如果仍然出现权限错误,请检查用户是否已登录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM