-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackup-firebase-rules.json
128 lines (126 loc) · 8 KB
/
backup-firebase-rules.json
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
{
"rules": {
"blacklist":{
".read": true,
".write":"auth.token.email.endsWith('@bob.com') ||auth.token.email.endsWith('@gmail.com')"
},
"RNG":{
".read":"auth!=null",
".write":"auth!=null"
},
"prompts":{
".read": "auth != null",
".write":"auth.token.email.endsWith('@bob.com') ||auth.token.email.endsWith('@gmail.com')"
},
"questions_changed":{
".read": "auth != null",
".write":"auth.token.email.endsWith('@bob.com') ||auth.token.email.endsWith('@gmail.com')"
},
"questions":{
".read": "auth != null",
".write":"auth.token.email.endsWith('@bob.com') ||auth.token.email.endsWith('@gmail.com')"
},
"question_ids":{
".read": "auth != null",
".write":"auth.token.email.endsWith('@bob.com') ||auth.token.email.endsWith('@gmail.com')"
},
"responses":{
"old_impl_responses":{
".read":"(auth.token.email.endsWith('@bob.com') ||auth.token.email.endsWith('@gmail.com'))",
"$pushId":{
".read":"(auth != null && root.child('temp_uid_worker_id_map').child(auth.uid).val() == $pushId && !root.child('blacklist').val().contains($pushId))||(auth.token.email.endsWith('@bob.com') ||auth.token.email.endsWith('@gmail.com'))",
".write": "(auth!=null && root.child('temp_uid_worker_id_map').child(auth.uid).val() == $pushId && !root.child('blacklist').val().contains($pushId) && !data.exists() && newData.exists() &&((root.child('task_map').child($pushId).child('Task-1').val()=='OLD_IMPLEMENTATION')||(root.child('responses').child('new_impl_responses').hasChild($pushId))))||(auth.token.email.endsWith('@bob.com') ||auth.token.email.endsWith('@gmail.com'))"
}
},
"new_impl_responses":{
".read":"(auth.token.email.endsWith('@bob.com') ||auth.token.email.endsWith('@gmail.com'))",
"$pushId":{
".read":"(auth != null && root.child('temp_uid_worker_id_map').child(auth.uid).val() == $pushId && !root.child('blacklist').val().contains($pushId))||(auth.token.email.endsWith('@bob.com') ||auth.token.email.endsWith('@gmail.com'))",
".write": "(auth!=null && root.child('temp_uid_worker_id_map').child(auth.uid).val() == $pushId && !root.child('blacklist').val().contains($pushId) && !data.exists() && newData.exists() &&((root.child('task_map').child($pushId).child('Task-1').val()=='NEW_IMPLEMENTATION')||(root.child('responses').child('old_impl_responses').hasChild($pushId))))||(auth.token.email.endsWith('@bob.com') ||auth.token.email.endsWith('@gmail.com'))"
}
},
"question_responses":{
".read":"(auth.token.email.endsWith('@bob.com') ||auth.token.email.endsWith('@gmail.com'))",
"$pushId":{
".read":"(auth != null && root.child('temp_uid_worker_id_map').child(auth.uid).val() == $pushId && !root.child('blacklist').val().contains($pushId))||(auth.token.email.endsWith('@bob.com') ||auth.token.email.endsWith('@gmail.com'))",
".write": "(auth!=null && root.child('temp_uid_worker_id_map').child(auth.uid).val() == $pushId && !root.child('blacklist').val().contains($pushId) && !data.exists() && newData.exists() &&((root.child('responses').child('new_impl_responses').hasChild($pushId))&&(root.child('responses').child('old_impl_responses').hasChild($pushId))))||(auth.token.email.endsWith('@bob.com') ||auth.token.email.endsWith('@gmail.com'))"
}
}
},
"worker_ids":{
".read":"auth.token.email.endsWith('@bob.com') ||auth.token.email.endsWith('@gmail.com')",
".write":"auth != null && newData.exists()"
},
"temp_uid_worker_id_map":{
"$pushId":{
".read":"auth != null && $pushId == auth.uid",
".write":"auth != null"
}
},
"survey_states":{
"survey_state_0":{
"$pushId":{
".read":"(auth!=null)||(auth.token.email.endsWith('@bob.com') ||auth.token.email.endsWith('@gmail.com'))",
".write":"auth != null && !data.exists() && newData.exists() && !root.child('blacklist').val().contains($pushId)"
}
},
"survey_state_1":{
"$pushId":{
".read":"(auth!=null)||(auth.token.email.endsWith('@bob.com') ||auth.token.email.endsWith('@gmail.com'))",
".write":"auth != null && !data.exists() && newData.exists() && (root.child('temp_uid_worker_id_map').child(auth.uid).val() == $pushId && !root.child('blacklist').val().contains($pushId)) && root.child('survey_states').child('survey_state_0').hasChild($pushId)"
}
},
"survey_state_2":{
"$pushId":{
".read":"(auth!=null)||(auth.token.email.endsWith('@bob.com') ||auth.token.email.endsWith('@gmail.com'))",
".write":"auth != null && !data.exists() && newData.exists() && (root.child('temp_uid_worker_id_map').child(auth.uid).val() == $pushId && !root.child('blacklist').val().contains($pushId)) && root.child('survey_states').child('survey_state_0').hasChild($pushId) && root.child('survey_states').child('survey_state_1').hasChild($pushId)"
}
},
"survey_state_3":{
"$pushId":{
".read":"(auth!=null)||(auth.token.email.endsWith('@bob.com') ||auth.token.email.endsWith('@gmail.com'))",
".write":"auth != null && !data.exists() && newData.exists() && (root.child('temp_uid_worker_id_map').child(auth.uid).val() == $pushId && !root.child('blacklist').val().contains($pushId))&& root.child('survey_states').child('survey_state_0').hasChild($pushId)&& root.child('survey_states').child('survey_state_1').hasChild($pushId)&& root.child('survey_states').child('survey_state_2').hasChild($pushId)"
}
},
"survey_state_admin":{
"$pushId":{
".read":"(auth.token.email.endsWith('@bob.com') ||auth.token.email.endsWith('@gmail.com'))",
".write":"auth != null && (auth.token.email.endsWith('@bob.com') ||auth.token.email.endsWith('@gmail.com')) && !data.exists() && newData.exists()"
}
}
},
"amt_codes":{
".read":"(auth.token.email.endsWith('@bob.com') ||auth.token.email.endsWith('@gmail.com'))",
"$pushId":{
".read":"(root.child('temp_uid_worker_id_map').child(auth.uid).val() == $pushId && !root.child('blacklist').val().contains($pushId))||(auth.token.email.endsWith('@bob.com') ||auth.token.email.endsWith('@gmail.com'))",
".write":"(auth != null && !data.exists() && newData.exists()&& root.child('consent_given').hasChild($pushId) && !root.child('blacklist').val().contains($pushId) && root.child('consent_given').child($pushId).val() == true && root.child('responses').child('old_impl_responses').hasChild($pushId) && root.child('responses').child('new_impl_responses').hasChild($pushId) && root.child('responses').child('question_responses').hasChild($pushId))||(auth.token.email.endsWith('@bob.com') ||auth.token.email.endsWith('@gmail.com'))"
}
},
"task_map":{
"$pushId":{
".read":"(auth!=null)||(auth.token.email.endsWith('@bob.com') ||auth.token.email.endsWith('@gmail.com'))",
".write":"(auth != null && !data.exists() && newData.exists() && !root.child('blacklist').val().contains($pushId))||(auth.token.email.endsWith('@bob.com') ||auth.token.email.endsWith('@gmail.com'))"
}
},
"instruction_map":{
"$pushId":{
".read":"(auth!=null)||(auth.token.email.endsWith('@bob.com') ||auth.token.email.endsWith('@gmail.com'))",
".write":"(auth != null && newData.exists() && !root.child('blacklist').val().contains($pushId))||(auth.token.email.endsWith('@bob.com') ||auth.token.email.endsWith('@gmail.com'))"
}
},
"consent_given":{
"$pushId":{
".read":"(auth!=null)||(auth.token.email.endsWith('@bob.com') ||auth.token.email.endsWith('@gmail.com'))",
".write":"(auth != null && !data.exists() && newData.exists() && newData.val() == false && !root.child('blacklist').val().contains($pushId))||(auth != null&& !root.child('blacklist').val().contains($pushId) && data.exists() && newData.exists() && data.val()==false && newData.val() == true)||(auth.token.email.endsWith('@bob.com') ||auth.token.email.endsWith('@gmail.com'))"
}
},
"comments":{
".read":"auth.token.email.endsWith('@bob.com') ||auth.token.email.endsWith('@gmail.com')",
".write":"auth.token.email.endsWith('@bob.com') ||auth.token.email.endsWith('@gmail.com')"
},
"last_commented":{
".read":"auth.token.email.endsWith('@bob.com') ||auth.token.email.endsWith('@gmail.com')",
".write":"auth.token.email.endsWith('@bob.com') ||auth.token.email.endsWith('@gmail.com')"
}
}
}