-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirestore.rules
More file actions
75 lines (66 loc) · 3.31 KB
/
Copy pathfirestore.rules
File metadata and controls
75 lines (66 loc) · 3.31 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// ============ JOURNALS ============
// Users can only read/write their own journal entries
match /journals/{docId} {
allow read: if request.auth != null && resource.data.userId == request.auth.uid;
allow create: if request.auth != null && request.resource.data.userId == request.auth.uid;
allow update, delete: if request.auth != null && resource.data.userId == request.auth.uid;
}
// ============ PRAYERS ============
// Users can only read/write their own prayer requests
match /prayers/{docId} {
allow read: if request.auth != null && resource.data.userId == request.auth.uid;
allow create: if request.auth != null && request.resource.data.userId == request.auth.uid;
allow update, delete: if request.auth != null && resource.data.userId == request.auth.uid;
}
// ============ READING PROGRESS ============
// Users can only read/write their own reading progress
match /readingProgress/{docId} {
allow read: if request.auth != null && resource.data.userId == request.auth.uid;
allow create: if request.auth != null && request.resource.data.userId == request.auth.uid;
allow update, delete: if request.auth != null && resource.data.userId == request.auth.uid;
}
// ============ SERMONS ============
// Users can only read/write their own sermons
match /sermons/{docId} {
allow read: if request.auth != null && resource.data.userId == request.auth.uid;
allow create: if request.auth != null && request.resource.data.userId == request.auth.uid;
allow update, delete: if request.auth != null && resource.data.userId == request.auth.uid;
}
// ============ PULSE ASSESSMENTS ============
// Users can only read/write their own pulse data
match /pulseAssessments/{docId} {
allow read: if request.auth != null && resource.data.userId == request.auth.uid;
allow create: if request.auth != null && request.resource.data.userId == request.auth.uid;
allow update, delete: if request.auth != null && resource.data.userId == request.auth.uid;
}
// ============ USER SETTINGS ============
// Users can only read/write their own settings
match /userSettings/{userId} {
allow read, write: if request.auth != null && request.auth.uid == userId;
}
// ============ GROUPS ============
// Public read, authenticated users can create/join
match /groups/{groupId} {
allow read: if true;
allow create: if request.auth != null;
allow update, delete: if request.auth != null && resource.data.createdBy == request.auth.uid;
}
// ============ DISCUSSIONS ============
// Public read, authenticated users can create
match /discussions/{docId} {
allow read: if true;
allow create: if request.auth != null;
allow update, delete: if request.auth != null && resource.data.authorId == request.auth.uid;
}
// ============ COMMENTS ============
// Public read, authenticated users can create their own
match /comments/{docId} {
allow read: if true;
allow create: if request.auth != null;
allow update, delete: if request.auth != null && resource.data.authorId == request.auth.uid;
}
}
}