-
Notifications
You must be signed in to change notification settings - Fork 1
/
firestore.rules
36 lines (31 loc) · 1.46 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
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// This rule allows anyone on the internet to view, edit, and delete
// all data in your Firestore database. It is useful for getting
// started, but it is configured to expire after 30 days because it
// leaves your app open to attackers. At that time, all client
// requests to your Firestore database will be denied.
//
// Make sure to write security rules for your app before that time, or else
// your app will lose access to your Firestore database
// match /{document=**} {
// allow read, write: if request.time < timestamp.date(2020, 6, 9);
// }
match /users/{userId}/{document=**} {
allow read, write: if request.auth.uid == userId
}
match /items/{document=**} {
allow read: if resource.data.author == request.auth.uid || resource.data.isShared;
allow update, delete: if resource.data.author == request.auth.uid;
allow create: if request.resource.data.author == request.auth.uid;
}
match /quickieCategories/{category} {
allow read: if resource.data.author == request.auth.uid;
allow create: if request.resource.data.author == request.auth.uid;
}
match /quickieCategories/{category}/quickies/{document=**} {
allow read, create: if request.auth != null && request.auth.uid == get(/databases/$(database)/documents/quickieCategories/$(category)).data.author;
}
}
}