-
Notifications
You must be signed in to change notification settings - Fork 38
/
database.rules.json
65 lines (65 loc) · 2.27 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{
"rules": {
".read": false,
".write": false,
"versionInfo": {
".read": true,
".write": false
},
"displayNames": {
".read": true,
".write": false
},
"sessions": {
"$sessionId": {
".validate": "newData.hasChildren(['user', 'startedAt']) || newData.hasChildren(['endedAt'])",
".write": "auth !== null && ((!data.exists() && newData.child('user').val() === auth.uid) || (data.child('user').val() === auth.uid))",
"user": {
".validate": "newData.isString()"
},
"startedAt": {
".validate": "newData.isNumber()"
},
"endedAt": {
".write": "!data.exists()"
}
}
},
"presence": {
"$userId": {
".validate": "newData.isBoolean()",
".write": "$userId === auth.uid || (!newData.exists() && data.exists())"
}
},
"requests": {
"$requestGroup": {
".indexOn": ["createdAt", "createdBy"],
"$requestId": {
".read": "auth !== null && data.child('createdBy').val() === auth.uid",
".write": "auth !== null && newData.child('createdBy').val() === auth.uid"
}
}
},
"responses": {
"createAuthToken": {
"$responseId": {
".read": "auth !== null && (root.child('requests').child('createAuthToken').child($responseId).child('createdBy').val() == auth.uid || root.child('requests').child('createAuthToken').child($responseId).child('uid').val() == auth.uid)",
".write": "auth !== null && (root.child('requests').child('createAuthToken').child($responseId).child('createdBy').val() == auth.uid || root.child('requests').child('createAuthToken').child($responseId).child('uid').val() == auth.uid)"
}
},
"$responseGroup": {
".indexOn": ["createdAt", "createdBy"],
"$responseId": {
".read": "auth !== null && root.child('requests').child($responseGroup).child($responseId).child('createdBy').val() == auth.uid",
".write": "auth !== null && root.child('requests').child($responseGroup).child($responseId).child('createdBy').val() == auth.uid"
}
}
},
"serviceAccounts": {
"$projectId": {
".read": "auth !== null",
".write": "auth !== null"
}
}
}
}