Files
wgenerator/firestore.rules
2020-05-13 19:35:21 +02:00

44 lines
1.1 KiB
Plaintext

rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /users/{user} {
function isUser(rsc) {
return rsc.id == request.auth.uid
}
function isAdmin() {
return get(/databases/$(database)/documents/users/$(request.auth.uid)).data.role == 'admin'
}
allow read: if isUser(resource) || isAdmin();
allow write: if isUser(resource) || isAdmin();
}
match /songs/{song} {
allow read: if request.auth.uid != null;
allow write: if request.auth.uid != null;
}
match /songs/{song}/files/{file} {
allow read: if request.auth.uid != null;
allow write: if request.auth.uid != null;
}
match /shows/{show} {
allow read: if request.auth.uid != null;
allow write: if request.auth.uid != null;
}
match /shows/{show}/songs/{song} {
allow read: if request.auth.uid != null;
allow write: if request.auth.uid != null;
}
match /global/{global} {
allow read: if request.auth.uid != null;
allow write: if request.auth.uid != null;
}
}
}