forked from CreateThrive/react-firebase-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirestore.rules
More file actions
29 lines (20 loc) · 693 Bytes
/
firestore.rules
File metadata and controls
29 lines (20 loc) · 693 Bytes
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
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
function isAuthenticated() {
return request.auth != null && request.auth.token.email_verified == true;
}
function isAdmin() {
return request.auth.token.isAdmin == true;
}
match /users/{userId} {
function isIdentified() {
return request.auth.uid == userId;
}
allow read: if isAuthenticated() && (isAdmin() || isIdentified());
allow write: if isAuthenticated() && isAdmin();
allow update: if isAuthenticated() && (isAdmin() || isIdentified());
allow delete: if isAuthenticated() && isAdmin();
}
}
}