Sync firestore rules from firebase console

This commit is contained in:
Ian Philips 2022-06-02 11:14:01 -06:00
parent c40f2904f0
commit 31a0a378ef

View File

@ -19,11 +19,16 @@ service cloud.firestore {
.hasOnly(['bio', 'bannerUrl', 'website', 'twitterHandle', 'discordHandle', 'followedCategories']);
}
match /users/{userId}/follows/{followUserId} {
allow read;
allow write: if request.auth.uid == userId;
}
match /private-users/{userId} {
allow read: if resource.data.id == request.auth.uid || isAdmin();
allow update: if (resource.data.id == request.auth.uid || isAdmin())
&& request.resource.data.diff(resource.data).affectedKeys()
.hasOnly(['apiKey']);
.hasOnly(['apiKey', 'unsubscribedFromResolutionEmails', 'unsubscribedFromCommentEmails', 'unsubscribedFromAnswerEmails', 'notificationPreferences' ]);
}
match /private-users/{userId}/views/{viewId} {
@ -45,7 +50,8 @@ service cloud.firestore {
match /contracts/{contractId} {
allow read;
allow update: if request.resource.data.diff(resource.data).affectedKeys()
.hasOnly(['description', 'closeTime', 'tags', 'lowercaseTags']);
.hasOnly(['description', 'closeTime', 'tags', 'lowercaseTags'])
&& resource.data.creatorId == request.auth.uid;
allow update: if isAdmin();
}
@ -88,5 +94,12 @@ service cloud.firestore {
match /txns/{txnId} {
allow read;
}
match /users/{userId}/notifications/{notificationId} {
allow read;
allow update: if resource.data.userId == request.auth.uid
&& request.resource.data.diff(resource.data).affectedKeys()
.hasOnly(['isSeen', 'viewTime']);
}
}
}