-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirestore.rules
More file actions
56 lines (45 loc) ยท 1.92 KB
/
firestore.rules
File metadata and controls
56 lines (45 loc) ยท 1.92 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
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// ========================================
// ๐ ์ธ์ฆ ๊ด๋ จ ํฌํผ ํจ์๋ค
// ========================================
// ์ฌ์ฉ์๊ฐ ๋ก๊ทธ์ธ๋์ด ์๋์ง ํ์ธ
function isAuthenticated() {
return request.auth != null;
}
// ํ์ฌ ์ฌ์ฉ์๊ฐ ํน์ ์ฌ์ฉ์ ID์ ์์ ์์ธ์ง ํ์ธ
function isOwner(userId) {
return isAuthenticated() && request.auth.uid == userId;
}
// ํ์ฌ ์ฌ์ฉ์๊ฐ ๊ด๋ฆฌ์์ธ์ง ํ์ธ (ํฅํ ํ์ฅ์ฉ)
function isAdmin() {
return isAuthenticated() && request.auth.token.admin == true;
}
// ========================================
// ๐ฐ RSS ํผ๋ ๋ฐ์ดํฐ ๊ท์น
// ========================================
match /rss_items/{document} {
// ์ฝ๊ธฐ: ๋ชจ๋ ์ฌ์ฉ์ ํ์ฉ (๋ก๊ทธ์ธ ์์ด๋ RSS ํผ๋ ๋ณผ ์ ์์)
allow read: if true;
// ์ฐ๊ธฐ: ๋ชจ๋ ์ฌ์ฉ์ ํ์ฉ (์ค์ผ์ค๋ฌ๊ฐ ์๋ฒ ์ฌ์ด๋์์ ์คํ๋๋ฏ๋ก)
// TODO: ๋์ค์ Admin SDK๋ก ๋ณ๊ฒฝ ํ ๋ณด์ ๊ฐํ ํ์
allow write: if true;
}
// ========================================
// ๐ง ๋ด์ค๋ ํฐ ๊ตฌ๋
์ ๋ฐ์ดํฐ ๊ท์น
// ========================================
match /newsletter/{document} {
// โ ๏ธ ์์ ์ค์ : ์๋ฒ ์ฌ์ด๋ API ๋ฌธ์ ํด๊ฒฐ์ ์ํด ๋ชจ๋ ์ ๊ทผ ํ์ฉ
// TODO: ๋์ค์ Admin SDK๋ก ๋ณ๊ฒฝ ํ ๋ณด์ ๊ฐํ ํ์
allow read, write: if true;
}
// ========================================
// ๐ซ ๊ธฐ๋ณธ ๋ณด์ ๊ท์น (๋ชจ๋ ๋ค๋ฅธ ์ปฌ๋ ์
)
// ========================================
match /{document=**} {
// ๊ธฐ๋ณธ์ ์ผ๋ก ๋ชจ๋ ์ ๊ทผ์ ๊ฑฐ๋ถ (๋ณด์ ๊ฐํ)
allow read, write: if false;
}
}
}