-
Notifications
You must be signed in to change notification settings - Fork 126
/
database.rules.json
96 lines (96 loc) · 3.51 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
{
"rules": {
"categories": {
".indexOn": ["slug", "weight"],
".read": true,
".write": "root.child('admins/'+auth.uid).exists() && root.child('admins/'+auth.uid).child('role').val().matches(/(admin)/)"
},
"admins": {
".indexOn": "email",
".write": true,
".read": "root.child('admins/'+auth.uid).exists() && root.child('admins/'+auth.uid).child('role').val().matches(/(admin)/)",
"$uid": {
".read": "$uid == auth.uid || root.child('admins/'+auth.uid).exists() || data.child('email').val() == auth.email",
".write": "$uid == auth.uid || root.child('admins/'+auth.uid).exists() || data.child('email').val() == auth.email"
}
},
"approvals": {
".read": "root.child('admins/'+auth.uid).exists()",
".write": "root.child('admins/'+auth.uid).exists()",
"categories": {
".indexOn": ["updatedBy", "entityKey"]
},
"products": {
".indexOn": ["updatedBy", "entityKey"]
},
"pages": {
".indexOn": ["updatedBy", "entityKey"]
},
"posts": {
".indexOn": ["updatedBy", "entityKey"]
}
},
"orders": {
".read": "root.child('admins/'+auth.uid).exists() && root.child('admins/'+auth.uid).child('role').val().matches(/(admin)/)",
".write": "auth != null",
".indexOn": ["uid", "rdate"],
"$order_id": {
".read": "data.child('uid').val() == auth.uid || root.child('admins/'+auth.uid).exists()"
}
},
"menus": {
".read": true,
".write": "root.child('admins/'+auth.uid).exists() && root.child('admins/'+auth.uid).child('role').val().matches(/(admin)/)"
},
"theme": {
".read": true,
".write": "root.child('admins/'+auth.uid).exists() && root.child('admins/'+auth.uid).child('role').val().matches(/(admin)/)"
},
"pages": {
".read": true,
".write": "root.child('admins/'+auth.uid).exists() && root.child('admins/'+auth.uid).child('role').val().matches(/(admin)/)",
".indexOn": ["rdateUpdated", "url"]
},
"products": {
".read": true,
".write": "root.child('admins/'+auth.uid).exists() && root.child('admins/'+auth.uid).child('role').val().matches(/(admin)/)",
".indexOn": ["published", "category", "rdateUpdated", "url"],
"$p_id": {
".read": "data.child('published').val() == true || root.child('admins/'+auth.uid).exists()"
}
},
"posts": {
".read": true,
".write": "root.child('admins/'+auth.uid).exists() && root.child('admins/'+auth.uid).child('role').val().matches(/(admin)/)",
".indexOn": ["published", "url"]
},
"users": {
".read": "root.child('admins/'+auth.uid).exists() && root.child('admins/'+auth.uid).child('role').val().matches(/(admin)/)",
".write": true,
"$uid": {
".read": "$uid == auth.uid || root.child('admins/'+auth.uid).exists()",
".write": "$uid == auth.uid || root.child('admins/'+auth.uid).exists()"
}
},
"stripe_customers": {
"$uid": {
".read": "$uid == auth.uid",
"sources": {
"$chargeId" : {
".write": "$uid == auth.uid",
"token": { ".validate": "newData.isString()" },
"$other": { ".validate": false }
}
},
"charges": {
"$sourceId" : {
".write": "$uid == auth.uid",
"source": { ".validate": "newData.isString()" },
"amount": { ".validate": "newData.isNumber()" },
"$other": { ".validate": false }
}
}
}
}
}
}