我如何将 super 用户授予 firebase 实时数据库中的某些用户以读取其他用户数据,例如(这仅供经过身份验证的用户使用,其他任何人均不得读取或写入)
{
"rules": {
"users": {
"$uid": {
".read": "$uid === auth.uid",
".write": "$uid === auth.uid",
}
}
}
}
最佳答案
这个有效:
{
"rules": {
"users": {
".read": "'SUPER_USERS_ID_HERE' === auth.uid",
".write": "'SUPER_USERS_ID_HERE' === auth.uid",
"$uid": {
".read": "$uid === auth.uid",
".write": "$uid === auth.uid"
}
}
}
}
您可以从 Firebase 控制台的 Auth 部分获取 super 用户的 UID。例如:
".write": "'0d52a06d-3e0b-4106-b7aa-924866fb2bff' === auth.uid"
还要注意 UID 周围的撇号。
关于android - Firebase - 如何授予 super 用户读写权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38050708/