@@ -18,7 +18,6 @@ import (
18
18
commonledger "github.com/hyperledger/fabric/common/ledger"
19
19
"github.com/hyperledger/fabric/common/resourcesconfig"
20
20
"github.com/hyperledger/fabric/common/util"
21
- "github.com/hyperledger/fabric/core/aclmgmt"
22
21
"github.com/hyperledger/fabric/core/aclmgmt/resources"
23
22
"github.com/hyperledger/fabric/core/common/ccprovider"
24
23
"github.com/hyperledger/fabric/core/common/sysccprovider"
@@ -42,6 +41,12 @@ var chaincodeLogger = flogging.MustGetLogger("chaincode")
42
41
43
42
type stateHandlers map [pb.ChaincodeMessage_Type ]func (* pb.ChaincodeMessage )
44
43
44
+ // ACLProvider is responsible for performing access control checks when invoking
45
+ // chaincode.
46
+ type ACLProvider interface {
47
+ CheckACL (resName string , channelID string , idinfo interface {}) error
48
+ }
49
+
45
50
// internal interface to scope dependencies on ChaincodeSupport
46
51
type handlerSupport interface {
47
52
deregisterHandler (* Handler ) error
@@ -83,6 +88,8 @@ type Handler struct {
83
88
84
89
keepalive time.Duration
85
90
userRunsCC bool
91
+
92
+ aclProvider ACLProvider
86
93
}
87
94
88
95
func shorttxid (txid string ) string {
@@ -206,7 +213,7 @@ func (h *Handler) checkACL(signedProp *pb.SignedProposal, proposal *pb.Proposal,
206
213
return errors .Errorf ("signed proposal must not be nil from caller [%s]" , ccIns .String ())
207
214
}
208
215
209
- return aclmgmt . GetACLProvider () .CheckACL (resources .Peer_ChaincodeToChaincode , ccIns .ChainID , signedProp )
216
+ return h . aclProvider .CheckACL (resources .Peer_ChaincodeToChaincode , ccIns .ChainID , signedProp )
210
217
}
211
218
212
219
func (h * Handler ) deregister () {
@@ -325,6 +332,7 @@ func newChaincodeSupportHandler(chaincodeSupport *ChaincodeSupport, peerChatStre
325
332
activeTransactions : NewActiveTransactions (),
326
333
keepalive : chaincodeSupport .keepalive ,
327
334
userRunsCC : chaincodeSupport .userRunsCC ,
335
+ aclProvider : chaincodeSupport .ACLProvider ,
328
336
sccp : sccp ,
329
337
}
330
338
0 commit comments