-
Notifications
You must be signed in to change notification settings - Fork 0
/
rules.json
92 lines (92 loc) · 8.48 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
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
{
"rules":{
".write":"false",
".read":"false",
"games": {
".write":"false",
".read":"false",
"$game_id": {
".write":"((((!newData.exists()||newData.hasChildren())&&(newData.val()==null||newData.child('turn').exists())&&(!newData.child('turn').exists()||newData.child('turn').hasChildren())&&(!newData.child('turn').child('turn_number').exists()||newData.child('turn').child('turn_number').isNumber())&&(!newData.child('turn').child('board_number').exists()||newData.child('turn').child('board_number').isNumber())&&(!newData.child('boards_within_turn').exists()||newData.child('boards_within_turn').isNumber())&&(!newData.child('rules_version').exists()||newData.child('rules_version').isString())&&(!newData.child('players').exists()||newData.child('players').hasChildren())&&newData.exists()&&!data.exists())))",
".read":"((root.child('games').child($game_id).exists()))",
"turn": {
".write":"((((newData.parent().val()==null||newData.parent().child('turn').exists())&&(!newData.exists()||newData.hasChildren())&&(!newData.child('turn_number').exists()||newData.child('turn_number').isNumber())&&(!newData.child('board_number').exists()||newData.child('board_number').isNumber())&&(newData.parent().exists()&&!data.parent().exists()||root.child('games').child($game_id).exists()))))",
".read":"(((root.child('games').child($game_id).exists())))",
"turn_number": {
".write":"((((newData.parent().parent().val()==null||newData.parent().parent().child('turn').exists())&&(!newData.exists()||newData.isNumber())&&(newData.parent().parent().exists()&&!data.parent().parent().exists()||root.child('games').child($game_id).exists()))))",
".read":"(((root.child('games').child($game_id).exists())))"
},
"board_number": {
".write":"((((newData.parent().parent().val()==null||newData.parent().parent().child('turn').exists())&&(!newData.exists()||newData.isNumber())&&(newData.parent().parent().exists()&&!data.parent().parent().exists()||root.child('games').child($game_id).exists()))))",
".read":"(((root.child('games').child($game_id).exists())))"
}
},
"boards_within_turn": {
".write":"((((newData.parent().val()==null||newData.parent().child('turn').exists())&&(!newData.exists()||newData.isNumber())&&newData.parent().exists()&&!data.parent().exists())))",
".read":"((root.child('games').child($game_id).exists()))"
},
"rules_version": {
".write":"((((newData.parent().val()==null||newData.parent().child('turn').exists())&&(!newData.exists()||newData.isString())&&newData.parent().exists()&&!data.parent().exists())))",
".read":"((root.child('games').child($game_id).exists()))"
},
"players": {
".write":"((((newData.parent().val()==null||newData.parent().child('turn').exists())&&(!newData.exists()||newData.hasChildren())&&newData.parent().exists()&&!data.parent().exists())))",
".read":"((root.child('games').child($game_id).exists()))",
"$player_id": {
".write":"((((newData.parent().parent().val()==null||newData.parent().parent().child('turn').exists())&&(!newData.exists()||newData.hasChildren())&&(newData.val()==null||newData.child('name').exists())&&(!newData.child('name').exists()||newData.child('name').isString())&&(!newData.child('home_segment').exists()||newData.child('home_segment').hasChildren())&&newData.parent().parent().exists()&&!data.parent().parent().exists())))",
".validate":"((((newData.parent().parent().val()==null||newData.parent().parent().child('turn').exists())&&(!newData.exists()||newData.hasChildren())&&(newData.val()==null||newData.child('name').exists())&&(!newData.child('name').exists()||newData.child('name').isString())&&(!newData.child('home_segment').exists()||newData.child('home_segment').hasChildren())&&newData.parent().parent().exists()&&!data.parent().parent().exists())))",
".read":"((root.child('games').child($game_id).exists()))",
"name": {
".write":"((((newData.parent().parent().parent().val()==null||newData.parent().parent().parent().child('turn').exists())&&(newData.parent().val()==null||newData.parent().child('name').exists())&&(!newData.exists()||newData.isString())&&newData.parent().parent().parent().exists()&&!data.parent().parent().parent().exists())))",
".read":"((root.child('games').child($game_id).exists()))"
},
"home_segment": {
".write":"((((newData.parent().parent().parent().val()==null||newData.parent().parent().parent().child('turn').exists())&&(newData.parent().val()==null||newData.parent().child('name').exists())&&(!newData.exists()||newData.hasChildren())&&newData.parent().parent().parent().exists()&&!data.parent().parent().parent().exists())))",
".read":"((root.child('games').child($game_id).exists()))"
},
"$other":{".validate":"false"}
}
},
"$other":{".validate":"false"}
}
},
"boards": {
".write":"false",
".read":"false",
"$game_id": {
".write":"false",
".read":"((root.child('games').child($game_id).exists()))",
"turn_history": {
".write":"false",
".read":"((root.child('games').child($game_id).exists()))",
"$turn_number": {
".write":"false",
".read":"((root.child('games').child($game_id).exists()))",
"board_history": {
".write":"false",
".read":"((root.child('games').child($game_id).exists()))",
"$board_number": {
".write":"((((!newData.exists()||newData.hasChildren())&&(newData.val()==null||newData.child('segments').exists())&&(!newData.child('segments').exists()||newData.child('segments').hasChildren())&&(!newData.child('towers').exists()||newData.child('towers').hasChildren())&&(!newData.child('dead_points').exists()||newData.child('dead_points').hasChildren())&&root.child('games').child($game_id).exists()&&(root.child('games').child($game_id).child('turn').child('turn_number').val()+1+''==$turn_number&&$board_number=='0'||root.child('games').child($game_id).child('turn').child('turn_number').val()+''==$turn_number&&root.child('games').child($game_id).child('turn').child('board_number').val()+1+''==$board_number))))",
".read":"(((root.child('games').child($game_id).exists())))",
"segments": {
".write":"((((newData.parent().val()==null||newData.parent().child('segments').exists())&&(!newData.exists()||newData.hasChildren())&&root.child('games').child($game_id).exists()&&(root.child('games').child($game_id).child('turn').child('turn_number').val()+1+''==$turn_number&&$board_number=='0'||root.child('games').child($game_id).child('turn').child('turn_number').val()+''==$turn_number&&root.child('games').child($game_id).child('turn').child('board_number').val()+1+''==$board_number))))",
".read":"(((root.child('games').child($game_id).exists())))"
},
"towers": {
".write":"((((newData.parent().val()==null||newData.parent().child('segments').exists())&&(!newData.exists()||newData.hasChildren())&&root.child('games').child($game_id).exists()&&(root.child('games').child($game_id).child('turn').child('turn_number').val()+1+''==$turn_number&&$board_number=='0'||root.child('games').child($game_id).child('turn').child('turn_number').val()+''==$turn_number&&root.child('games').child($game_id).child('turn').child('board_number').val()+1+''==$board_number))))",
".read":"(((root.child('games').child($game_id).exists())))"
},
"dead_points": {
".write":"((((newData.parent().val()==null||newData.parent().child('segments').exists())&&(!newData.exists()||newData.hasChildren())&&root.child('games').child($game_id).exists()&&(root.child('games').child($game_id).child('turn').child('turn_number').val()+1+''==$turn_number&&$board_number=='0'||root.child('games').child($game_id).child('turn').child('turn_number').val()+''==$turn_number&&root.child('games').child($game_id).child('turn').child('board_number').val()+1+''==$board_number))))",
".read":"(((root.child('games').child($game_id).exists())))"
},
"$other":{".validate":"false"}
}
}
}
},
"$other":{".validate":"false"}
}
},
"$other":{".validate":"false"}
}
}