我正在使用Firebase规则模拟器,但是它拒绝对经过身份验证的用户或未经身份验证的用户进行读写。
rules_version = '2';
service cloud.firestore {
match /databases/collection1/{document=**} {
allow read: if true;
allow write: if request.auth.uid != null;
}
match /databases/collection2/{document=**} {
allow read: if false;
allow create: if request.auth.uid != null;
allow update, delete: if false;
}
}
答案 0 :(得分:0)
您的规则应这样开始:
The.Eternal.Evil.of.Asia.1995.
Guzoo.1986.
您的规则缺少output = model(data[None, ...])
部分,因此它们与任何内容都不匹配并且拒绝所有内容。您可以像这样重新编写示例:
data
这允许以下模拟请求:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
/databases/{database}
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// Matches every document in collection1 and every subcollection under it
match /collection1/{document=**} {
allow read;
allow write: if request.auth.uid != null;
}
// Matches every document in collection2 and every subcollection under it
match /collection2/{document=**} {
allow create: if request.auth.uid != null;
}
}
}
其他模拟请求被拒绝。
希望有帮助!