-
Notifications
You must be signed in to change notification settings - Fork 0
/
firestore.rules
32 lines (29 loc) · 1.13 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
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// user writes are simple, only the owner
match /users/{userId} {
allow read, write: if userId == request.auth.uid;
match /boxes/{box} {
allow read, write: if userId == request.auth.uid;
}
}
match /boxes/{box} {
allow read: if resource == null
|| request.auth.uid in resource.data.owners
|| resource.data.visibility != 'private';
allow write: if resource == null
|| request.auth.uid in resource.data.owners;
match /recipes/{recipe} {
allow read: if resource == null
|| request.auth.uid in resource.data.owners
|| request.auth.uid in get(/databases/$(database)/documents/boxes/$(box)).data.owners
|| get(/databases/$(database)/documents/boxes/$(box)).data.visibility != 'private'
|| resource.data.visibility != 'private';
allow write: if resource == null
|| request.auth.uid in get(/databases/$(database)/documents/boxes/$(box)).data.owners
|| request.auth.uid in resource.data.owners;
}
}
}
}