forked from jimmykane/quantified-self
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirestore.rules
More file actions
27 lines (27 loc) · 1.16 KB
/
firestore.rules
File metadata and controls
27 lines (27 loc) · 1.16 KB
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
service cloud.firestore {
match /databases/{database}/documents {
// Make sure the uid of the requesting user matches name of the user
// document. The wildcard expression {userId} makes the userId variable
// available in rules.
match /users/{userID} {
allow read: if resource.data.privacy == 'public';
allow read, update, delete: if request.auth.uid == userID;
allow create: if request.auth.uid != null;
match /events/{eventID} {
allow read: if resource.data.privacy == 'public';
allow read, write, create, update, delete: if request.auth.uid == userID;
function eventData() {
return get(/databases/$(database)/documents/users/$(userID)/events/$(eventID)).data
}
match /activities/{activityID} {
allow read: if eventData().privacy == 'public'
allow read, write, create, update, delete: if request.auth.uid == userID;
match /streams/{streamID} {
allow read: if eventData().privacy == 'public'
allow read, write, create, update, delete: if request.auth.uid == userID;
}
}
}
}
}
}