Skip to content

Commit f8944f2

Browse files
authored
Merge pull request #113 from jphacks/firestore-rules
Firestoreセキュリティルールを更新し、ユーザーごとのアクセス制御を追加
2 parents 203d499 + 985ee1e commit f8944f2

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

firebase/firestore.rules

+20-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,26 @@ service cloud.firestore {
1212
// Make sure to write security rules for your app before that time, or else
1313
// all client requests to your Firestore database will be denied until you Update
1414
// your rules
15-
match /{document=**} {
16-
allow read, write: if request.time < timestamp.date(2024, 11, 25);
15+
match /users/{userId} {
16+
allow read, write: if request.auth != null
17+
&& userId == request.auth.uid;
18+
19+
match /events/{eventId} {
20+
allow read, write: if request.auth != null
21+
&& userId == request.auth.uid;
22+
}
23+
24+
match /want-todos/{todoId} {
25+
allow read, write: if request.auth != null
26+
&& userId == request.auth.uid;
27+
}
28+
}
29+
30+
match /notifications/{notificationId} {
31+
allow read: if request.auth != null
32+
&& resource.data.userId == request.auth.uid;
33+
allow write: if request.auth != null
34+
&& request.resource.data.userId == request.auth.uid;
1735
}
1836
}
1937
}

0 commit comments

Comments
 (0)