-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstorage.rules
More file actions
33 lines (27 loc) · 796 Bytes
/
Copy pathstorage.rules
File metadata and controls
33 lines (27 loc) · 796 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
27
28
29
30
31
32
33
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
function isSignedIn() {
return request.auth != null;
}
function isOwner(userId) {
return isSignedIn() && request.auth.uid == userId;
}
function isImageUpload() {
return request.resource != null
&& request.resource.contentType.matches('image/.*')
&& request.resource.size < 10 * 1024 * 1024;
}
match /users/{userId}/profile-pictures/{fileName} {
allow read: if true;
allow write: if isOwner(userId) && isImageUpload();
}
match /users/{userId}/profile-banners/{fileName} {
allow read: if true;
allow write: if isOwner(userId) && isImageUpload();
}
match /{allPaths=**} {
allow read, write: if false;
}
}
}