小编Vaz*_*azh的帖子

Firebase用户全部读取,写入新内容,但只修改自己的数据

我在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)

authentication rules firebase

7
推荐指数
1
解决办法
1929
查看次数

标签 统计

authentication ×1

firebase ×1

rules ×1