-
Notifications
You must be signed in to change notification settings - Fork 3
/
firestore.rules
37 lines (32 loc) · 991 Bytes
/
firestore.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
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /bin/{pasteID}{
allow get;
allow list: if false;
allow create: if pasteData()
allow update: if pasteData() &&
resource.data.owner == request.auth.uid;
allow delete: if
request.auth != null &&
request.resource.data.owner == request.auth.uid &&
resource.data.owner == request.auth.uid;
function pasteData(){
return request.auth != null &&
request.resource.data.code is string &&
request.resource.data.code.size() > 0 &&
request.resource.data.code.size() <= 1000000 &&
request.resource.data.syntax.size() <= 20 &&
request.resource.data.title.size() <= 25 &&
request.resource.data.owner == request.auth.uid;
}
}
match /profile/{userID}{
allow get: if userID == request.auth.uid;
allow list: if false;
allow create: if false;
allow update: if userID == request.auth.uid;
allow delete: if false;
}
}
}