Files
onearmy-community-platform/firestore.rules
2024-05-21 21:40:01 +02:00

105 lines
2.7 KiB
Plaintext

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
}
function isPublicReadable() {
return true;
}
function isPublicWritable() {
return true;
}
function noWriteAccess() {
return false;
}
match /aggregations_rev20220126/{document=**} {
allow read: if isPublicReadable();
allow write: if isPublicWritable();
}
match /discussions_rev20231022/{document=**} {
allow read: if isPublicReadable();
allow write: if isPublicWritable();
}
match /emails/{document=**} {
allow read: if isPublicReadable();
allow write: if false;
}
match /question_categories_rev20231130/{document=**} {
allow read: if isPublicReadable();
allow write: if noWriteAccess();
}
match /questions_rev20230926/{document=**} {
allow read: if isPublicReadable();
allow write: if isPublicWritable();
}
match /research_categories_rev20221224/{document=**} {
allow read: if isPublicReadable();
allow write: if noWriteAccess();
}
match /research_rev20201020/{document=**} {
allow read: if isPublicReadable();
allow write: if isPublicWritable();
}
match /templates/{document=**} {
allow read: if false
allow write: if false
}
match /user_integrations/{document=**} {
allow get: if userIntegrationsRead()
// Do not allow users to list all user integrations.
allow list: if false
allow write: if userIntegrationsWrite()
}
match /user_notifications_rev20221209/{document=**} {
allow read: if isPublicReadable();
allow write: if isPublicWritable();
}
match /v3_howtos/{document=**} {
allow read: if isPublicReadable();
allow write: if isPublicWritable();
}
match /v3_mappins/{document=**} {
allow read: if isPublicReadable();
allow write: if isPublicWritable();
}
match /v3_categories/{document=**} {
allow read: if isPublicReadable();
allow write: if noWriteAccess();
}
match /v3_tags/{document=**} {
allow read: if isPublicReadable();
allow write: if noWriteAccess();
}
match /v3_users/{userId} {
allow read: if isPublicReadable();
allow write: if isPublicWritable();
allow delete: if request.auth != null && request.auth.uid == userId;
}
}
}