-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfirestore.rules
33 lines (33 loc) · 921 Bytes
/
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
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
function isAdmin() {
return exists(/databases/$(database)/documents/adminUsers/$(request.auth.uid))
}
match /states/{document=**} {
allow read;
}
match /{path=**}/leaders/{leader} {
allow read;
}
match /content/{document=**} {
allow read;
allow write: if isAdmin();
}
match /adminUsers/{adminId} {
allow get: if request.auth.uid != null;
}
match /twitterAccounts/{document=**} {
allow read: if isAdmin();
allow write: if isAdmin();
}
match /userProfiles/{userUid} {
allow read: if request.auth.uid == userUid;
allow update: if request.auth.uid == userUid
&& request.resource.data.email == resource.data.email;
}
match /userProfiles/{document=**} {
allow read: if isAdmin();
}
}
}