我在Firebase上有下一个场景:
有两件事,用户和事件.
我希望用户能够创建新事件,查看所有现有事件,但只能修改由他们创建的事件.
这意味着UserOne创建了EventOne,可以看到EventOne和EventTwo,但只能修改EventOne.
我的结构如下:
-events
-eventOne
endTime:
id:
name:
providerId:
startTime:
userId:
-eventTwo
endTime:
id:
name:
providerId:
startTime:
userId:
-users
-userOne
-userTwo
Run Code Online (Sandbox Code Playgroud)
我目前的规则几乎是默认规则:
{
"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 …Run Code Online (Sandbox Code Playgroud)