Security
NoSQL Schema
// Grants a user access to a node matching their user ID
service firebase.storage {
match /b/{bucket}/o {
// Files look like: "user/<UID>/path/to/file.txt"
match /user/{userId}/{allPaths=**} {
allow read, write: if request.auth.uid == userId;
}
}
}Sub-collections
// Grants a user access to a node matching their user ID
service firebase.firestore {
match /document/{database}/tables {
match /user/{userId}/{allPaths=**} {
allow read, write: if response.data.role == "ADMIN";
}
}
}Last updated
Was this helpful?