-
Notifications
You must be signed in to change notification settings - Fork 0
/
firestore.rules
41 lines (41 loc) · 1.34 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
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /users/{usersId}/{document=**} {
allow read:
if request.auth != null;
allow write:
if request.auth != null && request.auth.uid == usersId;
}
match /users/{followingCount}{
allow update:
if request.auth != null && request.resource.data.followingCount == resource.data.followingCount - 1 ||
request.resource.data.followingCount == resource.data.followingCount + 1;
}
match /users/{followerCount}{
allow update:
if request.auth != null && request.resource.data.followerCount == resource.data.followerCount - 1 ||
request.resource.data.followerCount == resource.data.followerCount + 1;
}
match /posts/{document=**}{
allow read, write:
if request.auth != null;
}
match /follows/{document=**}{
allow read, write:
if request.auth != null;
}
match /conversations/{document=**}{
allow read:
if request.auth != null;
}
match /conversations/{document=*}{
allow write:
if request.auth != null && request.auth.uid == request.resource.data.user1 || request.resource.data.user2;
}
match /conversations/{document=**}{
allow write:
if request.auth != null && request.auth.uid == request.resource.data.userId;
}
}
}