-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirestore.rules
More file actions
61 lines (51 loc) · 1.81 KB
/
Copy pathfirestore.rules
File metadata and controls
61 lines (51 loc) · 1.81 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
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
function isAuthenticated() {
return request.auth != null;
}
function userOwns(ownerId) {
return isAuthenticated() && ownerId != null && ownerId == request.auth.uid;
}
// Font families: owner-scoped reads. All writes go through Cloud Functions/admin.
// Serving (css2/s/d) and search use the admin SDK and bypass rules.
match /fontfamilies/{familyId} {
allow read: if userOwns(resource.data.ownerId);
allow write: if false;
}
// Batch tracking docs: admin-only writes; no client reads needed.
match /batchJobs/{jobId} {
allow read: if false;
allow write: if false;
}
// User profile
match /users/{userId} {
allow read: if isAuthenticated() && userId == request.auth.uid;
allow write: if false;
}
// Durable import records: owners can observe the batch tree; clients never write it.
match /users/{userId}/importBatches/{batchId} {
allow read: if isAuthenticated() && userId == request.auth.uid;
allow write: if false;
match /{document=**} {
allow read: if isAuthenticated() && userId == request.auth.uid;
allow write: if false;
}
}
// Per-user ingest records
match /users/{userId}/ingests/{ingestId} {
allow read: if isAuthenticated() && userId == request.auth.uid;
allow write: if false;
}
// Per-user batch ledgers
match /users/{userId}/batches/{batchId} {
allow read: if isAuthenticated() && userId == request.auth.uid;
allow write: if false;
}
// Closed-beta invite list: Admin SDK / Cloud Functions only.
match /betaAllowlist/{email} {
allow read, write: if false;
}
// Deny everything else by default (no catch-all allow).
}
}