-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.rules.json
More file actions
142 lines (123 loc) · 4.44 KB
/
Copy pathdatabase.rules.json
File metadata and controls
142 lines (123 loc) · 4.44 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
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
{
"rules": {
".read": false,
".write": false,
"aggregators": {
".read": "auth != null",
".indexOn": ["rfid_uid", "phone_number", "account_status"],
"$aggregator_id": {
".write": "auth != null && (auth.token.role === 'CEO' || auth.token.role === 'FIELD_OPERATOR' || auth.token.role === 'device')",
"account_status": {
".validate": "newData.val() === 'ACTIVE' || newData.val() === 'SUSPENDED' || newData.val() === 'INACTIVE'"
},
"balance": { ".validate": "newData.isNumber()" }
}
},
"batches": {
".read": "auth != null",
".indexOn": ["aggregator_id", "batch_status", "created_at", "hub_id"],
"$batch_id": {
".write": "auth != null && (auth.token.role === 'device' || auth.token.role === 'CEO')",
".validate": "data.exists() || newData.hasChildren(['batch_id', 'aggregator_id', 'crate_count', 'amount_charged', 'batch_status', 'created_at'])"
}
},
"transactions": {
".read": "auth != null",
".indexOn": ["aggregator_id", "timestamp", "type", "stale_rate"],
"$transaction_id": {
".write": "auth != null && (auth.token.role === 'CEO' || auth.token.role === 'FIELD_OPERATOR' || auth.token.role === 'device') && !data.exists() && newData.exists()"
}
},
"phone_index": {
".read": "auth != null",
"$phone": {
".write": "auth != null && (auth.token.role === 'CEO' || auth.token.role === 'FIELD_OPERATOR') && (!data.exists() || !newData.exists())"
}
},
"rfid_index": {
".read": "auth != null",
"$uid": {
".write": "auth != null && (auth.token.role === 'CEO' || auth.token.role === 'FIELD_OPERATOR') && (!data.exists() || !newData.exists())"
}
},
"counters": {
".read": "auth != null && (auth.token.role === 'CEO' || auth.token.role === 'FIELD_OPERATOR' || auth.token.role === 'RND')",
"$counter": {
".write": "auth != null && (auth.token.role === 'CEO' || auth.token.role === 'FIELD_OPERATOR' || auth.token.role === 'RND')",
".validate": "newData.isNumber() && (!data.exists() || newData.val() === data.val() + 1)"
}
},
"pricing": {
".read": "auth != null",
"current": {
".write": "auth != null && auth.token.role === 'CEO'"
},
"changelog": {
"$entry": {
".write": "auth != null && auth.token.role === 'CEO' && !data.exists()"
}
}
},
"formulas": {
".read": "auth != null",
"$formula_id": {
".write": "auth != null && (auth.token.role === 'CEO' || auth.token.role === 'RND')"
}
},
"scan_requests": {
".read": "auth != null",
".indexOn": ["device_id", "status"],
"$session_id": {
".write": "auth != null && ((auth.token.role === 'CEO' || auth.token.role === 'FIELD_OPERATOR') || (auth.token.role === 'device' && data.child('device_id').val() === auth.uid && newData.exists()))"
}
},
"scan_request_log": {
".read": "auth != null && auth.token.role === 'CEO'",
"$session_id": {
".write": "auth != null && (auth.token.role === 'CEO' || auth.token.role === 'FIELD_OPERATOR') && !data.exists()"
}
},
"devices": {
".read": "auth != null",
"$device_id": {
".write": "auth != null && ((auth.token.role === 'device' && auth.uid === $device_id) || auth.token.role === 'CEO')"
}
},
"sync_errors": {
".read": "auth != null && auth.token.role === 'CEO'",
"$error_id": {
".write": "auth != null && auth.token.role === 'device' && !data.exists()"
}
},
"daily_logs": {
".read": "auth != null",
"$date": {
".write": "auth != null && auth.token.role === 'device'"
}
},
"stats": {
".read": "auth != null",
".write": false
},
"trucks": {
".read": "auth != null",
".write": "auth != null && auth.token.role === 'CEO'"
},
"trials": {
".read": "auth != null",
".write": "auth != null && (auth.token.role === 'CEO' || auth.token.role === 'RND')"
},
"activity": {
".read": "auth != null",
".write": "auth != null && (auth.token.role === 'CEO' || auth.token.role === 'FIELD_OPERATOR')"
},
"dashboard": {
".read": "auth != null",
".write": "auth != null && auth.token.role === 'CEO'"
},
"config": {
".read": "auth != null",
".write": "auth != null && auth.token.role === 'CEO'"
}
}
}