26 lines
1.1 KiB
Plaintext
26 lines
1.1 KiB
Plaintext
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;
|
|
}
|
|
}
|
|
}
|