forked from firebase/geofire-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
noDeletes.rules.json
43 lines (37 loc) · 1.14 KB
/
noDeletes.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
{
"rules": {
"<your-geofire-node>": {
// Allow anyone to read from this node
".read": true,
// Index each location's geohash for faster querying
".indexOn": ["g"],
// Schema validation
"$key": {
// Allow anyone to add or update keys in the GeoFire index, but not remove them
".write": "newData.exists()",
// Key validation
".validate": "newData.hasChildren(['g', 'l']) && newData.getPriority().length <= 22 && newData.getPriority().length > 0",
// Geohash validation
"g": {
".validate": "newData.val() == newData.parent().getPriority()"
},
// Location coordinates validation
"l": {
"0" : {
".validate": "newData.isNumber() && newData.val() >= -90 && newData.val() <= 90"
},
"1" : {
".validate": "newData.isNumber() && newData.val() >= -180 && newData.val() <= 180"
},
"$other": {
".validate": false
}
},
// Don't allow any other keys to be written
"$other": {
".validate": false
}
}
}
}
}