从Firebase实时数据库安全规则访问Firestore

从Firebase实时数据库安全规则访问Firestore

本文介绍了从Firebase实时数据库安全规则访问Firestore的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在积极使用Firebase Realtime Database和Firestore.在某些情况下,我需要检查Firestore上的文档以允许用户在Firebase Realtime数据库上进行写.

I'm actively using both of Firebase Realtime Database and Firestore. There is a case in which I need to check a document on Firestore to allow user to write on Firebase Realtime Database.

基本上,我需要访问Firestore上 users 集合中的用户文档,以允许用户在Firebase Realtime数据库的 posts 节点下创建帖子.

Basically, I need to access user's document in the users collection on Firestore to allow user to create a post under the posts node on Firebase Realtime Database.

碰巧有这种可能吗?

"rules": {
  "posts": {
    ".write": "get(/databases/$(database)/documents/users/$(auth.uid)).data.isVerified == true",
  }
}

推荐答案

否,不可能在安全规则之间进行乘积运算.

No, it is not possible to cross products between in security rules.

您能做的最好的事情就是在规则需要的两个产品之间镜像数据.

The best you can do is mirror data between the two products where needed for rules.

这篇关于从Firebase实时数据库安全规则访问Firestore的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 10:29