【发布时间】:2016-10-18 22:52:20
【问题描述】:
我的 firebase 数据库规则如下:
{
"rules": {
"users": {
"$uid": {
".read": "auth != null || root.child('users').child(auth.uid).child('role').val() == 'teacher'",
".write": "auth != null || root.child('users').child(auth.uid).child('role').val() == 'teacher'"
}
}
}
}
我的目标如下:
- 每个用户只能读/写他们自己的数据。
- 只有在其对应的名为“role”的子项中定义了值“teacher”的用户才能读取/写入其他所有用户的数据。
如何实现此规则设置?
【问题讨论】:
标签: security firebase firebase-realtime-database