相关疑难解决方法(0)

Firebase数据库 - 反向索引中的安全性考虑因素

在Firebase指南中,建议之一是维护反向索引以跟踪用户操作.这是我所指的片段:

// An index to track Ada's memberships
{
  "users": {
    "alovelace": {
      "name": "Ada Lovelace",
      // Index Ada's groups in her profile
      "groups": {
         // the value here doesn't matter, just that the key exists
         "techpioneers": true,
         "womentechmakers": true
      }
    },
    ...
  },
  "groups": {
    "techpioneers": {
     "name": "Historical Tech Pioneers",
     "members": {
        "alovelace": true,
        "ghopper": true,
        "eclarke": true
      }
    },
    ...
  }
}
Run Code Online (Sandbox Code Playgroud)

每个用户在反向索引中跟踪他/她的组 - 在这种情况下,密钥保持实际值,并且值无关紧要.


更新

我不确定如何在技术上更新索引但我在经过一些研究后得到了它:setValue可以采用所有变量,而不仅仅是键值对.这意味着更新索引非常简单:只需获取引用groups/$group_id/members/$member_id并将其值设置为true.

现在我的问题不同了:

让我们说所有团体都是私人的.意味着用户只能通过邀请加入组 - 当前组成员必须将另一个用户添加到成员列表.因此,如果我是 …

indexing json firebase firebase-security firebase-realtime-database

5
推荐指数
1
解决办法
224
查看次数