0

我必须在 Firebase“安全和规则”中添加一组规则,但在新版本中找不到。规则如下。我指的是本手册将这些规则添加到 Firebase 中的“安全和规则”中。我需要一些指南来添加这些规则:

{
  "rules": {

    "users": {
      "$uid": {
        // grants write access to the owner of this user account whose uid must exactly match the key ($uid)
        ".write": "auth !== null && auth.uid === $uid",
        // grants read access to any user who is logged in --&& auth.provider === 'password'
        ".read": "auth !== null"
      }
    },

    "usernames": {
      "$userName": {
        // grants write access to the owner of this user account whose uid must exactly match the key ($uid)
        ".write": "root.child('usernames').child($userName).child('uid').val() == auth.uid || root.child('usernames').child($userName).child('uid').val() == null",
        // grants read access to any user who is logged in --&& auth.provider === 'password'
        ".read": "auth !== null"
      }
    },

    "following": {
      "$uid": {
        // grants write access to the owner of this user account whose uid must exactly match the key ($uid)
        ".write": "auth !== null && auth.uid === $uid",
        // grants read access to any user who is logged in --&& auth.provider === 'password'
        ".read": "auth !== null"
      }
    },

    "followedBy": {
      "$fid": {
        "$uid": {
          // grants write access to the owner of this user account whose uid must exactly match the key ($uid)
          ".write": "auth !== null && auth.uid === $uid",
          // grants read access to any user who is logged in --&& auth.provider === 'password'
          ".read": "auth !== null"
        }
      }
    }

  }
}

我目前看到的是: 在此处输入图像描述

4

1 回答 1

1

单击左侧的数据库,您将在顶部有选项,单击规则选项卡,您将看到并能够在那里编辑您的规则。

于 2016-06-29T03:48:12.393 回答