-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstorage.rules
More file actions
26 lines (21 loc) · 1022 Bytes
/
Copy pathstorage.rules
File metadata and controls
26 lines (21 loc) · 1022 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
// ─── Imágenes de productos ───────────────────────────────────────────────
// Lectura: cualquier usuario autenticado.
// Escritura: solo admin.
match /products/{imageId} {
allow read: if request.auth != null;
allow write: if request.auth != null
&& firestore.get(
/databases/(default)/documents/users/$(request.auth.uid)
).data.role == 'ADMIN';
}
// ─── Avatares de usuario ─────────────────────────────────────────────────
// Cada usuario solo puede subir/leer su propia foto de perfil.
match /users/{userId}/{imageId} {
allow read: if request.auth != null;
allow write: if request.auth.uid == userId;
}
}
}