-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirestore.rules
More file actions
26 lines (23 loc) · 843 Bytes
/
firestore.rules
File metadata and controls
26 lines (23 loc) · 843 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
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// Helper functions
function isAuthenticated() {
return request.auth != null;
}
// User profiles collection
match /users/{userId} {
allow read, write: if request.auth != null && request.auth.uid == userId;
match /subscriptions/{document=**} {
allow read: if request.auth != null && request.auth.uid == userId;
}
}
// PDF contents collection
match /pdf-contents/{docId} {
allow read: if isAuthenticated() && request.auth.uid == resource.data.userId;
allow create: if isAuthenticated();
allow update: if isAuthenticated() && request.auth.uid == resource.data.userId;
allow delete: if isAuthenticated() && request.auth.uid == resource.data.userId;
}
}
}