Skip to content

Commit

Permalink
Update firestore and storage rules
Browse files Browse the repository at this point in the history
  • Loading branch information
Gojodzojo committed Jun 3, 2022
1 parent 0ebea0a commit 0dc30b4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
11 changes: 9 additions & 2 deletions firestore.rules
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@ rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if
request.time < timestamp.date(2022, 6, 2);
allow read, write: if false;
}

match /users/{userId}/{document=**} {
allow write, read: if isOwner(userId);
}

function isOwner(userId) {
return request.auth.uid == userId;
}
}
}
8 changes: 8 additions & 0 deletions storage.rules
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,13 @@ service firebase.storage {
match /{allPaths=**} {
allow read, write: if request.auth!=null;
}

match /users/{userId}/plants/{allPaths=**} {
allow write, read: if isOwner(userId);
}

function isOwner(userId) {
return request.auth.uid == userId;
}
}
}

0 comments on commit 0dc30b4

Please sign in to comment.