-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirestore.rules
More file actions
62 lines (50 loc) · 1.64 KB
/
firestore.rules
File metadata and controls
62 lines (50 loc) · 1.64 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
// =============================================================
// firestore.rules — Firestore Security Rules (HARDENED v7b)
// =============================================================
// Password hashes have been removed from all user documents.
// Users collection allows public read (safe now — no sensitive data).
// Firebase Auth handles all password verification server-side.
// =============================================================
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
function isRealUser() {
return request.auth != null
&& request.auth.token.firebase.sign_in_provider != 'anonymous';
}
// Users: public read (passwordHash removed — only name/email/role/dept)
match /users/{docId} {
allow read: if true;
allow write: if isRealUser();
}
match /subjects/{docId} {
allow read, write: if isRealUser();
}
match /questionnaires/{docId} {
allow read, write: if isRealUser();
}
// Settings: public read (college domain needed on login pages)
match /settings/{docId} {
allow read: if true;
allow write: if isRealUser();
}
match /enrollments/{docId} {
allow read, write: if isRealUser();
}
match /responses/{docId} {
allow read, write: if isRealUser();
}
match /attendance/{docId} {
allow read, write: if isRealUser();
}
match /notifications/{docId} {
allow read, write: if isRealUser();
}
match /timetables/{docId} {
allow read, write: if isRealUser();
}
match /{document=**} {
allow read, write: if false;
}
}
}