Skip to content

Instantly share code, notes, and snippets.

@bradtraversy
Last active November 15, 2024 19:21
Show Gist options
  • Save bradtraversy/6d7de7e877d169a6aa4e61140d25767f to your computer and use it in GitHub Desktop.
Save bradtraversy/6d7de7e877d169a6aa4e61140d25767f to your computer and use it in GitHub Desktop.
Firebase rules for house marketplace app
// FIRESTORE RULES
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// Listings
match /listings/{listing} {
allow read;
allow create: if request.auth != null && request.resource.data.imgUrls.size() < 7;
allow delete: if resource.data.userRef == request.auth.uid;
allow update: if resource.data.userRef == request.auth.uid;
}
// Users
match /users/{user} {
allow read;
allow create;
allow update: if request.auth.uid == user
}
}
}
// STORAGE RULES
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read;
allow write: if
request.auth != null &&
request.resource.size < 2 * 1024 * 1024 && //2MB
request.resource.contentType.matches('image/.*')
}
}
}
@nnadicharles
Copy link

Thanks Brad, I appreciate

@Abhishek045
Copy link

whwn i click on the sign up button the data of input field is not submit and the input field also not reset

@Ronranjit
Copy link

Screenshot (6)
so i'm getting toast error and also logs in my account.......how do i fix this ? @bradtraversy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment