-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdatabase.rules.json
47 lines (41 loc) · 1.39 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
{
"rules": {
"invites": {
".indexOn": ["email"],
".read": "auth !== null",
".write": "auth !== null"
},
"users": {
".read": "auth !== null",
"$uid": {
".write": "$uid === auth.uid",
"boards": {
".validate": "auth.email_verified === true"
}
}
},
"boards": {
".read": "auth != null && auth.email_verified === true",
"$board": {
".write": "auth != null && auth.email_verified === true && (!data.exists() || !data.child('members').exists() || (data.child('members').val().length === 1 && data.child('members').hasChild(auth.uid)))",
"posts": {
"$post": {
".write": "!data.exists() || data.child('authorUID').val() === auth.uid",
"val": {
".write": "data.parent().parent().parent().child('members').hasChild(auth.uid)"
},
"col": {
".write": "data.parent().parent().parent().child('members').hasChild(auth.uid)"
}
}
},
"members": {
".write": "root.child('users').child(auth.uid).child('boards').child($board).exists() || data.parent().child('invites').hasChild(root.child('users').child(auth.uid).child('email').val().replace('.', '%2E'))"
},
"invites": {
".write": "data.parent().child('members').hasChild(auth.uid)"
}
}
}
}
}