-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.rules.json
More file actions
35 lines (35 loc) · 1.44 KB
/
Copy pathdatabase.rules.json
File metadata and controls
35 lines (35 loc) · 1.44 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
{
"rules": {
".read": false,
".write": false,
"presence": {
"$coupleId": {
".read": "auth != null && (data.child('user1Id').val() == auth.uid || data.child('user2Id').val() == auth.uid)",
"user1Id": {
".write": "auth != null && (!data.exists() || data.val() == auth.uid)",
".validate": "newData.isString() && newData.val() == auth.uid"
},
"user2Id": {
".write": "auth != null && (!data.exists() || data.val() == auth.uid)",
".validate": "newData.isString() && newData.val() == auth.uid"
},
"user1Online": {
".write": "auth != null && root.child('presence').child($coupleId).child('user1Id').val() == auth.uid",
".validate": "newData.isBoolean()"
},
"user2Online": {
".write": "auth != null && root.child('presence').child($coupleId).child('user2Id').val() == auth.uid",
".validate": "newData.isBoolean()"
},
"pulse": {
".write": "auth != null && (root.child('presence').child($coupleId).child('user1Id').val() == auth.uid || root.child('presence').child($coupleId).child('user2Id').val() == auth.uid)",
".validate": "newData.hasChildren(['from','at']) && newData.child('from').isString() && newData.child('from').val() == auth.uid && newData.child('at').isNumber()"
},
"$other": {
".read": false,
".write": false
}
}
}
}
}