Firebase RealTime数据库-安全规则

时间:2020-06-30 06:51:44

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

在保护我的实时数据库方面,我需要您的帮助。因此,我想在我的pet>名称中添加诸如 .read:“ $ uid == auth.uid” 之类的安全规则,但是我无法从上面获取$ uid的引用。有什么帮助吗?我只想让我的pet> name仅对$ uid == auth.uid的用户可读。

{
  "rules": {
    "users": {
      "$uid": {
        ".read": "$uid == auth.uid",
          ".write": "$uid == auth.uid",
        "name": {
          ".read": "$uid == auth.uid",
            ".write": "$uid == auth.uid"
        }
      }
    },
    "pet": {
        "name":{
          ".read": "auth != null",
          ".write": false
        }
      }
  }
}

0 个答案:

没有答案