Skip to content

Commit

Permalink
fix(developer): update rules
Browse files Browse the repository at this point in the history
this allows delete and pause/resume to work
  • Loading branch information
steveoh committed Aug 6, 2024
1 parent ee99810 commit 1222830
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/developer/firestore.rules
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,14 @@ service cloud.firestore {
function isCurrentUser(uid) {
return request.auth.uid == uid;
}
function updatingNotes() {
return request.resource.data.diff(resource.data).affectedKeys().hasOnly(['notes']);
}

match /databases/{database}/documents {
match /clients/{uid} {
allow read: if isAuthenticated() && isCurrentUser(uid);
}
match /keys/{key} {
allow read: if isAuthenticated() && (get(/databases/$(database)/documents/keys/$(key)).data.accountId == request.auth.uid);
allow update: if isAuthenticated() && (get(/databases/$(database)/documents/keys/$(key)).data.accountId == request.auth.uid) && updatingNotes();
allow update: if isAuthenticated() && (get(/databases/$(database)/documents/keys/$(key)).data.accountId == request.auth.uid);
}
}
}

0 comments on commit 1222830

Please sign in to comment.