/
permissions.go
70 lines (64 loc) · 1.21 KB
/
permissions.go
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
package macaroons
import "gopkg.in/macaroon-bakery.v2/bakery"
var (
ReadPermissions = []bakery.Op{
{
Entity: "info",
Action: "read",
},
{
Entity: "swap",
Action: "read",
},
}
WritePermissions = []bakery.Op{
{
Entity: "info",
Action: "write",
},
{
Entity: "swap",
Action: "write",
},
}
RPCServerPermissions = map[string][]bakery.Op{
"/boltzrpc.Boltz/GetInfo": {{
Entity: "info",
Action: "read",
}},
"/boltzrpc.Boltz/GetServiceInfo": {{
Entity: "info",
Action: "read",
}},
"/boltzrpc.Boltz/ListSwaps": {{
Entity: "swap",
Action: "read",
}},
"/boltzrpc.Boltz/GetSwapInfo": {{
Entity: "swap",
Action: "read",
}},
"/boltzrpc.Boltz/Deposit": {{
Entity: "swap",
Action: "write",
}},
"/boltzrpc.Boltz/CreateSwap": {{
Entity: "swap",
Action: "write",
}},
"/boltzrpc.Boltz/CreateChannel": {{
Entity: "swap",
Action: "write",
}},
"/boltzrpc.Boltz/CreateReverseSwap": {{
Entity: "swap",
Action: "write",
}},
}
)
func AdminPermissions() []bakery.Op {
admin := make([]bakery.Op, len(ReadPermissions)+len(WritePermissions))
copy(admin, ReadPermissions)
copy(admin[len(ReadPermissions):], WritePermissions)
return admin
}