-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstorage.rules
34 lines (31 loc) · 1.16 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
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
match /files-in-progress/{uid}/{fileId} {
allow create: if request.auth != null
&& request.auth.uid == uid
&& request.resource.metadata != null
&& request.resource.metadata.name is string
&& request.resource.metadata.name.size() > 3
&& request.resource.metadata.name.size() < 80
&& request.resource.metadata.type is string
&& request.resource.metadata.type in ['image', 'video', 'audio', 'other', 'text'];
}
match /users-files/{fileId} {
function isPublic() {
return resource != null && resource.metadata.public == "true";
}
function isOwner() {
return resource != null && request.auth != null && resource.metadata.uid == request.auth.uid;
}
allow get: if isPublic() || isOwner();
}
match /anon-files/{fileId} {
allow create: if resource != null
&& resource.metadata != null
&& int(resource.metadata.expires) > request.time.toMillis()
&& !('expires' in request.resource.metadata)
&& request.resource.metadata.name is string;
}
}
}