-
Notifications
You must be signed in to change notification settings - Fork 10
/
rules.yml
77 lines (62 loc) · 1.64 KB
/
rules.yml
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
functions:
- isUser(uid): auth.uid === uid
schema:
type: object
properties:
cards:
type: object
$card:
type: object
charges:
type: object
$charge:
type: object
coupons:
type: object
$coupon:
type: object
customers:
type: object
$customer:
type: object
plans:
type: object
$plan:
type: object
refunds:
type: object
$refund:
type: object
subscriptions:
type: object
$subscription:
type: object
access:
# A charge can have a customer id to reference
- location: /charges/$charge
read: next.customer === root['customers'][auth.uid].id
write: next.exists() && !prev.exists()
# A card should have the same name as a customer
- location: /cards/$card
read: isUser($card)
write: isUser($card) && next.exists() && !prev.exists()
# Usually it's best to keep coupons secret
- location: /coupons
read: false
write: false
# Assumes customers are stored using Simple Login uids
- location: /customers/$customer
read: isUser($customer)
write: isUser($customer)
# Plans can be kept as read only
- location: /plans
read: true
write: false
# Refunds should be only granted via Firebase secret
- location: /refunds
read: false
write: false
# A subscription should have the same name as a customer
- location: /subscriptions/$subscription
read: isUser($subscription)
write: isUser($subscription) && next.exists() && !prev.exists()