manifold/firestore.rules

51 lines
1.4 KiB
Plaintext
Raw 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} {
2022-01-24 06:45:46 +00:00
allow read: if resource.data.creatorId == request.auth.uid || isAdmin();
2022-01-05 17:42:43 +00:00
}
match /contracts/{contractId} {
allow read;
2022-01-07 19:47:55 +00:00
allow update: if resource.data.creatorId == request.auth.uid && request.resource.data.diff(resource.data).affectedKeys()
.hasOnly(['description']);
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;
allow update: if request.auth.uid == resource.data.curatorId;
}
2022-01-05 17:42:43 +00:00
}
}