-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrules.json
More file actions
95 lines (95 loc) · 4.37 KB
/
rules.json
File metadata and controls
95 lines (95 loc) · 4.37 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
{
"rules": {
"users": {
"$userId": {
".validate": "newData.hasChildren(['name', 'image'])",
"name": {
".validate": "newData.isString()"
},
"image": {
".validate": "newData.isString()"
},
"selectedFeed": {
".validate": "newData.isString() || newData.val() == null"
},
"feeds": {
"$key1": {
".validate": "newData.isBoolean()"
}
},
"$other": {
".validate": "false"
},
".read": "auth != null",
".write": "auth != null && auth.uid == $userId"
}
},
"feeds": {
"$feedId": {
".validate": "newData.hasChildren(['name', 'timestamp', 'password'])",
"name": {
".validate": "newData.isString()"
},
"timestamp": {
".validate": "newData.isNumber()"
},
"password": {
".validate": "data.val() == null || newData.val() == data.val()"
},
"$other": {
".validate": "false"
},
".read": "auth != null && root.child('feeds').child($feedId).child('users').child(auth.uid).val() == root.child('feeds').child($feedId).child('password').val()",
".write": "data.val() == null || auth != null && newData.parent().parent().child('feeds').child($feedId).child('users').child(auth.uid).val() == newData.parent().parent().child('feeds').child($feedId).child('password').val()",
"users": {
"$userId": {
".validate": "newData.isString() && newData.val() == newData.parent().parent().parent().parent().child('feeds').child($feedId).child('password').val()",
".write": "auth != null && auth.uid == $userId"
}
}
}
},
"posts": {
"$feedId": {
".read": "auth != null && root.child('feeds').child($feedId).child('users').child(auth.uid).val() == root.child('feeds').child($feedId).child('password').val() || $feedId == 'start'",
".write": "auth != null && newData.parent().parent().child('feeds').child($feedId).child('users').child(auth.uid).val() == newData.parent().parent().child('feeds').child($feedId).child('password').val()",
"$postId": {
".validate": "newData.hasChildren() && newData.hasChildren(['type', 'user', 'timestamp', 'ancestor']) && newData.hasChildren(['url', 'query']) && newData.child('type').val() == 'search' && true || newData.hasChildren() && newData.hasChildren(['type', 'user', 'timestamp', 'ancestor']) && newData.hasChildren(['url', 'title', 'favIconUrl']) && newData.child('type').val() == 'page' && (true || true) || newData.hasChildren() && newData.hasChildren(['type', 'user', 'timestamp', 'ancestor']) && newData.hasChildren(['text']) && newData.child('type').val() == 'text' && true || newData.hasChildren() && newData.hasChildren(['type', 'user', 'timestamp', 'ancestor']) && newData.hasChildren(['image']) && newData.child('type').val() == 'image' && true || newData.hasChildren() && newData.hasChildren(['type', 'user', 'timestamp', 'ancestor']) && newData.hasChildren(['text']) && newData.child('type').val() == 'comment'",
"type": {
".validate": "newData.isString() || newData.isString() || newData.isString() || newData.isString() || newData.isString()"
},
"user": {
".validate": "newData.isString() || newData.isString() || newData.isString() || newData.isString() || newData.isString()"
},
"timestamp": {
".validate": "newData.isNumber() || newData.isNumber() || newData.isNumber() || newData.isNumber() || newData.isNumber()"
},
"ancestor": {
".validate": "newData.isString() || newData.isString() || newData.isString() || newData.isString() || newData.isString()"
},
"$other": {
".validate": "false"
},
"url": {
".validate": "newData.isString() || newData.isString()"
},
"query": {
".validate": "newData.isString()"
},
"title": {
".validate": "newData.isString()"
},
"favIconUrl": {
".validate": "newData.isString()"
},
"text": {
".validate": "newData.isString() || newData.isString()"
},
"image": {
".validate": "newData.isString()"
}
}
}
}
}
}