Repository navigation
Expand file tree
/
Copy pathdatabase.rules.json
More file actions
208 lines (208 loc) · 9.66 KB
/
Copy pathdatabase.rules.json
File metadata and controls
208 lines (208 loc) · 9.66 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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
{
"rules": {
".read": false,
".write": false,
"rooms": {
"$code": {
".validate": "$code.matches(/^[A-HJKMNP-Z2-9]{6}$/)",
"meta": {
".read": "auth != null",
".write": "auth != null && ((!data.exists() && $code.matches(/^[A-HJKMNP-Z2-9]{6}$/) && newData.child('host').val() == auth.uid) || (data.child('host').val() == auth.uid && (newData.child('host').val() == auth.uid || root.child('rooms').child($code).child('members').child(newData.child('host').val()).exists())))",
".validate": "newData.hasChildren(['host', 'at'])",
"host": {
".validate": "newData.isString()"
},
"at": {
".validate": "newData.isNumber() && (data.exists() ? newData.val() == data.val() : newData.val() <= now)"
},
"locked": {
".validate": "newData.isBoolean()"
},
"title": {
".validate": "newData.isString() && newData.val().length <= 60"
},
"$other": {
".validate": false
}
},
"slots": {
".read": "auth != null && root.child('rooms').child($code).child('members').child(auth.uid).exists()",
"$color": {
".write": "auth != null && (((!data.exists() || (data.exists() && data.val() != auth.uid && (!root.child('rooms').child($code).child('members').child(data.val()).exists() || (root.child('rooms').child($code).child('members').child(data.val()).child('online').val() == false && root.child('rooms').child($code).child('members').child(data.val()).child('seen').val() < now - 600000)))) && newData.val() == auth.uid && newData.parent().parent().child('members').child(auth.uid).child('color').val() == $color && newData.parent().parent().child('meta').exists() && newData.parent().parent().child('meta/locked').val() != true && !root.child('rooms').child($code).child('banned').child(auth.uid).exists()) || (!newData.exists() && (data.val() == auth.uid || root.child('rooms').child($code).child('meta/host').val() == auth.uid)))",
".validate": "($color == 'blue' || $color == 'red' || $color == 'green' || $color == 'violet') && newData.isString()"
}
},
"members": {
".read": "auth != null && root.child('rooms').child($code).child('members').child(auth.uid).exists()",
"$uid": {
".write": "auth != null && (($uid == auth.uid && (!newData.exists() || newData.parent().parent().child('slots').child(newData.child('color').val()).val() == auth.uid)) || (!newData.exists() && root.child('rooms').child($code).child('meta/host').val() == auth.uid) || (!newData.exists() && root.child('rooms').child($code).child('members').child(auth.uid).exists() && root.child('rooms').child($code).child('slots').child(data.child('color').val()).val() != $uid))",
".validate": "newData.hasChildren(['name', 'color', 'at'])",
"name": {
".validate": "newData.isString() && newData.val().length <= 40"
},
"color": {
".validate": "newData.isString()"
},
"at": {
".validate": "newData.isNumber()"
},
"online": {
".validate": "newData.isBoolean()"
},
"voice": {
".validate": "newData.isBoolean()"
},
"muted": {
".validate": "newData.isBoolean()"
},
"board": {
".validate": "newData.isString() && newData.val().length <= 16"
},
"$other": {
".validate": false
},
"seen": {
".validate": "newData.isNumber() && newData.val() <= now"
}
}
},
"banned": {
".read": "auth != null && root.child('rooms').child($code).child('members').child(auth.uid).exists()",
"$uid": {
".write": "auth != null && root.child('rooms').child($code).child('meta/host').val() == auth.uid && $uid != auth.uid",
".validate": "newData.isBoolean()"
}
},
"subs": {
".read": "auth != null && root.child('rooms').child($code).child('members').child(auth.uid).exists()",
"$sub": {
".write": "auth != null && root.child('rooms').child($code).child('members').child(auth.uid).exists() && (!data.exists() ? newData.child('by').val() == auth.uid : (!newData.exists() && (data.child('by').val() == auth.uid || root.child('rooms').child($code).child('meta/host').val() == auth.uid)))",
".validate": "$sub.matches(/^s[a-z0-9]{1,12}$/) && newData.hasChildren(['title', 'by', 'at'])",
"title": {
".validate": "newData.isString() && newData.val().length <= 40"
},
"by": {
".validate": "newData.isString()"
},
"at": {
".validate": "newData.isNumber()"
},
"$other": {
".validate": false
}
}
},
"boards": {
".read": "auth != null && root.child('rooms').child($code).child('members').child(auth.uid).exists()",
"$board": {
".write": "auth != null && $board != 'main' && !newData.exists() && root.child('rooms').child($code).child('members').child(auth.uid).exists() && (root.child('rooms').child($code).child('subs').child($board).child('by').val() == auth.uid || root.child('rooms').child($code).child('meta/host').val() == auth.uid)",
".validate": "$board == 'main' || newData.parent().parent().child('subs').child($board).exists()",
"els": {
"$el": {
".write": "auth != null && root.child('rooms').child($code).child('members').child(auth.uid).exists()",
".validate": "$el.matches(/^[A-Za-z0-9_-]{1,40}$/) && newData.hasChildren(['d', 'by']) && (newData.child('by').val() == auth.uid || newData.child('by').val() == data.child('by').val())",
"d": {
".validate": "newData.isString() && newData.val().length <= 60000"
},
"by": {
".validate": "newData.isString()"
},
"t": {
".validate": "newData.isNumber()"
},
"$other": {
".validate": false
}
}
}
}
},
"cursors": {
".read": "auth != null && root.child('rooms').child($code).child('members').child(auth.uid).exists()",
"$uid": {
".write": "auth != null && $uid == auth.uid && root.child('rooms').child($code).child('members').child(auth.uid).exists()",
".validate": "newData.hasChildren(['x', 'y', 'b'])",
"x": {
".validate": "newData.isNumber()"
},
"y": {
".validate": "newData.isNumber()"
},
"b": {
".validate": "newData.isString() && newData.val().length <= 16"
},
"$other": {
".validate": false
}
}
},
"signal": {
"$to": {
".read": "auth != null && $to == auth.uid",
".write": "auth != null && $to == auth.uid && !newData.exists()",
"$id": {
".write": "auth != null && (($to == auth.uid && !newData.exists()) || (!data.exists() && newData.child('f').val() == auth.uid && root.child('rooms').child($code).child('members').child(auth.uid).exists() && root.child('rooms').child($code).child('members').child($to).exists()))",
".validate": "newData.hasChildren(['f', 'k', 's'])",
"f": {
".validate": "newData.isString()"
},
"k": {
".validate": "newData.isString() && newData.val().length <= 12"
},
"s": {
".validate": "newData.isString() && newData.val().length <= 20000"
},
"$other": {
".validate": false
}
}
}
},
"live": {
".read": "auth != null && root.child('rooms').child($code).child('members').child(auth.uid).exists()",
"$uid": {
".write": "auth != null && (($uid == auth.uid && (root.child('rooms').child($code).child('members').child(auth.uid).exists() || !newData.exists())) || (!newData.exists() && root.child('rooms').child($code).child('meta/host').val() == auth.uid))",
"b": {
".validate": "newData.isString() && newData.val().length <= 16"
},
"x": {
".validate": "newData.isNumber()"
},
"y": {
".validate": "newData.isNumber()"
},
"t": {
".validate": "newData.isNumber()"
},
"sid": {
".validate": "newData.isString() && newData.val().length <= 40"
},
"k": {
".validate": "newData.val() == 'pen' || newData.val() == 'highlight'"
},
"c": {
".validate": "newData.isString() && newData.val().length <= 12"
},
"w": {
".validate": "newData.isNumber()"
},
"m": {
".validate": "newData.isBoolean()"
},
"e": {
".validate": "newData.isBoolean()"
},
"p": {
"$n": {
".validate": "$n.matches(/^[0-9]{1,4}$/) && newData.isString() && newData.val().length <= 20000"
}
},
"$other": {
".validate": false
}
}
}
}
}
}
}