-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathdatabase.rules.json
34 lines (30 loc) · 924 Bytes
/
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
{
"rules": {
"following": {
"$uid": {
".read": "auth != null",
".write": "auth.uid === $uid"
}
},
"users": {
".read": true,
".indexOn": "username",
"$uid": {
".write": "auth.uid === $uid",
"username": {
".validate": "root.child('username_lookup/'+newData.val()).val() === auth.uid"
}
}
},
"username_lookup": {
"$username": {
// not readable, cannot get a list of usernames!
// can only write if this username is not already in the db
".write": "!data.exists()",
".read": true,
// can only write my own uid into this index
".validate": "newData.val() === auth.uid"
}
}
}
}