-
Notifications
You must be signed in to change notification settings - Fork 0
/
storage.rules
46 lines (34 loc) · 1.43 KB
/
storage.rules
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
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
match /article-images/{userId}/{articleId}/{allPaths=**} {
// Semua pengguna dapat membaca
allow read: if true;
// Only allow uploads of image files that are less than 3MB
allow write: if request.resource.size < 3 * 1024 * 1024
&& request.resource.contentType.matches('image/.*')
&& request.auth != null
&& request.auth.uid == userId;
// Only allow delete if auth.uid samae with userId
allow delete: if request.auth != null
&& request.auth.uid == userId;
}
match /article-images/{userId}/{articleId} {
// Only allow delete if auth.uid samae with userId
allow delete: if request.auth != null
&& request.auth.uid == userId;
}
match /user-profile-images/{userId}/{allPaths=**} {
// Semua pengguna dapat membaca
allow read: if true;
// Only allow uploads of image files that are less than 500KB
allow write: if request.resource.size < 500 * 1024
&& request.resource.contentType.matches('image/.*')
&& request.auth != null
&& request.auth.uid == userId;
// Only allow delete if auth.uid samae with userId
allow delete: if request.auth != null
&& request.auth.uid == userId;
}
}
}