-
Notifications
You must be signed in to change notification settings - Fork 3
/
security-rules.json
33 lines (33 loc) · 1.15 KB
/
security-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
{
"rules": {
"documents": {
"$document_id": {
".write": "(data.child('public').val() === true) || (auth != null && ((data.child('owner_uid').val() == auth.uid) || !data.exists()))",
".read": "(data.child('public').val() === true) || (auth != null && data.child('owner_uid').val() == auth.uid)",
".validate": "data.exists() || $document_id.matches(/^[0-9a-f]{40}$/)",
"owner_uid": {
".validate": "newData.val() == auth.uid && !data.exists() && !(data.parent().child('public').val() === true)"
},
"nodes": {
"$node_id": {
".validate": "newData.hasChildren(['x', 'y', '_'])",
"x": { ".validate": "newData.isNumber()" },
"y": { ".validate": "newData.isNumber()" },
"_": { ".validate": "newData.isString()" }
}
},
"title": { ".validate": "newData.isString()" },
"public": {
".write": false,
".validate": "newData.isBoolean()"
},
"$other": { ".validate": false }
}
},
"stats": {
".read": true,
".write": true
},
"$other": { ".validate": false }
}
}