Repository navigation
Expand file tree
/
Copy pathfirestore.rules
More file actions
84 lines (66 loc) · 1.76 KB
/
Copy pathfirestore.rules
File metadata and controls
84 lines (66 loc) · 1.76 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if isWebmaster();
}
match /cities/{docId} {
allow read: if true;
allow write: if GCCityMatches(docId);
}
match /info/{document=**} {
allow read: if true;
allow write: if isComms();
}
match /puzzleSets/{docId} {
allow read: if true;
allow write: if isEditor()
}
match /puzzles/{docId} {
allow read: if true;
allow write: if isEditor()
}
match /puzzles/{docId}/playtestFeedback/{userId} {
allow read, write: if isEditor()
}
match /puzzles/{docId}/playtestFeedback {
allow read, write: if isEditor()
}
match /settings/{document=**} {
allow read: if true;
allow write: if isWebmaster()
}
match /users/{docId} {
allow read, write: if uidMatches(docId);
}
match /users/{userId}/playtestFeedback/{puzzleId} {
allow read, write: if uidMatches(userId);
}
match /cityops/{document=**} {
allow read, write: if isCityOps();
}
function auth() {
return request.auth != null;
}
function token() {
return auth() && request.auth.token != null;
}
function isWebmaster() {
return token() && request.auth.token.Webmaster;
}
function isEditor() {
return token() && request.auth.token.Editor;
}
function isComms() {
return token() && request.auth.token.Comms;
}
function isCityOps() {
return token() && request.auth.token.CityOps;
}
function uidMatches(uid) {
return auth() && request.auth.uid == uid;
}
function CGCityMatches(city) {
return token() && request.auth.token.GCCity == city;
}
}
}