1

这些规则的格式是否正确?当我将它们放在数据库规则中时,我看到可能表示错误/警告的红色虚线,但是当我将鼠标悬停在它上面时,我没有收到任何反馈。

{
  "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

2 回答 2

3

重新格式化您的代码规则并使其可读只需复制您的规则,然后转到JS Cleaner 并单击 claen Js re copy and past into your database rules

于 2019-10-24T16:46:36.967 回答
1

我也看过那些。几乎只要我添加一个空行。

我认为空行只是导致出现错误的错误指示器。

由于没有任何问题(至少据我所知,至少对我而言不是),我不会担心它们。

于 2016-06-29T04:12:48.230 回答