-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstorage.rules
30 lines (29 loc) · 901 Bytes
/
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
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
match /users/pics/{id} {
allow write: if checkAuthentication() && isOwnDocument(id);
}
match /users/{file=**} {
allow read: if true;
}
match /courses/programming/{pdf} {
allow read : if checkAuthentication() && (request.auth.token.plan == "UNLIMITED" || request.auth.token.plan == "PROGRAMMING");
}
match /courses/jobhunting/{pdf} {
allow read : if checkAuthentication() && (request.auth.token.plan == "UNLIMITED" || request.auth.token.plan == "JOBHUNTING");
}
match /courses/free/{pdf} {
allow read : if checkAuthentication();
}
match /constitution.pdf {
allow read : if true;
}
}
function checkAuthentication() {
return request.auth != null;
}
function isOwnDocument(documentId) {
return request.auth.uid == documentId;
}
}