Repository navigation
Expand file tree
/
Copy pathfirestore.rules
More file actions
60 lines (52 loc) · 2.26 KB
/
Copy pathfirestore.rules
File metadata and controls
60 lines (52 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// スポット情報:誰でも閲覧・登録・編集・削除できる共有データ
match /spots/{spotId} {
allow read: if true;
allow write: if true;
// 各ユーザー(または端末)ごとの★評価。1人1件、変更は自分の分だけ
match /ratings/{voterId} {
allow read: if true;
allow write: if true;
}
// 各ユーザー(または端末)ごとの静かさ・賑やかさ投票
match /noiseVotes/{voterId} {
allow read: if true;
allow write: if true;
}
// 口コミ(複数投稿可)。編集・削除の本人チェックはアプリ側(端末ID/ログインID)で行う。
// 他のコレクションと同じセキュリティレベル(本格的な認可はFirebase Authのuidベースで別途強化可能)
match /reviews/{reviewId} {
allow read: if true;
allow create: if true;
allow update, delete: if true;
}
}
// サイト全体の件数(登録スポット数・しゃべれる数・OSMへの貢献数)。全件を読まずにトップに表示するための集計
match /stats/{statId} {
allow read: if true;
allow write: if true;
}
// お気に入り:本人のアカウントだけが読み書きできる
match /favorites/{userId} {
allow read, write: if request.auth != null && request.auth.uid == userId;
}
// 店舗オーナーからの削除申請:送信のみ可能。閲覧・変更・削除は管理者(Firebaseコンソール)のみ
match /removalRequests/{requestId} {
allow create: if true;
allow read, update, delete: if false;
}
// ユーザーからの通報:送信のみ可能。閲覧・変更・削除は管理者(Firebaseコンソール)のみ
match /reports/{reportId} {
allow create: if true;
allow read, update, delete: if false;
}
// アクセス解析:匿名の訪問記録(個人情報は含まない)。集計サイトから読み取れるよう読み書きを許可
match /pageViews/{viewId} {
allow read: if true;
allow create, update: if true;
allow delete: if false;
}
}
}