Firebase数据库规则data.child

时间:2017-04-11 20:12:26

标签: firebase firebase-realtime-database firebase-security

我似乎无法阅读工作,因为我需要它。基本上,我希望用户阅读他们是作者,如果他们是管理员(由我设置),则阅读。

写完后,我的数据库看起来像这样:

master
--messages
----<some message id>
      admin: true
      name: "My name"
      text: "Message test"
      uid: <proper firebase auth uid>

我的规则:

{
"rules": {
    ".write": "auth != null",
    ".read": "auth != null && (data.child('uid').val() === auth.uid || data.child('admin').val() === true)",
  }
}

我已经通过模拟器多次和方式运行它,但读取总是失败。我想知道我的data.children vars是否包含我期望它们的内容,但是我无法找到记录它的方法。

有什么见解?

编辑:截图...呃,我没有代表发布图片。这是网址。 https://imgur.com/a/Rt6xW

0 个答案:

没有答案