-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirestore.rules
More file actions
49 lines (42 loc) · 2.16 KB
/
Copy pathfirestore.rules
File metadata and controls
49 lines (42 loc) · 2.16 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
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// ── Users ──────────────────────────────────────────────────────────────
// Each authenticated user can read and write only their own document.
match /users/{userId} {
allow read, write: if request.auth != null && request.auth.uid == userId;
// Conversations — owned by the user
match /conversations/{convId} {
allow read, write: if request.auth != null && request.auth.uid == userId;
}
// Saved verses — owned by the user
match /savedVerses/{verseId} {
allow read, write: if request.auth != null && request.auth.uid == userId;
}
// Reading plans — owned by the user
match /readingPlans/{planId} {
allow read, write: if request.auth != null && request.auth.uid == userId;
}
}
// ── Reports ────────────────────────────────────────────────────────────
// Any authenticated user can create a report; nobody can read or modify them
// (admin access via Firebase Console / Cloud Functions only).
match /reports/{reportId} {
allow create: if request.auth != null
&& request.resource.data.description is string
&& request.resource.data.description.size() <= 4000
&& request.resource.data.category is string;
allow read, update, delete: if false;
}
// ── Mail ───────────────────────────────────────────────────────────────
// Written only by Cloud Functions (Trigger Email extension).
// No client access.
match /mail/{mailId} {
allow read, write: if false;
}
// ── Catch-all — deny everything not explicitly allowed ─────────────────
match /{document=**} {
allow read, write: if false;
}
}
}