-
Notifications
You must be signed in to change notification settings - Fork 0
/
rules.json
56 lines (56 loc) · 1.94 KB
/
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
{
"rules": {
".read": true,
".write": true,
"boardmetas": {
"$boardid": {
".validate": "newData.hasChildren(['createdAt', 'width', 'height'])",
"createdAt": {
// is a number after 20150101 and before now
".validate": "newData.isNumber() && newData.val() > 1420099200000 && newData.val() <= now"
},
"width": {
".validate": "newData.isNumber()"
},
"height": {
".validate": "newData.isNumber()"
},
"thumbnail": {
// A thumbnail is allowed, but not required
".validate": "newData.isString()"
},
"$others": {
// disallow any other children
".validate": false
}
}
},
"boardsegments": {
"$boardid": {
"$segmentid": {
".validate": "newData.hasChildren(['color', 'points'])",
// TODO: validate that color is within range -2147483648 - 2147483647
"points": {
"$point": {
".validate": "newData.hasChildren(['x', 'y'])",
// validate that x and y are numeric and within the boards width and height
"x": {
".validate": "newData.isNumber() && newData.val() >= 0 && newData.val() < root.child('boardmetas').child($boardid).child('width').val()"
},
"y": {
".validate": "newData.isNumber() && newData.val() >= 0 && newData.val() < root.child('boardmetas').child($boardid).child('height').val()"
},
"$other": {
".validate": false
}
}
}
}
}
},
"$others": {
// disallow any other children
".validate": false
}
}
}