-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstorage.rules
More file actions
44 lines (38 loc) · 1.17 KB
/
storage.rules
File metadata and controls
44 lines (38 loc) · 1.17 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
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
// Helper function to check if user is authenticated
function isAuthenticated() {
return request.auth != null;
}
// Chat images - authenticated users can read/write
match /chat_images/{chatRoomId}/{fileName} {
allow read: if isAuthenticated();
allow write: if isAuthenticated();
}
// Chat videos - authenticated users can read/write
match /chat_videos/{chatRoomId}/{fileName} {
allow read: if isAuthenticated();
allow write: if isAuthenticated();
}
// User profile images
match /users/{userId}/profile/{fileName} {
allow read: if isAuthenticated();
allow write: if isAuthenticated() && request.auth.uid == userId;
}
// User uploads
match /users/{userId}/{allPaths=**} {
allow read: if isAuthenticated();
allow write: if isAuthenticated() && request.auth.uid == userId;
}
// Public assets
match /public/{allPaths=**} {
allow read: if true;
allow write: if false;
}
// Default deny
match /{document=**} {
allow read, write: if false;
}
}
}