-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpermissions.acl
216 lines (198 loc) · 6.46 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
/*
* Dealer Rules:
* Dealer can see all cars, customers, orders and logistic companies
*/
rule allowDealerApproveOrder{
description: "Dealer allow to approve order"
participant: "com.iftakhar.dealership.Dealer"
operation: ALL
resource: "com.iftakhar.dealership.approveOrder"
action: ALLOW
}
rule allowDealerViewAllOrder{
description: "Dealer allow to see all order"
participant: "com.iftakhar.dealership.Dealer"
operation: ALL
resource: "com.iftakhar.dealership.Order"
action: ALLOW
}
rule allowDealerViewAllCars{
description: "Dealer allow to see all cars"
participant: "com.iftakhar.dealership.Dealer"
operation: ALL
resource: "com.iftakhar.dealership.Car"
action: ALLOW
}
rule allowDealerViewThemselves{
description: "Dealer allow to see themselves"
participant(p): "com.iftakhar.dealership.Dealer"
operation: ALL
resource(r): "com.iftakhar.dealership.Dealer"
condition: (p.getIdentifier()==r.getIdentifier())
action: ALLOW
}
rule allowDealerViewAllCustomer{
description: "Customer allow to see all customer"
participant: "com.iftakhar.dealership.Dealer"
operation: ALL
resource: "com.iftakhar.dealership.Customer"
action: ALLOW
}
rule allowDealerViewAllLogisticCompany{
description: "Customer allow to see all logistic company"
participant: "com.iftakhar.dealership.Dealer"
operation: ALL
resource: "com.iftakhar.dealership.LogisticCompany"
action: ALLOW
}
/*
* Logistic companies rules:
* Dealer can see their shipment order and themselves
*/
rule logisticComViewTheirShipment{
description: "Logistic companies allow to see only thier shipment"
participant(p): "com.iftakhar.dealership.LogisticCompany"
operation: READ,UPDATE
resource(r): "com.iftakhar.dealership.Order"
condition: (p.getIdentifier() == r.logisticCompany.getIdentifier())
action: ALLOW
}
rule allowLogisticComDispatchOrder{
description: "Allow logistic companies to dispatch assigned order"
participant: "com.iftakhar.dealership.LogisticCompany"
operation: ALL
resource: "com.iftakhar.dealership.dispatchOrder"
action: ALLOW
}
rule allowLogisticComDeliverOrder{
description: "Logistic companies allow to deliver assigned order"
participant: "com.iftakhar.dealership.LogisticCompany"
operation: ALL
resource: "com.iftakhar.dealership.deliverOrder"
action: ALLOW
}
rule allowLogisticComToViewAssignedOrder{
description: "Logistic companies allow to see only themselves"
participant(p): "com.iftakhar.dealership.LogisticCompany"
operation: READ
resource(r): "com.iftakhar.dealership.Order"
condition: (p.getIdentifier() == r.getIdentifier())
action: ALLOW
}
rule allowLogisticComViewThemselves{
description: "Logistic companies allow to see only themselves"
participant(p): "com.iftakhar.dealership.LogisticCompany"
operation: READ
resource(r): "com.iftakhar.dealership.LogisticCompany"
condition: (p.getIdentifier() == r.getIdentifier())
action: ALLOW
}
/*
* Customer Rules:
* Customer can see all cars, their owned orders
*/
rule allowCustomerAllAvailableCars{
description: "Customer allow to see only their own order"
participant(p): "com.iftakhar.dealership.Customer"
operation: READ, UPDATE
resource(r): "com.iftakhar.dealership.Car"
condition: (r.orderState == "CAR_AVAILABLE" || (r.orderState == "CAR_SOLD" && r.customer.customerId == p.customerId))
action: ALLOW
}
rule allowCustomerViewOwnOrder{
description: "Customer allow to see only their own order"
participant(p): "com.iftakhar.dealership.Customer"
operation: READ
resource(r): "com.iftakhar.dealership.Order"
condition: (p.getIdentifier() == r.customer.getIdentifier())
action: ALLOW
}
rule allowCustomerViewThemselves{
description: "Customer allow to see only their own order"
participant(p): "com.iftakhar.dealership.Customer"
operation: READ
resource(r): "com.iftakhar.dealership.Customer"
condition: (p.getIdentifier() == r.getIdentifier())
action: ALLOW
}
rule allowCustomerBookCar{
description: "Customer allow to book order"
participant: "com.iftakhar.dealership.Customer"
operation: CREATE
resource: "com.iftakhar.dealership.bookCar"
action: ALLOW
}
rule allowCustomerToViewCarBasedOnColor{
description: "Customer allow to view car based on color"
participant: "com.iftakhar.dealership.Customer"
operation: CREATE
resource: "com.iftakhar.dealership.selectCarBasedOnColor"
action: ALLOW
}
rule allowCustomerToViewCarBasedOnPrice{
description: "Customer allow to view car based on price"
participant: "com.iftakhar.dealership.Customer"
operation: CREATE
resource: "com.iftakhar.dealership.selectCarBasedOnPrice"
action: ALLOW
}
rule allowCustomerToViewCarBasedOnHorsePower{
description: "Customer allow to view car based on horse power"
participant: "com.iftakhar.dealership.Customer"
operation: CREATE
resource: "com.iftakhar.dealership.selectCarBasedHorsePower"
action: ALLOW
}
rule allowCustomerToViewCarBasedOnModel{
description: "Customer allow to view car based on model"
participant: "com.iftakhar.dealership.Customer"
operation: CREATE
resource: "com.iftakhar.dealership.selectCarBasedOnModel"
action: ALLOW
}
rule allowCustomerToViewCarBasedOnMake{
description: "Customer allow to view car based on make"
participant: "com.iftakhar.dealership.Customer"
operation: CREATE
resource: "com.iftakhar.dealership.selectCarBasedOnMake"
action: ALLOW
}
rule customerAllowTCreateOrder{
description: "Customer allow to book order"
participant: "com.iftakhar.dealership.Customer"
operation: CREATE
resource: "com.iftakhar.dealership.Order"
action: ALLOW
}
rule customerAllowToCancelOrder{
description: "Customer allow to cancel order"
participant: "com.iftakhar.dealership.Customer"
operation: CREATE
resource: "com.iftakhar.dealership.cancelOrder"
action: ALLOW
}
/*
* System Rules:
* DO NOT TOUCH
*/
rule SystemACL {
description: "System ACL to permit all access"
participant: "org.hyperledger.composer.system.Participant"
operation: ALL
resource: "org.hyperledger.composer.system.**"
action: ALLOW
}
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
}