我有一个带有members
根和groups
根的firebase数据库,组root看起来像这样:
"groups": {
"test-group" : {
"name" : "Test Group"
"members" : {
"5HWOQlahMAdKWJ6D2bUCFk273te2" : {
"admin" : true
}
},
}
}
并且成员root看起来像这样:
"members": {
"5HWOQlahMAdKWJ6D2bUCFk273te2" : {
"photo" : "photourl",
"username" : "Harry Banda",
"email" : "harrybanda7@gmail.com",
"groups" : {
"test-group" : {
"admin" : true
}
}
}
}
我的规则:
{
"rules": {
"groups": {
".read": "auth != null",
".write": "auth != null"
},
"members": {
"$uid": {
".read": "auth != null && auth.uid == $uid",
".write": "auth != null && auth.uid == $uid"
}
}
}
}
如何编写规则,以便只有"admin" : true
的经过身份验证的成员才能读取和写入他们调节的组的数据?