This repository has been archived by the owner on Aug 31, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
database.rules.json
77 lines (77 loc) · 3.08 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
{
"rules": {
".read": "auth.uid == 'secret-service-worker'",
".write": "auth.uid == 'secret-service-worker'",
"users": {
".read": "auth != null && root.child('roles').child('usermanagers').child(auth.uid).val() == true",
".write": "auth != null && newData.parent().child('roles').child('usermanagers').child(auth.uid).val() == true",
"$userid": {
".read": "auth != null",
".write": "auth != null && auth.uid == $userid",
"balance": {
"$seasonid": {
".validate": "newData.isNumber() && (auth.uid == 'secret-service-worker' || data.val() == null && newData.val() == 100 || newData.val() == data.val() || data.val() != null && newData.val() != null && newData.val() >= 0)"
}
},
"wagers": {
"$wagerid": {
".validate": "!(newData.parent().parent().parent().parent().child('episodes').child(newData.parent().parent().parent().parent().child('bets').child($wagerid).child('episode').val()).child('air_at').val() <= now)",
"wager": {
".validate": "!(newData.val() != null) && data.val() == 0 || newData.val() >= 0 && root.child('users').child($userid).child('balance').child(newData.parent().parent().parent().parent().parent().child('bets').child($wagerid).child('season').val()).val() + (data.val() != null ? data.val() : 0) - newData.val() == newData.parent().parent().parent().parent().parent().child('users').child($userid).child('balance').child(newData.parent().parent().parent().parent().parent().child('bets').child($wagerid).child('season').val()).val()"
}
}
}
}
},
"secure": {
"$userid": {
".read": "auth != null && auth.uid == $userid",
".write": "auth != null && auth.uid == $userid"
}
},
"names": {
"$nameid": {
".read": "true",
".write": "auth != null && (data.val() == null || data.val() != null && newData.val() == null && data.val() == auth.uid)"
}
},
"series": {
".read": "true",
".write": "auth != null && newData.parent().child('roles').child('datamanagers').child(auth.uid).val() == true"
},
"seasons": {
".read": "true",
".write": "auth != null && newData.parent().child('roles').child('datamanagers').child(auth.uid).val() == true"
},
"episodes": {
".read": "true",
".write": "auth != null && newData.parent().child('roles').child('datamanagers').child(auth.uid).val() == true"
},
"events": {
".read": "true"
},
"bets": {
".read": "true",
".write": "auth != null && newData.parent().child('roles').child('datamanagers').child(auth.uid).val() == true"
},
"stats": {
".read": "true"
},
"labels": {
"$labelid": {
".read": "true"
}
},
"leaderboard": {
".read": "true",
"$uid": {
"displayName": {
".write": "data.val() != null && newData.val() != null && auth != null"
},
"anon": {
".write": "data.val() != null && newData.val() != null && auth != null"
}
}
}
}
}