-
Notifications
You must be signed in to change notification settings - Fork 0
/
database.rules.json
109 lines (109 loc) · 4.84 KB
/
database.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
{
"rules": {
"volunteers": {
"$uid": {
".validate": "newData.hasChildren(['firstName', 'lastName', 'name', 'email', 'address', 'phone', 'hasCar', 'termsAgreement', 'timestamp'])",
"firstName": {
".validate": "((newData.isString() && newData.val().length > 0) && newData.val().length <= 64)"
},
"lastName": {
".validate": "((newData.isString() && newData.val().length > 0) && newData.val().length <= 64)"
},
"name": {
".validate": "((newData.isString() && newData.val().length > 0) && newData.val().length <= 128)"
},
"email": {
".validate": "(((newData.isString() && newData.val().length > 0) && newData.val().length <= 256) && newData.val().contains('@'))"
},
"address": {
".validate": "((newData.isString() && newData.val().length > 0) && newData.val().length <= 256)"
},
"phone": {
".validate": "((newData.isString() && newData.val().length > 0) && newData.val().length <= 15)"
},
"hasCar": {
".validate": "(newData.isBoolean() && newData.val() != null)"
},
"termsAgreement": {
".validate": "(newData.isBoolean() && newData.val() == true)"
},
"language": {
"$key1": {
".validate": "(newData.isString() && (newData.val() == 'Spanish' || newData.val() == 'English' || newData.val() == 'Mandarin' || newData.val() == 'Cantonese' || newData.val() == 'Other' ))"
}
},
"lat": {
".validate": "((newData.isNumber() && newData.val() >= -90) && newData.val() <= 90)"
},
"lng": {
".validate": "((newData.isNumber() && newData.val() >= -180) && newData.val() <= 180)"
},
"timestamp": {
".validate": "(newData.isNumber() && newData.val() == (data.val() == null ? now : data.val()))"
},
"$other": {
".validate": "false"
},
".read": "auth.token.admin == true",
".write": "true"
}
},
"requesters": {
"$uid": {
".validate": "newData.hasChildren(['firstName', 'lastName', 'name', 'email', 'address', 'phone', 'termsAgreement', 'list', 'timestamp', 'fulfillment_status', 'fulfillment_status_timestamp'])",
"firstName": {
".validate": "((newData.isString() && newData.val().length > 0) && newData.val().length <= 64)"
},
"lastName": {
".validate": "((newData.isString() && newData.val().length > 0) && newData.val().length <= 64)"
},
"name": {
".validate": "((newData.isString() && newData.val().length > 0) && newData.val().length <= 128)"
},
"email": {
".validate": "(newData.isString() && (newData.val() == '' || ((newData.val().length > 0 && newData.val().length <= 256) && newData.val().contains('@'))))"
},
"address": {
".validate": "((newData.isString() && newData.val().length > 0) && newData.val().length <= 256)"
},
"phone": {
".validate": "((newData.isString() && newData.val().length > 0) && newData.val().length <= 15)"
},
"termsAgreement": {
".validate": "(newData.isBoolean() && newData.val() == true)"
},
"list": {
".validate": "((newData.isString() && newData.val().length > 0) && newData.val().length <= 1024)"
},
"lat": {
".validate": "((newData.isNumber() && newData.val() >= -90) && newData.val() <= 90)"
},
"lng": {
".validate": "((newData.isNumber() && newData.val() >= -180) && newData.val() <= 180)"
},
"language": {
"$key1": {
".validate": "(newData.isString() && (newData.val() == 'Spanish' || newData.val() == 'English' || newData.val() == 'Mandarin' || newData.val() == 'Cantonese' || newData.val() == 'Other' ))"
}
},
"timestamp": {
".validate": "(newData.isNumber() && newData.val() == (data.val() == null ? now : data.val()))"
},
"fulfillment_status": {
".validate": "(newData.isString() && ((((newData.val() == 'new' || newData.val() == 'sourcing_volunteer') || newData.val() == 'pending_fulfillment') || newData.val() == 'fulfilling') || newData.val() == 'resolved'))"
},
"fulfillment_status_timestamp": {
".validate": "(newData.isNumber() && newData.val() == now)"
},
"resolution": {
".validate": "(newData.isString() && (((((newData.val() == 'delivered' || newData.val() == 'no_volunteer_found') || newData.val() == 'requester_not_communicating') || newData.val() == 'rejected') || newData.val() == 'cancelled') || newData.val() == 'duplicate'))"
},
"$other": {
".validate": "false"
},
".read": "auth.token.admin == true",
".write": "true"
}
}
}
}