firestoreRules! regras de notificacoes
This commit is contained in:
25
firestore.rules
Normal file
25
firestore.rules
Normal file
@@ -0,0 +1,25 @@
|
||||
rules_version = '2';
|
||||
service cloud.firestore {
|
||||
match /databases/{database}/documents {
|
||||
|
||||
// ── Dados privados por utilizador ──────────────────────────────────────
|
||||
match /artifacts/{appId}/users/{userId}/{document=**} {
|
||||
allow read, write: if request.auth != null && request.auth.uid == userId;
|
||||
}
|
||||
|
||||
// ── Looks partilhados (qualquer utilizador autenticado pode ler/criar) ─
|
||||
match /artifacts/{appId}/sharedLooks/{lookId} {
|
||||
allow read: if request.auth != null;
|
||||
allow create: if request.auth != null;
|
||||
}
|
||||
|
||||
// ── Caixa de entrada de notificações cross-user ────────────────────────
|
||||
// Qualquer utilizador autenticado pode criar notificações (para outro user)
|
||||
// Só o destinatário pode ler e atualizar (marcar como lida) as suas
|
||||
match /artifacts/{appId}/inboxNotifications/{notifId} {
|
||||
allow create: if request.auth != null;
|
||||
allow read, update: if request.auth != null
|
||||
&& request.auth.uid == resource.data.recipientUid;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user