-
Notifications
You must be signed in to change notification settings - Fork 0
/
database.rules.json
61 lines (61 loc) · 1.9 KB
/
database.rules.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{
"rules": {
"players": {
"$player_id": {
".read": true,
// grants write access to the owner of this user account
// whose uid must exactly match the key ($player_id)
".write": "$player_id === auth.uid"
}
},
"games": {
"$game_id": {
".read": true,
".write": "auth !== null && (data.child('host').val() === auth.uid || !data.exists())",
"items": {
"$item_id": {
".write": "root.child('games').child($game_id).child('players').child(auth.uid).exists()"
}
},
"venues": {
"$venue_id": {
"state": {
".write": "root.child('games').child($game_id).child('players').child(auth.uid).exists()"
}
}
},
"players": {
"$player_id": {
".write": "auth !== null && (root.child('games').child($game_id).child('host').val() == auth.uid || $player_id === auth.uid || (!data.exists() && root.child('games').child($game_id).child('state').val() == 'assembling'))",
".indexOn": ["state", "timestamp"]
}
},
"shots": {
"$shot_id": {
".write": "!data.exists() && root.child('games').child($game_id).child('players').child(auth.uid).exists()",
".indexOn": ["timestamp"]
}
},
"state": {
".write": "auth !== null && (root.child('games').child($game_id).child('host').val() == auth.uid || ((newData.val() == 'apprehended' || newData.val() == 'vanished') && root.child('games').child($game_id).child('players').child(auth.uid).exists()))"
}
}
},
"items": {
".read": true,
".write": false
},
"languages":{
".read": true,
".write": false
},
"venues": {
".read": true,
".write": false
},
"version" : {
".read": true,
".write": false
}
}
}