From 911669e8ed441e5d7840af1202804b2d5696edd0 Mon Sep 17 00:00:00 2001 From: Arnaud Rajon Date: Thu, 19 Dec 2024 18:40:05 +0100 Subject: [PATCH] chore: firestore rule not finished --- firestore.rules | 30 +++--------------------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/firestore.rules b/firestore.rules index 29ad8bc7..2a2a94e3 100644 --- a/firestore.rules +++ b/firestore.rules @@ -74,7 +74,7 @@ service cloud.firestore { allow list: if isVerified(); allow delete: if isOwner(); allow create: if isOwner() && validate(); - allow update: if (isOwner() || onlySavedEventsUpdated() || onlyFollowedAssociationsUpdated()) && validateJoinedAssociations() && validate(); + allow update; //if (onlySavedEventsUpdated() || onlyFollowedAssociationsUpdated()); //&& validateJoinedAssociations(); //&& validate(); } match /associations/{uid} { @@ -180,31 +180,7 @@ service cloud.firestore { let hasCorrectNumberOfFields = request.resource.data.size() == fields.size(); let hasCorrectFields = request.resource.data.keys().hasAll(fields); - return hasCorrectNumberOfFields && hasCorrectFields && - request.resource.data.uid == uid && - request.resource.data.title is string && - request.resource.data.title.size() <= 30 && - request.resource.data.organisers is list && - request.resource.data.taggedAssociations is list && - request.resource.data.image is string && - request.resource.data.description is string && - request.resource.data.description.size() <= 300 && - request.resource.data.catchyDescription is string && - request.resource.data.catchyDescription.size() <= 100 && - request.resource.data.price is number && - request.resource.data.price >= 0 && - request.resource.data.startDate is timestamp && - request.resource.data.endDate is timestamp && - request.resource.data.location is map && - request.resource.data.location.latitude is number && - request.resource.data.location.longitude is number && - request.resource.data.location.name is string && - request.resource.data.types is list && - request.resource.data.maxNumberOfPlaces is number && - request.resource.data.maxNumberOfPlaces >= -1 && - request.resource.data.numberOfSaved is number && - request.resource.data.numberOfSaved >= 0 && - request.resource.data.eventPictures is list; + return hasCorrectFields; } allow read: if isVerified(); @@ -215,7 +191,7 @@ service cloud.firestore { // To update or delete an event, the user must be an // organiser in the existing event document - allow update: if isVerified() && (isEventOrganiser(resource.data.organisers) || onlyUpdatedEventPictures() || onlyUpdatedSavedCount()); //&& validate(); + allow update: if isVerified() && (onlyUpdatedEventPictures() || onlyUpdatedSavedCount()); //&& validate(); allow delete: if isVerified() && isEventOrganiser(request.resource.data.organisers); }