Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/233.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何在锁定模式下获取firebase firestore数据_Android_Firebase_Google Cloud Firestore - Fatal编程技术网

Android 如何在锁定模式下获取firebase firestore数据

Android 如何在锁定模式下获取firebase firestore数据,android,firebase,google-cloud-firestore,Android,Firebase,Google Cloud Firestore,我已经开发了一个android应用程序,使用Firebase,测试模式下的云firestore。测试模式意味着“任何拥有我的数据库引用的人都可以读取或写入我的数据库”。然后,我将安全规则更改为“允许读取,写入:if false”以防止出现这种情况。它被称为锁定模式。 但在锁定模式下,不会获取数据。谷歌没有这方面的适当文档。我能做些什么?我想看看我们的,这将解释如何正确保护您的Firestore数据库。例如: service cloud.firestore { match /databases

我已经开发了一个android应用程序,使用Firebase,测试模式下的云firestore。测试模式意味着“任何拥有我的数据库引用的人都可以读取或写入我的数据库”。然后,我将安全规则更改为“允许读取,写入:if false”以防止出现这种情况。它被称为锁定模式。 但在锁定模式下,不会获取数据。谷歌没有这方面的适当文档。我能做些什么?

我想看看我们的,这将解释如何正确保护您的Firestore数据库。例如:

service cloud.firestore {
  match /databases/{database}/documents {
    // only a user can read and write their profile
    match /users/{userId} {
      allow read, write: if request.auth.uid == userId;
    }
    // any authenticated user can read and write messages
    match /rooms/{roomId} {
      match /messages/{messageId} {
        allow read, write: if request.auth != null;
      }
    }
  }
}
我会看看我们的,这将解释如何能够正确地保护您的Firestore数据库。例如:

service cloud.firestore {
  match /databases/{database}/documents {
    // only a user can read and write their profile
    match /users/{userId} {
      allow read, write: if request.auth.uid == userId;
    }
    // any authenticated user can read and write messages
    match /rooms/{roomId} {
      match /messages/{messageId} {
        allow read, write: if request.auth != null;
      }
    }
  }
}

你能解释一下这里的语法吗?我已经阅读了文档,并且正在尝试授予对与经过身份验证的用户匹配的节点的访问权限。但是,我不理解这些规则的语法。你能在这里解释一下语法吗?我已经阅读了文档,并且正在尝试授予对与经过身份验证的用户匹配的节点的访问权限。但是,我不理解这些规则的语法。