forked from anihalaney/rwa-trivia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfirebase-rules.json
27 lines (25 loc) · 992 Bytes
/
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
{
"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" }
}
},
"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))"
}
}
}
}
}