forked from anihalaney/rwa-trivia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
firebase-rules.json
46 lines (44 loc) · 1.96 KB
/
firebase-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
{
"rules": {
".read": "auth != null && root.child('users/' + auth.uid + '/roles/admin').val() == true",
".write": "auth != null && root.child('users/' + auth.uid + '/roles/admin').val() == true",
"categories": { ".read": true } ,
"tagList": { ".read": true } ,
"users": {
"$uid": {
".read": "auth != null && $uid == auth.uid",
"roles": { ".write": false },
"questions": { ".write": "auth != null && $uid == auth.uid" },
"games": { ".write": "auth != null && $uid == auth.uid" }
}
},
"games": {
"$game_id": {
".read": "auth != null && (data.child('playerIds').child('0').val() == auth.uid ||
data.child('playerIds').child('1').val() == auth.uid)",
".validate": "newData.child('playerIds').child('0').val() === auth.uid",
".write": "auth != null && ((data.exists() && data.child('gameOver').val() != true &&
(data.child('playerIds').child('0').val() == auth.uid ||
data.child('playerIds').child('1').val() == auth.uid))
||
(!data.exists() &&
newData.child('playerIds').child('0').val() == auth.uid))"
}
},
"questions": {
"published": { ".read": true },
"unpublished": {
"$question_id": {
".read": "auth != null && data.child('created_uid').val() == auth.uid",
".validate": "newData.child('created_uid').val() === auth.uid",
".write": "auth != null && ((data.exists() &&
data.child('created_uid').val() == auth.uid &&
data.child('status').val() != 2)
||
(!data.exists() &&
newData.child('created_uid').val() == auth.uid))"
}
}
}
}
}