-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfirestore.rules
106 lines (93 loc) · 2.73 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
function isSignedIn() {
return request.auth != null;
}
function belongsTo(userId) {
return request.auth.uid == userId;
}
/*
match /{document=**} {
allow read: if true;
allow write: if true;
}
*/
match /users/{userId} {
allow get: if isSignedIn();
allow list: if true;
allow create: if isSignedIn();
// allow update: if belongsTo(userId);
allow update: if isSignedIn();
allow delete: if false;
match /following/{userId} {
allow get: if isSignedIn();
allow list: if isSignedIn();
allow create: if isSignedIn();
allow update: if isSignedIn();
allow delete: if isSignedIn();
}
match /follower/{userId} {
allow get: if isSignedIn();
allow list: if isSignedIn();
allow create: if isSignedIn();
allow delete: if isSignedIn();
}
match /likes/{postId} {
allow get: if isSignedIn();
allow list: if isSignedIn();
allow create: if isSignedIn();
allow delete: if isSignedIn();
}
match /saved/{postId} {
allow get: if isSignedIn();
allow list: if isSignedIn();
allow create: if isSignedIn();
allow delete: if isSignedIn();
}
match /tagged/{postId} {
allow list: if isSignedIn();
// allow create: if isSignedIn();
}
}
match /blogs/{blogId} {
allow get: if isSignedIn();
allow list: if isSignedIn();
allow create: if isSignedIn();
allow update: if isSignedIn();
// allow delete: if false;
match /comments/{commentId} {
allow list: if isSignedIn();
allow create: if isSignedIn();
}
}
match /chats/{chatsId} {
allow list: if isSignedIn();
allow create: if isSignedIn();
allow update: if isSignedIn();
match /messages/{messageId} {
allow list: if isSignedIn();
allow create: if isSignedIn();
}
}
match /{path=**}/following/{userId} {
allow list: if isSignedIn();
}
/*
match /cities/{city} {
// A read rule can be divided into get and list rules
// Applies to single document read requests
allow get: if <condition>;
// Applies to queries and collection read requests
allow list: if <condition>;
// A write rule can be divided into create, update, and delete rules
// Applies to writes to nonexistent documents
allow create: if <condition>;
// Applies to writes to existing documents
allow update: if <condition>;
// Applies to delete operations
allow delete: if <condition>;
}
*/
}
}