-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfirestore.rules
50 lines (43 loc) · 2.17 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
47
48
49
50
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if false;
}
match /scrambles/{scramble} {
allow create: if request.auth != null && request.auth.uid == request.resource.data.creator;
allow read: if request.auth != null;
}
match /methods/{method}/{document=**} {
allow create: if request.auth != null && request.auth.uid == request.resource.data.creator;
allow write: if request.auth != null && request.auth.uid == request.resource.data.creator;
allow read: if true;
}
match /stages/{stage}/{document=**} {
allow create: if request.auth != null && request.auth.uid == request.resource.data.creator;
allow write: if request.auth != null && request.auth.uid == request.resource.data.creator;
allow read: if true;
}
match /scrambles/{scramble}/solves/{solve} {
allow create: if request.auth != null && request.auth.uid == request.resource.data.creator && request.resource.data.scrambleId == scramble;
allow update: if request.auth != null && request.auth.uid == request.resource.data.creator && request.resource.data.scrambleId == scramble;
}
match /{path=**}/solves/{solve} {
allow read: if true;
allow read: if request.auth != null || request.resource.data.solveId == solve;
}
match /users/{document=**} {
allow create: if request.auth != null && request.auth.uid == request.resource.data.uid;
allow write: if request.auth != null && request.auth.uid == resource.data.uid;
allow read: if request.auth != null && (request.auth.uid == resource.data.uid || request.data.email == resource.data.email);
}
match /{name=**}/requests/{action} {
// Read all collections named 'requests' in entire db where the target is the current user.
allow read: if request.auth.uid == resource.data.target;
}
match /from/{uid}/to/{uid2}/requests/{action} {
// Force data's creator to be uid, and data's target to be uid2.
allow write: if uid == request.auth.uid && request.resource.data.creator == request.auth.uid && request.resource.data.target == uid2;
}
}
}