从数据库动态控制Firebase存储安全规则 [英] Dynamic control of firebase storage security rules from database

查看:64
本文介绍了从数据库动态控制Firebase存储安全规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想对数据库中的存储规则进行动态控制.我的意思是它应该检查数据库节点以允许读取或写入. 但是我找不到办法. 例如

I want to have a dynamic control on storage rules from database. I mean it should check database nodes to allow read or write. But I cannot find a way. For example

match /files/{fileKey} {
  allow read: // here will check db to get result of allowRead 
  allow write: // here will check db to get result allowWrite
}

db:

files: {
  fileKey1: {
    allowRead: true,
    allowWrite: false
},
  fileKey2: {
    allowRead: true,
    allowWrite: true
}

推荐答案

无法从Firebase存储安全规则中检查Firebase数据库.

There is no way to check the Firebase Database from Firebase Storage security rules.

您必须将必要的信息嵌入到存储安全规则中,或者

You'll have to either embed the necessary information into your Storage security rules, or embed it in the user's token as a custom claim.

这篇关于从数据库动态控制Firebase存储安全规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆