-
Notifications
You must be signed in to change notification settings - Fork 0
/
firestore.rules
46 lines (40 loc) · 1.78 KB
/
firestore.rules
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
service cloud.firestore {
match /databases/{database}/documents {
match /users/{userId} {
// Allow reading user doc and all sub-docs as signed-in user
allow read: if request.auth.uid == userId;
match /{allChildren=**} {
allow read: if request.auth.uid == userId;
}
allow write: if request.auth.uid == userId
&& request.resource.data.keys().hasAll(["wca"])
&& request.resource.data.size() == 1
&& request.resource.data.name is map;
match /puzzles/{puzzleId} {
allow write: if request.auth.uid == userId
&& request.resource.data.keys().hasAll(["name", "scrambler"])
&& request.resource.data.size() == 2
&& request.resource.data.name is string
&& request.resource.data.scrambler is string;
match /categories/{categoryId} {
allow write: if request.auth.uid == userId
&& request.resource.data.keys().hasAll(["name"])
&& request.resource.data.size() == 1
&& request.resource.data.name is string;
match /solves/{solveId} {
allow write: if request.auth.uid == userId
&& request.resource.data.keys().hasAll(["time", "timestamp", "penalty", "scramble"])
&& request.resource.data.size() == 4
&& request.resource.data.time is number
&& request.resource.data.timestamp is number
&& request.resource.data.penalty is number
&& request.resource.data.scramble is string;
}
}
}
}
match /{document=**} {
allow read, write: if false;
}
}
}