-
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) · 805 Bytes
/
firestore.rules
File metadata and controls
26 lines (23 loc) · 805 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 {
// User documents
match /users/{userId} {
// Allow users to read/write their own user document
allow read, write: if request.auth != null && request.auth.uid == userId;
// Media subcollection - users can only access their own media
match /media/{mediaId} {
allow read, write: if request.auth != null && request.auth.uid == userId;
}
}
// Legacy path support (if still needed)
match /mediaItems/{document} {
allow read, write: if request.auth != null &&
(resource == null || resource.data.userId == request.auth.uid);
}
// Deny all other access
match /{document=**} {
allow read, write: if false;
}
}
}