Skip to content

Commit

Permalink
chore: firestore rule not finished
Browse files Browse the repository at this point in the history
  • Loading branch information
armouldr committed Dec 19, 2024
1 parent df453b2 commit 911669e
Showing 1 changed file with 3 additions and 27 deletions.
30 changes: 3 additions & 27 deletions firestore.rules
Original file line number Diff line number Diff line change
Expand Up @@ -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} {
Expand Down Expand Up @@ -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();
Expand All @@ -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);
}

Expand Down

0 comments on commit 911669e

Please sign in to comment.