manifold/firestore.rules

60 lines
1.5 KiB
Plaintext
Raw Permalink Normal View History

2022-01-05 17:42:43 +00:00
rules_version = '2';
2022-01-24 06:45:46 +00:00
// To deploy: `firebase deploy --only firestore:rules`
2022-01-05 17:42:43 +00:00
service cloud.firestore {
match /databases/{database}/documents {
2022-01-24 06:45:46 +00:00
function isAdmin() {
return request.auth.uid == 'igi2zGXsfxYPgB0DJTXVJVmwCOr2' // Austin
|| request.auth.uid == '5LZ4LgYuySdL1huCWe7bti02ghx2' // James
|| request.auth.uid == 'tlmGNz9kjXc2EteizMORes4qvWl2' // Stephen
|| request.auth.uid == 'IPTOzEqrpkWmEzh6hwvAyY9PqFb2' // Manifold
}
2022-01-05 17:42:43 +00:00
match /users/{userId} {
allow read;
2022-01-19 03:50:50 +00:00
}
match /private-users/{userId} {
allow read: if resource.data.id == request.auth.uid || isAdmin();
2022-01-05 17:42:43 +00:00
}
match /contracts/{contractId} {
allow read;
2022-01-26 23:45:05 +00:00
allow update: if request.resource.data.diff(resource.data).affectedKeys()
.hasOnly(['description', 'tags', 'lowercaseTags']);
allow delete: if resource.data.creatorId == request.auth.uid;
2022-01-05 17:42:43 +00:00
}
2022-01-05 22:52:54 +00:00
match /contracts/{contractId}/bets/{betId} {
2022-01-05 17:42:43 +00:00
allow read;
}
2022-01-05 17:47:39 +00:00
match /{somePath=**}/bets/{betId} {
allow read;
}
2022-01-05 22:52:54 +00:00
match /contracts/{contractId}/comments/{commentId} {
2022-01-05 17:42:43 +00:00
allow read;
allow create: if request.auth != null;
}
2022-01-05 22:52:54 +00:00
match /{somePath=**}/comments/{commentId} {
allow read;
}
match /folds/{foldId} {
allow read;
2022-01-26 20:56:15 +00:00
allow update, delete: if request.auth.uid == resource.data.curatorId;
}
2022-01-26 20:03:32 +00:00
match /folds/{foldId}/followers/{userId} {
allow read;
allow write: if request.auth.uid == userId;
}
match /{somePath=**}/followers/{userId} {
allow read;
}
2022-01-05 17:42:43 +00:00
}
}