forked from MisCar/Scouting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
firestore.rules
30 lines (25 loc) · 856 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
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
function isAdmin() {
return request.auth != null && request.auth.uid != null && request.auth.uid in get(/databases/$(database)/documents/admin/admins).data.users;
}
function isTeamUser() {
return request.auth != null && request.auth.uid != null;
}
match /admin/{document} {
allow read: if isTeamUser();
allow write: if isAdmin();
}
match /users/{document} {
allow read: if true;
allow write: if document == request.auth.uid;
}
match /games/{document} {
allow read, write: if true;
}
match /{collection}/{document=**} {
allow read, write: if (collection != "admin" && collection != "users" && collection != "games") && (isTeamUser() || isAdmin());
}
}
}