-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirestore.rules
More file actions
59 lines (48 loc) · 1.89 KB
/
firestore.rules
File metadata and controls
59 lines (48 loc) · 1.89 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
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// 사용자 정보 및 하위 컬렉션
match /users/{userId} {
// 본인만 읽기/쓰기 가능
allow read, write: if request.auth != null && request.auth.uid == userId;
}
// 사용자의 톤 세팅 (하위 컬렉션 별도 규칙)
match /users/{userId}/toneSettings/{toneId} {
allow read, write: if request.auth != null && request.auth.uid == userId;
}
// 사용자의 페달보드 (하위 컬렉션 별도 규칙)
match /users/{userId}/pedalBoards/{boardId} {
allow read, write: if request.auth != null && request.auth.uid == userId;
}
// 공유 프리셋 (커뮤니티)
match /presets/{presetId} {
// 누구나 읽기 가능
allow read: if true;
// 로그인한 사용자만 생성 가능
allow create: if request.auth != null;
// 작성자만 수정/삭제 가능
allow update, delete: if request.auth != null
&& request.auth.uid == resource.data.authorId;
// 댓글 하위 컬렉션
match /comments/{commentId} {
// 누구나 읽기 가능
allow read: if true;
// 로그인한 사용자만 생성 가능
allow create: if request.auth != null;
// 작성자만 수정/삭제 가능
allow update, delete: if request.auth != null
&& request.auth.uid == resource.data.authorId;
}
}
// 좋아요
match /likes/{likeId} {
// 누구나 읽기 가능
allow read: if true;
// 로그인한 사용자만 생성/삭제 가능 (본인 좋아요만)
allow create: if request.auth != null
&& request.auth.uid == request.resource.data.userId;
allow delete: if request.auth != null
&& request.auth.uid == resource.data.userId;
}
}
}