-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirestore.rules
More file actions
23 lines (21 loc) · 979 Bytes
/
firestore.rules
File metadata and controls
23 lines (21 loc) · 979 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// Polls: allow reads for authenticated users; only admin can write
match /polls/{pollId} {
allow read: if request.auth != null;
allow create, update, delete: if request.auth != null && request.auth.token.email == 'anishseth0510@gmail.com';
}
// Votes: authenticated users can read/write votes
match /votes/{voteId} {
allow read, create: if request.auth != null;
// prevent arbitrary overwrite/deletes of votes
allow update, delete: if false;
}
// Users: allow users to read/write their own user document; admin may write any
match /users/{userId} {
allow read: if request.auth != null && (request.auth.uid == userId || request.auth.token.email == 'anishseth0510@gmail.com');
allow write: if request.auth != null && (request.auth.uid == userId || request.auth.token.email == 'anishseth0510@gmail.com');
}
}
}