-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirestore.rules
More file actions
43 lines (35 loc) · 1.17 KB
/
firestore.rules
File metadata and controls
43 lines (35 loc) · 1.17 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
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
function isAdmin(request) {
return exists(/databases/$(database)/documents/accounts/$(request.auth.uid)) &&
get(/databases/$(database)/documents/accounts/$(request.auth.uid)).data.admin;
}
match /{document=**} {
allow read, write: if false;
}
match /themes/{docId} {
allow read: if true;
allow write: if request.auth != null && isAdmin(request);
}
match /projects/{docId} {
allow read: if true;
allow write: if request.auth != null && isAdmin(request);
}
match /posts/{docId} {
allow read: if resource.data.status == "public" || (request.auth != null && isAdmin(request));
allow write: if request.auth != null && isAdmin(request);
}
match /meetings/{docId} {
allow read: if true;
allow write: if request.auth != null && isAdmin(request);
}
match /accounts/{docId} {
allow read: if request.auth != null && request.auth.uid == docId;
}
match /fellas/{docId} {
allow read: if true;
allow write: if request.auth != null && isAdmin(request);
}
}
}