Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/opengl/4.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
Google cloud firestore 如何允许身份验证部分下具有特定用户UID的用户写入Firestore,并允许rest用户读取特定文档的数据?_Google Cloud Firestore - Fatal编程技术网

Google cloud firestore 如何允许身份验证部分下具有特定用户UID的用户写入Firestore,并允许rest用户读取特定文档的数据?

Google cloud firestore 如何允许身份验证部分下具有特定用户UID的用户写入Firestore,并允许rest用户读取特定文档的数据?,google-cloud-firestore,Google Cloud Firestore,我试图只允许一个用户在身份验证部分下使用特定的UID写入文档,其余用户从中读取 我还没有尝试过任何东西,因为我无法理解它背后的概念 service cloud.firestore { match /databases/{database}/documents { match /{document=**} { allow read, write: if request.auth.uid != null; } } } 我希望输出的是完整的Firestore规则,

我试图只允许一个用户在身份验证部分下使用特定的UID写入文档,其余用户从中读取

我还没有尝试过任何东西,因为我无法理解它背后的概念

service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write: if request.auth.uid != null;
    }
  }
}
我希望输出的是完整的Firestore规则,我可以直接使用,并且对概念的解释将非常感谢

service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read : if request.auth.uid != null;
      allow write,delete : if request.aurh.uid = userId //you'll have to fetch userId from document. You can store userId in a field like 'createdBy'
    }
  }
}