-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.rules.json
More file actions
152 lines (152 loc) · 7.31 KB
/
Copy pathdatabase.rules.json
File metadata and controls
152 lines (152 loc) · 7.31 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
{
"rules": {
"blockedUsers": {
".read": "auth != null",
".write": false
},
"limits": {
".read": "auth != null",
".write": false
},
"usage": {
"$uid": {
".read": "auth != null && auth.uid === $uid",
".write": false
}
},
"games": {
"$gameId": {
".read": true,
".write": "(!data.exists() && auth.token.firebase.sign_in_provider === 'google.com' && !root.child('blockedUsers').child(auth.uid).exists()) || (data.exists() && data.child('creatorId').val() === auth.uid && !root.child('blockedUsers').child(auth.uid).exists())",
"creatorId": {
".validate": "newData.isString() && newData.val() === auth.uid"
},
"status": {
".validate": "newData.isString() && (newData.val() === 'lobby' || newData.val() === 'in-progress' || newData.val() === 'finished')"
},
"teams": {
".read": true,
"$teamId": {
".write": "(auth != null && !root.child('blockedUsers').child(auth.uid).exists() && (data.child('uid').val() === auth.uid || (!data.exists() && $teamId === auth.uid && newData.child('uid').val() === auth.uid))) || (data.parent().parent().child('creatorId').val() === auth.uid)",
".validate": "newData.hasChildren(['name', 'uid'])",
"name": {
".validate": "newData.isString() && newData.val().length > 0 && newData.val().length <= 50"
},
"uid": {
".validate": "newData.isString() && newData.val() === auth.uid"
},
"color": {
".validate": "newData.isString()"
},
"emoji": {
".validate": "newData.isString()"
},
"score": {
".validate": "newData.isNumber()"
},
"correctAccusation": {
".validate": "newData.isBoolean()"
},
"accusationCooldownUntil": {
".validate": "newData.isNumber()"
}
}
},
"witnesses": {
".read": true,
"$witnessIndex": {
".write": "auth != null && !root.child('blockedUsers').child(auth.uid).exists()",
"id": {
".validate": "!data.exists() || data.val() === newData.val() || data.parent().parent().parent().child('creatorId').val() === auth.uid"
},
"name": {
".validate": "!data.exists() || data.val() === newData.val() || data.parent().parent().parent().child('creatorId').val() === auth.uid"
},
"personality": {
".validate": "!data.exists() || data.val() === newData.val() || data.parent().parent().parent().child('creatorId').val() === auth.uid"
},
"outfit": {
".validate": "!data.exists() || data.val() === newData.val() || data.parent().parent().parent().child('creatorId').val() === auth.uid"
},
"talkingToTeamId": {
".write": "auth != null && !root.child('blockedUsers').child(auth.uid).exists() && (data.val() === null || data.val() === auth.uid || data.parent().parent().parent().child('creatorId').val() === auth.uid)",
".validate": "newData.val() === null || (newData.isString() && (newData.val() === auth.uid || data.parent().parent().parent().child('creatorId').val() === auth.uid))"
}
}
},
"chats": {
"$witnessId": {
".read": "auth != null",
"$chatId": {
".read": "auth != null",
".write": "auth != null && !root.child('blockedUsers').child(auth.uid).exists() && ((!data.exists() && newData.child('teamId').val() === auth.uid && data.parent().parent().parent().child('status').val() === 'in-progress') || (data.parent().parent().parent().child('creatorId').val() === auth.uid))",
".validate": "newData.hasChildren(['teamId', 'question', 'status', 'timestamp'])",
"teamId": {
".validate": "newData.isString() && newData.val() === auth.uid"
},
"question": {
".validate": "newData.isString() && newData.val().length > 0 && newData.val().length <= 500"
},
"status": {
".validate": "newData.isString() && (newData.val() === 'pending' || newData.val() === 'completed' || newData.val() === 'error')"
},
"timestamp": {
".validate": "newData.isNumber() && newData.val() <= now"
},
"answer": {
".validate": "newData.isString()"
}
}
}
},
"accusations": {
"$accusationId": {
".read": "auth != null",
".write": "auth != null && !root.child('blockedUsers').child(auth.uid).exists() && ((!data.exists() && newData.child('teamId').val() === auth.uid && data.parent().parent().child('status').val() === 'in-progress' && (!data.parent().parent().child('teams').child(auth.uid).child('accusationCooldownUntil').exists() || data.parent().parent().child('teams').child(auth.uid).child('accusationCooldownUntil').val() <= now)) || (data.parent().parent().child('creatorId').val() === auth.uid))",
".validate": "newData.hasChildren(['teamId', 'culprit', 'motive', 'status', 'timestamp'])",
"teamId": {
".validate": "newData.isString() && newData.val() === auth.uid"
},
"culprit": {
".validate": "newData.isString() && newData.val().length > 0 && newData.val().length <= 100"
},
"motive": {
".validate": "newData.isString() && newData.val().length > 0 && newData.val().length <= 500"
},
"status": {
".validate": "newData.isString() && (newData.val() === 'pending' || newData.val() === 'evaluated' || newData.val() === 'error')"
},
"isCorrect": {
".validate": "newData.isBoolean()"
},
"timestamp": {
".validate": "newData.isNumber() && newData.val() <= now"
},
"error": {
".validate": "newData.isString()"
}
}
},
"results": {
".read": "auth != null",
".write": "auth != null && data.parent().child('creatorId').val() === auth.uid"
},
"storyRequest": {
".read": "auth != null && (data.parent().child('creatorId').val() === auth.uid || auth.token.firebase.sign_in_provider === 'google.com')",
".write": "auth != null && !root.child('blockedUsers').child(auth.uid).exists() && (data.parent().child('creatorId').val() === auth.uid || auth.token.firebase.sign_in_provider === 'google.com')"
},
"imageRequest": {
".read": "auth != null && (data.parent().child('creatorId').val() === auth.uid || auth.token.firebase.sign_in_provider === 'google.com')",
".write": "auth != null && !root.child('blockedUsers').child(auth.uid).exists() && (data.parent().child('creatorId').val() === auth.uid || auth.token.firebase.sign_in_provider === 'google.com')"
},
"userActivity": {
"$uid": {
".read": "auth != null && auth.uid === $uid",
".write": false,
".indexOn": [".value"]
}
}
}
}
}
}