-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfirestore.rules
41 lines (33 loc) · 1.01 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 {
function signedIn() {
return request.auth != null;
}
function getRoleExample(rsc) {
return rsc.data.acl[request.auth.uid];
}
function hasRoleExample(rsc, array) {
return signedIn() && (getRoleExample(rsc) in array);
}
match /{document=**} {
allow read, write: if false;
}
match /invites/{uid} {
allow read, write: if signedIn;
}
match /users/{uid} {
allow read, write: if request.auth.uid == uid
}
match /lists/{listId} {
allow create: if signedIn();
allow read, write: if request.auth.uid in resource.data.acl;
}
match /lists/{listId}/items/{item} {
allow read, write: if request.auth.uid in get(/databases/$(database)/documents/lists/$(listId)).data.acl;
}
match /lists/{listId}/groups/{group} {
allow read, write: if request.auth.uid in get(/databases/$(database)/documents/lists/$(listId)).data.acl;
}
}
}