【问题标题】:Firebase Realtime database security rules, blocking reading entire nodeFirebase 实时数据库安全规则,阻止读取整个节点
【发布时间】:2020-12-16 22:41:51
【问题描述】:

这是我的 firebase 实时数据库的结构。我想在访问整个单词对象时阻止读取访问,但在访问单词中的单个节点时允许它。目的是防止用户一次阅读整个单词。如何使用安全规则来做到这一点?

【问题讨论】:

    标签: firebase-realtime-database firebase-security


    【解决方案1】:

    您可以使用$ wildcard

    {
      "rules": {
        "words": {
          ".read" false,
          "$word: {
            ".read" true
          }
        }
      }
    }
    

    所以在整个words 节点上读取被拒绝,但随后$word 匹配words 的任何子节点并允许在那里读取。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-11-11
      • 2019-12-17
      • 2021-08-16
      • 2022-01-18
      • 2020-08-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多