-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfirestore.rules
More file actions
56 lines (44 loc) · 1.28 KB
/
Copy pathfirestore.rules
File metadata and controls
56 lines (44 loc) · 1.28 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 {
match /envs/{appEnv} {
match /users/{userUid} {
allow read: if isUserAuthenticated(userUid) || isAdminAuthenticated();
allow write: if isUserAuthenticated(userUid) || isAdminAuthenticated();
}
// room
match /rooms/{roomUid} {
allow read, write: if true;
match /messages/{uid} {
allow read, write: if true;
}
match /groups/{uid} {
allow read, write: if true;
}
match /participateUsers/{uid} {
allow read, write: if true;
}
match /matchings/{uid} {
allow read: if true;
allow write: if isAdminAuthenticated();
}
}
}
// users collectionGroup
// match /{path=**}/orders/{uid} {
// allow read, write: if isAdminAuthenticated();
// }
// match /{path=**}/messages/{uid} {
// allow read, write: if isAdminAuthenticated();
// }
function isAdminAuthenticated() {
return request.auth.token.admin == true
}
function isAuthenticated() {
return request.auth != null
}
function isUserAuthenticated(userId) {
return request.auth != null && request.auth.uid == userId
}
}
}