From c0d6e170601f7e23218ff0f1fb5ba75f41847017 Mon Sep 17 00:00:00 2001 From: Marshall Polaris Date: Wed, 27 Apr 2022 00:34:23 -0700 Subject: [PATCH] Disallow users deleting contracts (#99) --- firestore.rules | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/firestore.rules b/firestore.rules index 09d65aac..82c7f5c3 100644 --- a/firestore.rules +++ b/firestore.rules @@ -13,7 +13,7 @@ service cloud.firestore { match /users/{userId} { allow read; - allow update: if resource.data.id == request.auth.uid + allow update: if resource.data.id == request.auth.uid && request.resource.data.diff(resource.data).affectedKeys() .hasOnly(['bio', 'bannerUrl', 'website', 'twitterHandle', 'discordHandle']); } @@ -39,7 +39,6 @@ service cloud.firestore { allow update: if request.resource.data.diff(resource.data).affectedKeys() .hasOnly(['description', 'closeTime', 'tags', 'lowercaseTags']); allow update: if isAdmin(); - allow delete: if resource.data.creatorId == request.auth.uid; } match /{somePath=**}/bets/{betId} { @@ -65,4 +64,4 @@ service cloud.firestore { allow write: if request.auth.uid == userId; } } -} \ No newline at end of file +}