-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdatabase.rules.json
81 lines (81 loc) · 2.76 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
{
"rules": {
"org-infos": {
".read": "auth != null",
".write": "false",
"$org": {
".validate": "$org.matches(/^[a-zA-Z0-9-]{3,21}$/i)"
}
},
"orgs":{
"$org": {
".validate": "$org.matches(/^[a-zA-Z0-9-]{3,21}$/i)",
"players": {
".read": "auth != null && root.child('users').child(auth.uid).child('orgs').hasChild($org)",
".indexOn": "rated",
"$uid": {
"active": {
".write": "$uid === auth.uid"
}
}
},
"open-match-details": {
"$uid": {
".read": "auth.uid === data.child('player1Uid').val() || auth.uid === data.child('player2Uid').val()",
"scores": {
".write": "auth.uid === data.parent().child('player1Uid').val() || auth.uid === data.parent().child('player2Uid').val()",
"$score": {
"$player": {
".validate": "newData.val() === '' || newData.val().matches(/^([0-9]|[1-9][0-9])$/i)"
}
}
},
"approvals": {
"player1": {
".write": "auth.uid === data.parent().parent().child('player1Uid').val()",
".validate": "newData.isString() && newData.val().matches(/^()|(|[0-9]{1,2}){2}|(|[0-9]{1,2}){6}|(|[0-9]{1,2}){10}$/i)"
},
"player2": {
".write": "auth.uid === data.parent().parent().child('player2Uid').val()",
".validate": "newData.isString() && newData.val().matches(/^()|(|[0-9]{1,2}){2}|(|[0-9]{1,2}){6}|(|[0-9]{1,2}){10}$/i)"
}
}
}
},
"matches": {
".read": "auth != null && root.child('users').child(auth.uid).child('orgs').hasChild($org)",
".write": false,
".indexOn": "finalizedDate"
},
"player-matches": {
"$uid": {
".read": "auth != null && root.child('users').child(auth.uid).child('orgs').hasChild($org)",
".write": false
}
},
"player-open-matches": {
"$uid": {
".read": "$uid === auth.uid && root.child('users').child(auth.uid).child('orgs').hasChild($org)",
".write": false
}
},
"admin" : {
".read": "auth != null && root.child('users').child(auth.uid).child('orgs').child($org).val() === true",
".write": "auth != null && root.child('users').child(auth.uid).child('orgs').child($org).val() === true"
}
}
},
"messaging": {
"$uid": {
".read": "$uid === auth.uid",
".write": "$uid === auth.uid"
}
},
"users": {
"$uid": {
".read": "$uid === auth.uid",
".write": "false"
}
}
}
}