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