Skip to content

Commit

Permalink
Firestoreセキュリティルールを更新し、ユーザーごとのアクセス制御を追加
Browse files Browse the repository at this point in the history
  • Loading branch information
yuto-trd committed Nov 22, 2024
1 parent 203d499 commit 985ee1e
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions firebase/firestore.rules
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,26 @@ service cloud.firestore {
// Make sure to write security rules for your app before that time, or else
// all client requests to your Firestore database will be denied until you Update
// your rules
match /{document=**} {
allow read, write: if request.time < timestamp.date(2024, 11, 25);
match /users/{userId} {
allow read, write: if request.auth != null
&& userId == request.auth.uid;

match /events/{eventId} {
allow read, write: if request.auth != null
&& userId == request.auth.uid;
}

match /want-todos/{todoId} {
allow read, write: if request.auth != null
&& userId == request.auth.uid;
}
}

match /notifications/{notificationId} {
allow read: if request.auth != null
&& resource.data.userId == request.auth.uid;
allow write: if request.auth != null
&& request.resource.data.userId == request.auth.uid;
}
}
}

0 comments on commit 985ee1e

Please sign in to comment.