-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirestore.rules
More file actions
43 lines (37 loc) · 1.52 KB
/
firestore.rules
File metadata and controls
43 lines (37 loc) · 1.52 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() {
return request.auth != null && request.auth.uid == "1rnngUpU4eQY8SQMST6eTymcPu73";
}
function isSignedIn() {
return request.auth != null;
}
match /posts/{docId} { allow read: if true; allow write: if isAdmin(); }
match /winners/{docId} { allow read: if true; allow write: if isAdmin(); }
match /battleHistory/{docId} { allow read: if true; allow write: if isAdmin(); }
match /battles/{battleId} {
allow read: if true;
allow create, update, delete: if isAdmin();
match /items/{itemId} {
allow read: if true;
allow create, delete: if isAdmin();
}
}
match /queues/{queueName}/items/{itemId} {
allow create, read: if queueName == 'feedback' || queueName == 'beatBattle';
allow read, write: if (queueName == 'feedbackArchive' || queueName == 'battleArchive') && isAdmin();
allow delete: if isAdmin();
// REMOVED: The complex and failing 'update' rule is no longer needed.
// NEW: Rule for the new voters subcollection
match /voters/{userId} {
// Allow a user to create a vote for themselves (the document ID is their UID)
allow create: if isSignedIn() && request.auth.uid == userId;
// Allow anyone to see who has voted (to get counts)
allow read: if true;
// Nobody can change or delete a vote
allow update, delete: if false;
}
}
}
}