【发布时间】:2015-10-22 13:08:13
【问题描述】:
我在 Firebase 上有下一个场景:
有两件事,用户和事件。
我希望用户能够创建新的事件,查看所有现有事件,但只能修改他们创建的事件。
意思是UserOne创建了EventOne,可以看到EventOne和EventTwo,但是只能修改EventOne。
我的结构如下:
-events
-eventOne
endTime:
id:
name:
providerId:
startTime:
userId:
-eventTwo
endTime:
id:
name:
providerId:
startTime:
userId:
-users
-userOne
-userTwo
我目前的规则几乎是默认规则:
{
"rules": {
"users": {
"$uid": {
// grants write access to the owner of this user account whose uid must exactly match the key ($uid)
".write": "auth !== null && auth.uid === $uid",
// grants read access to any user who is logged in with an email and password
".read": "auth != null && auth.uid == $uid"
}
},
"events": {
".read": "auth != null",
".write": "auth != null"
}
}
}
提前致谢。
【问题讨论】:
标签: authentication firebase rules