-
Notifications
You must be signed in to change notification settings - Fork 0
/
firestore.rules
27 lines (27 loc) · 1.2 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
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /articles/{articleId} {
allow read: if resource.data.isPublic == true || request.auth.uid == resource.data.uid;
allow create: if request.auth.uid == request.resource.data.uid;
allow update: if request.auth.uid == resource.data.uid && request.resource.data.uid == resource.data.uid;
allow delete: if request.auth.uid == resource.data.uid;
match /comments/{commentId} {
allow read: if true;
allow create: if request.auth.uid == request.resource.data.uid;
allow update: if request.auth.uid == resource.data.uid && request.resource.data.uid == resource.data.uid;
allow delete: if request.auth.uid == resource.data.uid;
}
}
match /users/{userId} {
allow read: if true;
allow create: if request.auth.uid == request.resource.data.uid;
allow update: if request.auth.uid == resource.data.uid && request.resource.data.uid == resource.data.uid;
allow delete: if request.auth.uid == resource.data.uid;
match /likedArticles/{articleId} {
allow read: if true;
allow write: if request.auth.uid == userId;
}
}
}
}