我正在尝试创建一条规则,允许在我的消防站db中使用某些函数(我从3个月前就开始使用firebase,我对此非常陌生)。主要思想是找到我存储在用户文档中的用户配置文件的_key。然后,使用我以前找到的id搜索用户配置文件中允许的所有权限。如果我找到了权限,我就可以访问这个函数
service cloud.firestore {
match /databases/{database}/documents {
function getPermisos(idPermiso){
return get(/databases/{database}/documents/user-prof
我目前有安全规则,允许用户只从名为"153“的集合中读取。
在Android中,我访问Firestore并调用Firestore实例上的.collection("153").get()...从该集合中检索数据。
相反,如果Android代码读取.collection("999").get...,则该权限将被拒绝,这是应该的。
安全规则:
service cloud.firestore {
match /databases/{database}/documents {
// FULL ADMIN ACCESS
match /{docum
我有一个简单的加密货币应用程序,它使用API来获取价格。我使用Firestore来存储我的API密钥,我的应用程序在启动时从Firestore中检索我的API密钥。我的API键是我在Firestore中拥有的唯一数据。由于我的应用程序不允许用户创建配置文件/帐户,所以我的规则中不包括用户身份验证。我对Firestore的安全规则是:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /Data/{Data} {
allo
我试图在Cloud中实现我认为是基本的安全规则,即允许对特定集合的读取访问。
service cloud.firestore {
match /databases/{collectionName}/documents {
match /{document=**}{
allow read : if collectionName=="metadata";
}
}
}
因此,在规则操场上,对/metadata/status的查询被拒绝,但是,如果我将操作符切换到!=而不是==,它允许对任何集合进行任何查询,而不仅仅是那些不是metadata
我在努力保护我的火力基地。
我这样做是为了保护我的用户列表。
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /about/{id} {
allow read: if true;
allow write: if request.auth.uid != null;
}
match /avantages/{id} {
allow read: if true;
all
我有一个Firebase项目,几个小时前,它停止了从集合中加载文档,我无法从Firebase控制台中看到它们。我不知道发生了什么,我在Mac上使用Safari,唯一的提示是屏幕右上角的“通知”声音。它说我的安全规则太弱了,所以我做了一点修改。也许我的数据库规则不好,请看一下:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if request.a
我有一个Firestore,其中设置了结构:registrations/[userId]/symptoms/[documentId]/[some kind of document]
我之所以这样做,是因为用户应该只读取自己的症状,因此我认为在userId上分离这些症状会更好。该文档不了解userId。
当我现在将它导出到BigQuery时,我不知道如何获得文档和userId之间的关联,也许这是不可能的。
我应该把它改为:symptoms/[documentId]/[some kind of document with a userId]
然后只过滤出特定userId的文档?阅读的数量有什么不同
对于Firebase实时数据库的安全规则,可以使用以下规则在同一棵树中存在公共数据和私有数据。
但是,在使用Firestore时,它似乎不能使我们这样做,因为我们可以检索的数据只有在集合或文档下。当在同一个文档中定义公共数据和私有数据并获取数据w/ collection/document时,如果我们不是所有者,就会得到私有数据权限不足的错误。
在使用RTDB时,我们可以获得'users/{userId}/publicInfo‘的数据,因为我们对收集/文档一无所知。
有什么方法可以用Firestore来处理RTDB吗?否则,我们应该分开进行公共/私人收藏?
// rule of Fire
考虑Firebase文档中的示例
service cloud.firestore {
match /databases/{database}/documents {
match /cities/{city} {
allow read, write: if <condition>;
// Explicitly define rules for the 'landmarks' subcollection
match /landmarks/{landmark} {
allow read, wri
为Firestore编写规则,似乎自定义变量不起作用。有谁知道为什么或曾见过类似的行为吗?使用下面的命令,我被拒绝了访问,尽管uid位于admin数组中。
service cloud.firestore {
match /databases/{database}/documents {
match /conferences/{confid} {
allow read,write: if request.auth.uid in get(/databases/$(database)/documents/conferences/$(confid)).d
我的数据库中有以下字符集合结构(消防局)
/characters/{uid}
- username: string
- clan: string
- mana: number
- health: number
etc...
我正试图用以下逻辑为/characters/{uid}找出一条安全规则
service cloud.firestore {
match /databases/{database}/documents {
// Characters
match /characters/{characterID} {
allow create: if