-
Notifications
You must be signed in to change notification settings - Fork 1
/
Firebase Database Rules.txt
45 lines (45 loc) · 1.91 KB
/
Firebase Database Rules.txt
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
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read: if false;
allow write: if false;
}
match /circles/{circle} {
allow read: if true;
allow write: if false;
}
match /circle_data/{circle_data} {
allow read: if request.auth.uid == resource.data.circle_id || request.auth.uid == resource.id || request.auth.uid in resource.data.admin_by || request.auth.uid in resource.data.owned_by;
allow write: if false;
}
match /connections/{connection} {
allow read: if true;
allow write: if false;
}
match /chat/{chat} {
allow read: if true;
allow write: if false;
}
match /chat_messages/{chat_message} {
allow read: if resource.data.circle_id == request.auth.uid || get(/databases/$(database)/documents/circles/$(resource.data.circle_id)).data.is_public || (request.auth.uid in get(/databases/$(database)/documents/circle_data/$(resource.data.circle_id)).data.connected_mutually_to) || (request.auth.uid in get(/databases/$(database)/documents/circles/$(resource.data.circle_id)).data.circle_ids);
allow write: if false;
}
match /notifications/{notification} {
allow read: if request.auth.uid == resource.data.user_id;
allow write: if false;
}
match /chat_notifications/{chat_notification} {
allow read: if request.auth.uid == resource.data.user_id;
allow write: if false;
}
match /config/{config} {
allow read: if true;
allow write: if false;
}
match /comments/{comment} {
allow read: if resource.data.creator.id == request.auth.uid || get(/databases/$(database)/documents/circles/$(resource.data.parent_circle_id)).data.is_public || (request.auth.uid in get(/databases/$(database)/documents/circle_data/$(resource.data.parent_circle_id)).data.connected_mutually_to);
allow write: if false;
}
}
}