google-cloud-firestore - Cloud FireStore基于数组元素id的数组安全规则
问题描述
我有一个名为的文档challenge
,其中有一个名为participants
. 每个participant
基本上都是一个user
包含一些额外信息的文档,例如score
等reps
。我正在使用arrayRemove(participant)
和arrayUnion(updatedPartipant)
替换,基本上在他们重做挑战时更新他们的分数。我想编写一个安全规则来检查经过身份验证的用户 uid 是否与更新的 userId 匹配(即阻止一个参与者更改另一个分数)。是否可以编写一条安全规则:
allow update: if request.auth.uid === request.data.id
还是我需要将此数组移动为子集合?
解决方案
推荐阅读
- javascript - 如何在 React Native/Expo 中修复“意外的令牌,预期的“;”?
- php - 排队的作业拒绝在 Laravel 中运行
- javascript - useEffect 中有多个 setState,如何避免重新渲染?
- c# - 如何更改 ShowTextAligned 的 Itextsharp 字体
- amazon-web-services - 设置 CodeDeploy 部署环境变量
- c# - 有关 HEADER (Swagger) 中的版本控制的信息
- ssl - 没有互联网连接时如何将 SSL 安装到 Ant Media Server?
- php - android中的openssl加密和openssl解密?和php函数一样吗?
- python - 如何过滤日期
- c - 这个 C 预处理器宏映射到 C 关键字可以用来做什么?