-
Notifications
You must be signed in to change notification settings - Fork 5
/
permissions.acl
235 lines (205 loc) · 7.01 KB
/
permissions.acl
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
/* Admin */
rule NetworkAdminUser {
description: "Grant business network administrators full access to user resources"
participant: "org.hyperledger.composer.system.NetworkAdmin"
operation: ALL
resource: "**"
action: ALLOW
}
rule NetworkAdminSystem {
description: "Grant business network administrators full access to system resources"
participant: "org.hyperledger.composer.system.NetworkAdmin"
operation: ALL
resource: "org.hyperledger.composer.system.**"
action: ALLOW
}
/* Common */
rule CommonReadTransactionRegistry {
description: "Allow all participants to read transaction registry"
participant: "org.hyperledger.composer.system.Participant"
operation: READ
resource: "org.hyperledger.composer.system.TransactionRegistry"
action: ALLOW
}
rule CommonReadParticipantRegistry {
description: "Allow all participants to read participant registry"
participant: "org.hyperledger.composer.system.Participant"
operation: READ
resource: "org.hyperledger.composer.system.ParticipantRegistry"
action: ALLOW
}
rule CommonReadAssetRegistry {
description: "Allow all participants to read asset registry"
participant: "org.hyperledger.composer.system.Participant"
operation: READ
resource: "org.hyperledger.composer.system.AssetRegistry"
action: ALLOW
}
rule CommonReadNetwork {
description: "Allow all participants to read network"
participant: "org.hyperledger.composer.system.Participant"
operation: READ
resource: "org.hyperledger.composer.system.Network"
action: ALLOW
}
/* Trader */
rule TraderManageClient {
description: "Allow traders to read all clients"
participant: "org.acme.mynetwork.Trader"
operation: ALL
resource: "org.acme.mynetwork.Client"
action: ALLOW
}
rule TraderManageOwnTrades {
description: "Allow traders to manage their trades"
participant(t): "org.acme.mynetwork.Trader"
operation: ALL
resource(tt): "org.acme.mynetwork.Trade"
condition: (tt.trader.getIdentifier() == t.getIdentifier())
action: ALLOW
}
rule TraderManageLots {
description: "Allow traders to read and create lots"
participant: "org.acme.mynetwork.Trader"
operation: READ, CREATE
resource: "org.acme.mynetwork.Lot"
action: ALLOW
}
rule TraderUpdateLots {
description: "Allow traders to update lots via Trade transaction"
participant: "org.acme.mynetwork.Trader"
operation: UPDATE
resource: "org.acme.mynetwork.Lot"
transaction: "org.acme.mynetwork.Trade"
action: ALLOW
}
rule TraderReadOwnTrader {
description: "Allow traders to read their own info"
participant(t): "org.acme.mynetwork.Trader"
operation: READ
resource(tt): "org.acme.mynetwork.Trader"
condition: (tt.getIdentifier() == t.getIdentifier())
action: ALLOW
}
rule TraderAddAsset {
description: "Allow traders to add assets to registry"
participant: "org.acme.mynetwork.Trader"
operation: CREATE
resource: "org.hyperledger.composer.system.AddAsset"
action: ALLOW
}
rule TraderCreateHistorianRecord {
description: "Allow traders to create historian record"
participant: "org.acme.mynetwork.Trader"
operation: CREATE
resource: "org.hyperledger.composer.system.HistorianRecord"
action: ALLOW
}
rule TraderReadOwnHistorianRecord {
description: "Allow traders to read their own historian record"
participant(t): "org.acme.mynetwork.Trader"
operation: READ
resource(hr): "org.hyperledger.composer.system.HistorianRecord"
condition: (hr.transactionType == "org.acme.mynetwork.Trade" && hr.participantInvoking.getIdentifier() == t.getIdentifier())
action: ALLOW
}
/* Client */
rule ClientReadOwnTrades {
description: "Allow clients to view their trades"
participant(c): "org.acme.mynetwork.Client"
operation: READ
resource(t): "org.acme.mynetwork.Trade"
condition: (t.client.getIdentifier() == c.getIdentifier())
action: ALLOW
}
rule ClientReadOwnEvents {
description: "Allow clients to subscribe to NewTrade events"
participant(c): "org.acme.mynetwork.Client"
operation: READ
resource(e): "org.acme.mynetwork.NewTradeEvent"
condition: (e.lot.owner.getIdentifier() == c.getIdentifier())
action: ALLOW
}
rule ClientReadOwnLots {
description: "Allow clients to view lots they own"
participant(c): "org.acme.mynetwork.Client"
operation: READ
resource(s): "org.acme.mynetwork.Lot"
condition: (s.owner.getIdentifier() == c.getIdentifier())
action: ALLOW
}
rule ClientReadOwnClient {
description: "Allow clients to view their info"
participant(c): "org.acme.mynetwork.Client"
operation: READ
resource(cc): "org.acme.mynetwork.Client"
condition: (cc.getIdentifier() == c.getIdentifier())
action: ALLOW
}
rule ClientReadTraders {
description: "Allow clients to view traders"
participant: "org.acme.mynetwork.Client"
operation: READ
resource: "org.acme.mynetwork.Trader"
action: ALLOW
}
rule ClientReadHistorianRecord {
description: "Allow clients to view their historian records"
participant(c): "org.acme.mynetwork.Client"
operation: READ
resource(hr): "org.hyperledger.composer.system.HistorianRecord"
condition: (hr.transactionType == "org.acme.mynetwork.Trade" && hr.transactionInvoked.client.getIdentifier() == c.getIdentifier())
action: ALLOW
}
/* Custodian */
rule CustodianReadAllTrades {
description: "Allow custodian to view all trades"
participant: "org.acme.mynetwork.Custodian"
operation: READ
resource: "org.acme.mynetwork.Trade"
action: ALLOW
}
rule CustodianReadAllLots {
description: "Allow custodian to view all lots"
participant: "org.acme.mynetwork.Custodian"
operation: READ
resource: "org.acme.mynetwork.Lot"
action: ALLOW
}
rule CustodianReadAllClients {
description: "Allow custodian to view all clients"
participant: "org.acme.mynetwork.Custodian"
operation: READ
resource: "org.acme.mynetwork.Client"
action: ALLOW
}
rule CustodianReadAllEvents {
description: "Allow custodian to subscribe to NewTrade events"
participant: "org.acme.mynetwork.Custodian"
operation: READ
resource: "org.acme.mynetwork.NewTradeEvent"
action: ALLOW
}
rule CustodianReadAllTraders {
description: "Allow custodian to view all traders"
participant: "org.acme.mynetwork.Custodian"
operation: READ
resource: "org.acme.mynetwork.Trader"
action: ALLOW
}
rule CustodianReadOwnCustodian {
description: "Allow custodian to view their info"
participant(c): "org.acme.mynetwork.Custodian"
operation: READ
resource(cc): "org.acme.mynetwork.Custodian"
condition: (cc.getIdentifier() == c.getIdentifier())
action: ALLOW
}
rule CustodianReadHistorianRecord {
description: "Allow custodian to view all trade historian records"
participant(t): "org.acme.mynetwork.Custodian"
operation: READ
resource(hr): "org.hyperledger.composer.system.HistorianRecord"
condition: (hr.transactionType == "org.acme.mynetwork.Trade")
action: ALLOW
}