forked from Cloudxtreme/booktionator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatabase.rules.json
58 lines (58 loc) · 1.81 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
{
"rules": {
"users": {
"$user_id": {
".read": "auth != null && auth.provider !== 'anonymous'",
".write": "auth != null && auth.uid === $user_id && auth.provider !== 'anonymous'",
".validate": "newData.hasChildren(['phone', 'postalcode'])"
}
},
"books": {
".read": "true",
".indexOn": [
"score",
"modality"
],
"$book_id": {
".write": "auth != null && auth.provider !== 'anonymous'",
".validate": "newData.hasChildren(['title','description','author','date', 'score', 'image', 'publisher'])",
"offers": {
"$offer_id": {
".write": "auth != null && newData.child('author').val() == auth.uid",
".validate": "newData.hasChildren(['author', 'modality', 'exchange'])"
}
}
}
},
"transactions": {
".indexOn": [
"from",
"to",
"product",
"modality"
],
".read": "auth != null && auth.provider !== 'anonymous'",
".write": "auth != null && (auth.uid == data.child('from').val() || auth.uid == data.child('to').val()) && auth.provider !== 'anonymous'",
"$transaction_id": {
".validate": "newData.hasChildren(['from', 'to', 'beginAt', 'endAt', 'product', 'modality', 'exchange'])"
}
},
"auctions": {
".indexOn": [
"product"
],
"$auction_id": {
".read": "auth != null",
".write": "auth != null && data.child('author').val() == auth.uid",
".validate": "newData.hasChildren(['author', 'createdAt', 'due', 'product'])",
"bids": {
"$author_id": {
".read": "auth.provider !== 'anonymous'",
".write": "auth != null",
".validate": "newData.hasChildren(['value', 'at'])"
}
}
}
}
}
}