estoy haciendo una app y hasta ahora la estuve desarrollando con las reglas abiertas de firebase, o sea que cualquiera podia leer y escribir dentro. Estuve buscando para configurarlas y me surgió una duda. Se puede poner unas reglas para un documento y otras para documentos que están en un nivel posterior a este? no sé si entiende, por eso les pongo el código.
service cloud.firestore {
match /databases/{database}/documents {
match /{usuario}/Parejas {
allow write: if request.auth.uid != null;
allow read: if request.auth.uid != null;
allow create: if request.auth.uid != null;
allow delete: if request.auth.uid != null;
}
match/{usuario} {
allow write: if request.auth.uid == request.resource.data.author_uid;
allow read: if request.auth.uid != null;
allow create: if request.auth.uid != null;
allow delete: if request.auth.uid == request.resource.data.author_uid;
}
match/{usuario}/Etiquetas {
allow write: if request.auth.uid == request.resource.data.author_uid;
allow read: if request.auth.uid != null;
allow create: if request.auth.uid != null;
allow delete: if request.auth.uid == request.resource.data.author_uid;
}
match/{usuario}/Parejas/{pareja}/Chat {
allow write: if request.auth.uid != null;
allow read: if request.auth.uid != null;
allow create: if request.auth.uid != null;
allow delete: if request.auth.uid != null;
}
}
}
Como se ve yo puse unas reglas para el nodo {usuario} y también otras para {usuario}/Parejas. Me imagino que se puede porque no me saltó ningun eror en la consola de firebase pero pregunto igual. Gracias de antemano.