【发布时间】:2021-09-15 09:04:01
【问题描述】:
我正在尝试使用 Firebase Firestore 为一个集合中的所有集合设置 Firebase 安全规则。
我有一个名为game_lookup 的集合,里面有很多命名的文件,一个是比赛,其他的都在那里。而且它们都有很多内层子集合。
喜欢
/game_lookup/arcade/level_-6NVwtc0cp-/1
我想为比赛设置不同的规则,其余的规则相同。
对于我定义的比赛
match /game_lookup/{document} {
allow read: if isAuthenticated();
match /tournament/{document} {
allow read: if isAuthenticated();
}
match /tournament_players_list/{document} {
allow read, write: if isAuthenticated();
match /allusersPostion/{document} {
allow read, write : if false;
}
match /percentile/{document} {
allow read, write : if false;
}
}
match /tournament_template/{document} {
allow read, write : if false;
}
}
现在这个
/game_lookup/arcade/master/,
/game_lookup/arcade/level_-6NVwtc0cp-/1
我无法访问它。
编辑
我如何只允许那些被授权/game_lookup/contest/tournament_players_list/0Bqbujy16qOYa8YAIbQT/joined/{userId}的用户
我试过了
match /joined/{document} {
allow read, create, update: if isAuthenticated() && request.auth.uid == userId;
}
不工作
【问题讨论】:
标签: firebase google-cloud-firestore firebase-security