forked from ONEARMY/community-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
firestore.rules
21 lines (19 loc) · 845 Bytes
/
firestore.rules
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
function userIntegrationsRead() {
// User integrations may only be read if the data pertains to the authenticated user.
return request.auth.uid == resource.id
}
function userIntegrationsWrite() {
// User integrations may only be writen to if the updated resource pertains to the authenticated user.
return request.auth.uid == request.resource.id
}
match /{collectionId}/{document=**} {
allow get: if collectionId != 'user_integrations' || userIntegrationsRead()
// Do not allow users to list all user integrations.
allow list: if collectionId != 'user_integrations'
allow write: if collectionId != 'emails' && (collectionId != 'user_integrations' || userIntegrationsWrite())
}
}
}