-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfirestore.rules
47 lines (40 loc) · 1.31 KB
/
firestore.rules
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
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read: if request.auth != null
}
match /configs/{document=**} {
allow read;
}
match /profiles/{uid} {
allow write: if
request.auth.uid == uid ||
get(/databases/$(database)/documents/profiles/$(request.auth.uid)).data.isAdmin == true
}
match /votes/{year}/{week}/{uid} {
allow write: if request.auth.uid == uid
}
match /years/{year}/weeks/{week}/votes/{document=**} {
allow write: if
/databases/$(database)/documents/profiles/$(request.auth.uid) ==
request.resource.data.voter &&
request.resource.data.year == int(year) &&
request.resource.data.week == int(week)
allow delete: if
/databases/$(database)/documents/profiles/$(request.auth.uid) ==
resource.data.voter &&
resource.data.year == int(year) &&
resource.data.week == int(week)
}
match /attendances/{date}/attendances/{uid} {
allow write: if request.auth.uid == uid
}
match /preferences/{uid} {
allow write: if request.auth.uid == uid
}
match /configs/web {
allow write: if get(/databases/$(database)/documents/profiles/$(request.auth.uid)).data.isAdmin == true
}
}
}