-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdatabase.rules.json
51 lines (51 loc) · 1.89 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
{
/* Visit https://firebase.google.com/docs/database/security to learn more about security rules. */
"rules": {
"rounds": {
".read": "auth !== null",
"$round": {
".write": "auth !== null && (!newData.child('score').exists() || newData.child('phase').val() === 4) &&(!newData.child('cloudScore').exists())"
}
},
"guesses": {
"$round": {
".read": "auth !== null",
".write": "auth !== null && (newData.child('guess').val() === 0 || !root.child('rounds/' + $round).exists() || root.child('rounds/' + $round + '/phase').val() < 2 ) ",
"guess": {
".validate": "newData.isNumber() && newData.val() >=0 && newData.val() <=100"
}
}
},
"finalGuesses": {
"$round": {
".write": "auth !== null && newData.parent().parent().child('rounds').child($round).child('phase').val() == 4 && auth.uid == newData.child('user').val() ",
"value": {
".validate": "newData.isNumber() && newData.val() >= 0 && newData.val() <= 100"
},
"timestamp": {
".validate": "newData.val() < now + 10 && newData.val() > now -1000"
}
}
},
"roundsPrivate": {
"$round": {
".read": "root.child('rounds/' + $round + '/phase').val() === 4",
".write": "auth.uid === root.child('rounds/' + $round + '/teller').val() && 0 === root.child('rounds/' + $round + '/phase').val() ",
".validate": "auth.uid === newData.child('teller').val()",
"truePosition": {
".validate": "newData.isNumber() && newData.val() >=0 && newData.val() <=100"
}
}
},
"users": {
".read": "auth !== null",
".indexOn": "lastSeen",
"$userId": {
".write": "auth.uid === $userId",
"displayName": {
".validate": "newData.isString() && newData.val().length > 2 && newData.val().length < 20"
}
}
}
}
}