【发布时间】:2017-09-20 21:39:47
【问题描述】:
这是我的数据结构
"Users": {
"userId" : {
"email" : "xxxx@gmail.com",
"points" : 50,
"subscriber" : false
}
}
这是我指定的当前规则
"User":{
"$uid": {
".read": "$uid == auth.uid",
".write": "auth != null"
}
}
使用该规则 ^^ 它允许我写信给"User" 参考,但我想要的是
"User":{
"$uid": {
".read": "$uid == auth.uid",
".write": "$uid == auth.uid"
}
}
但是这条规则 ^^ 不允许我写信给"User" 参考,这意味着我什至不能创建一个不更新它的参考。
我尝试使用
"User":{
".write": "auth != null" // << -- this line overrode the entire children
"$uid": {
".read": "$uid == auth.uid",
".write": "$uid == auth.uid"
}
}
本质上,我正在寻找一种方法让经过身份验证的用户写入"User" 参考,但只有匹配uid 的经过身份验证的用户才能读取和更新uid 节点。
【问题讨论】:
标签: android firebase firebase-realtime-database firebase-security