Commit 892e1455 authored by Manish Sethi's avatar Manish Sethi Committed by Gerrit Code Review
Browse files

Merge changes I3093c207,I9f66ae70,I5b150bb7,Ie80d8113

* changes:
  collACL: use cache to avoid repetative ACL check
  collACL: perform ACL on private data access
  collACL: add simpleCollectionStore to txContext
  collACL: add `MemberOnlyRead` in collectionConf
parents 3297dd2c 4f903d92
......@@ -11,6 +11,7 @@ import (
commonledger "github.com/hyperledger/fabric/common/ledger"
"github.com/hyperledger/fabric/core/chaincode"
"github.com/hyperledger/fabric/core/common/privdata"
"github.com/hyperledger/fabric/core/container/ccintf"
"github.com/hyperledger/fabric/core/ledger"
. "github.com/onsi/ginkgo"
......@@ -140,3 +141,8 @@ type registry interface {
type applicationConfigRetriever interface {
chaincode.ApplicationConfigRetriever
}
//go:generate counterfeiter -o mock/collection_store.go --fake-name CollectionStore . collectionStore
type collectionStore interface {
privdata.CollectionStore
}
......@@ -20,10 +20,13 @@ import (
commonledger "github.com/hyperledger/fabric/common/ledger"
"github.com/hyperledger/fabric/core/aclmgmt/resources"
"github.com/hyperledger/fabric/core/common/ccprovider"
"github.com/hyperledger/fabric/core/common/privdata"
"github.com/hyperledger/fabric/core/common/sysccprovider"
"github.com/hyperledger/fabric/core/container/ccintf"
"github.com/hyperledger/fabric/core/ledger"
"github.com/hyperledger/fabric/core/ledger/ledgerconfig"
"github.com/hyperledger/fabric/core/peer"
"github.com/hyperledger/fabric/protos/common"
pb "github.com/hyperledger/fabric/protos/peer"
"github.com/pkg/errors"
)
......@@ -574,6 +577,41 @@ func (h *Handler) checkMetadataCap(msg *pb.ChaincodeMessage) error {
return nil
}
func errorIfCreatorHasNoReadAccess(chaincodeName, collection string, txContext *TransactionContext) error {
accessAllowed, err := hasReadAccess(chaincodeName, collection, txContext)
if err != nil {
return err
}
if !accessAllowed {
return errors.Errorf("tx creator does not have read access permission on privatedata in chaincodeName:%s collectionName: %s",
chaincodeName, collection)
}
return nil
}
func hasReadAccess(chaincodeName, collection string, txContext *TransactionContext) (bool, error) {
// check to see if read access has already been checked in the scope of this chaincode simulation
if txContext.AllowedCollectionAccess[collection] {
return true, nil
}
cc := common.CollectionCriteria{
Channel: txContext.ChainID,
Namespace: chaincodeName,
Collection: collection,
}
accessAllowed, err := txContext.CollectionStore.HasReadAccess(cc, txContext.SignedProp, txContext.TXSimulator)
if err != nil {
return false, err
}
if accessAllowed {
txContext.AllowedCollectionAccess[collection] = accessAllowed
}
return accessAllowed, err
}
// Handles query to ledger to get state
func (h *Handler) HandleGetState(msg *pb.ChaincodeMessage, txContext *TransactionContext) (*pb.ChaincodeMessage, error) {
getState := &pb.GetState{}
......@@ -582,12 +620,16 @@ func (h *Handler) HandleGetState(msg *pb.ChaincodeMessage, txContext *Transactio
return nil, errors.Wrap(err, "unmarshal failed")
}
var res []byte
chaincodeName := h.ChaincodeName()
collection := getState.Collection
chaincodeLogger.Debugf("[%s] getting state for chaincode %s, key %s, channel %s", shorttxid(msg.Txid), chaincodeName, getState.Key, txContext.ChainID)
var res []byte
if isCollectionSet(getState.Collection) {
res, err = txContext.TXSimulator.GetPrivateData(chaincodeName, getState.Collection, getState.Key)
if isCollectionSet(collection) {
if err := errorIfCreatorHasNoReadAccess(chaincodeName, collection, txContext); err != nil {
return nil, err
}
res, err = txContext.TXSimulator.GetPrivateData(chaincodeName, collection, getState.Key)
} else {
res, err = txContext.TXSimulator.GetState(chaincodeName, getState.Key)
}
......@@ -616,11 +658,15 @@ func (h *Handler) HandleGetStateMetadata(msg *pb.ChaincodeMessage, txContext *Tr
}
chaincodeName := h.ChaincodeName()
collection := getStateMetadata.Collection
chaincodeLogger.Debugf("[%s] getting state metadata for chaincode %s, key %s, channel %s", shorttxid(msg.Txid), chaincodeName, getStateMetadata.Key, txContext.ChainID)
var metadata map[string][]byte
if isCollectionSet(getStateMetadata.Collection) {
metadata, err = txContext.TXSimulator.GetPrivateDataMetadata(chaincodeName, getStateMetadata.Collection, getStateMetadata.Key)
if isCollectionSet(collection) {
if err := errorIfCreatorHasNoReadAccess(chaincodeName, collection, txContext); err != nil {
return nil, err
}
metadata, err = txContext.TXSimulator.GetPrivateDataMetadata(chaincodeName, collection, getStateMetadata.Key)
} else {
metadata, err = txContext.TXSimulator.GetStateMetadata(chaincodeName, getStateMetadata.Key)
}
......@@ -657,15 +703,19 @@ func (h *Handler) HandleGetStateByRange(msg *pb.ChaincodeMessage, txContext *Tra
totalReturnLimit := calculateTotalReturnLimit(metadata)
iterID := h.UUIDGenerator.New()
chaincodeName := h.ChaincodeName()
var rangeIter commonledger.ResultsIterator
var paginationInfo map[string]interface{}
isPaginated := false
if isCollectionSet(getStateByRange.Collection) {
rangeIter, err = txContext.TXSimulator.GetPrivateDataRangeScanIterator(chaincodeName, getStateByRange.Collection,
chaincodeName := h.ChaincodeName()
collection := getStateByRange.Collection
if isCollectionSet(collection) {
if err := errorIfCreatorHasNoReadAccess(chaincodeName, collection, txContext); err != nil {
return nil, err
}
rangeIter, err = txContext.TXSimulator.GetPrivateDataRangeScanIterator(chaincodeName, collection,
getStateByRange.StartKey, getStateByRange.EndKey)
} else if isMetadataSetForPagination(metadata) {
paginationInfo, err = createPaginationInfoFromMetadata(metadata, totalReturnLimit, pb.ChaincodeMessage_GET_STATE_BY_RANGE)
......@@ -762,7 +812,6 @@ func (h *Handler) HandleQueryStateClose(msg *pb.ChaincodeMessage, txContext *Tra
// Handles query to ledger to execute query state
func (h *Handler) HandleGetQueryResult(msg *pb.ChaincodeMessage, txContext *TransactionContext) (*pb.ChaincodeMessage, error) {
iterID := h.UUIDGenerator.New()
chaincodeName := h.ChaincodeName()
getQueryResult := &pb.GetQueryResult{}
err := proto.Unmarshal(msg.Payload, getQueryResult)
......@@ -781,8 +830,13 @@ func (h *Handler) HandleGetQueryResult(msg *pb.ChaincodeMessage, txContext *Tran
var executeIter commonledger.ResultsIterator
var paginationInfo map[string]interface{}
if isCollectionSet(getQueryResult.Collection) {
executeIter, err = txContext.TXSimulator.ExecuteQueryOnPrivateData(chaincodeName, getQueryResult.Collection, getQueryResult.Query)
chaincodeName := h.ChaincodeName()
collection := getQueryResult.Collection
if isCollectionSet(collection) {
if err := errorIfCreatorHasNoReadAccess(chaincodeName, collection, txContext); err != nil {
return nil, err
}
executeIter, err = txContext.TXSimulator.ExecuteQueryOnPrivateData(chaincodeName, collection, getQueryResult.Query)
} else if isMetadataSetForPagination(metadata) {
paginationInfo, err = createPaginationInfoFromMetadata(metadata, totalReturnLimit, pb.ChaincodeMessage_GET_QUERY_RESULT)
if err != nil {
......@@ -950,8 +1004,9 @@ func (h *Handler) HandlePutState(msg *pb.ChaincodeMessage, txContext *Transactio
}
chaincodeName := h.ChaincodeName()
if isCollectionSet(putState.Collection) {
err = txContext.TXSimulator.SetPrivateData(chaincodeName, putState.Collection, putState.Key, putState.Value)
collection := putState.Collection
if isCollectionSet(collection) {
err = txContext.TXSimulator.SetPrivateData(chaincodeName, collection, putState.Key, putState.Value)
} else {
err = txContext.TXSimulator.SetState(chaincodeName, putState.Key, putState.Value)
}
......@@ -978,8 +1033,9 @@ func (h *Handler) HandlePutStateMetadata(msg *pb.ChaincodeMessage, txContext *Tr
metadata[putStateMetadata.Metadata.Metakey] = putStateMetadata.Metadata.Value
chaincodeName := h.ChaincodeName()
if isCollectionSet(putStateMetadata.Collection) {
err = txContext.TXSimulator.SetPrivateDataMetadata(chaincodeName, putStateMetadata.Collection, putStateMetadata.Key, metadata)
collection := putStateMetadata.Collection
if isCollectionSet(collection) {
err = txContext.TXSimulator.SetPrivateDataMetadata(chaincodeName, collection, putStateMetadata.Key, metadata)
} else {
err = txContext.TXSimulator.SetStateMetadata(chaincodeName, putStateMetadata.Key, metadata)
}
......@@ -998,8 +1054,9 @@ func (h *Handler) HandleDelState(msg *pb.ChaincodeMessage, txContext *Transactio
}
chaincodeName := h.ChaincodeName()
if isCollectionSet(delState.Collection) {
err = txContext.TXSimulator.DeletePrivateData(chaincodeName, delState.Collection, delState.Key)
collection := delState.Collection
if isCollectionSet(collection) {
err = txContext.TXSimulator.DeletePrivateData(chaincodeName, collection, delState.Key)
} else {
err = txContext.TXSimulator.DeleteState(chaincodeName, delState.Key)
}
......@@ -1123,6 +1180,7 @@ func (h *Handler) Execute(txParams *ccprovider.TransactionParams, cccid *ccprovi
chaincodeLogger.Debugf("Entry")
defer chaincodeLogger.Debugf("Exit")
txParams.CollectionStore = h.getCollectionStore(msg.ChannelId)
txctx, err := h.TXContexts.Create(txParams)
if err != nil {
return nil, err
......@@ -1163,6 +1221,14 @@ func (h *Handler) setChaincodeProposal(signedProp *pb.SignedProposal, prop *pb.P
return nil
}
func (h *Handler) getCollectionStore(channelID string) privdata.CollectionStore {
csStoreSupport := &peer.CollectionSupport{
PeerLedger: h.LedgerGetter.GetLedger(channelID),
}
return privdata.NewSimpleCollectionStore(csStoreSupport)
}
func (h *Handler) State() State { return h.state }
func (h *Handler) Close() { h.TXContexts.Close() }
......
......@@ -43,6 +43,7 @@ var _ = Describe("Handler", func() {
fakeLedgerGetter *mock.LedgerGetter
fakeHandlerRegistry *fake.Registry
fakeApplicationConfigRetriever *fake.ApplicationConfigRetriever
fakeCollectionStore *mock.CollectionStore
fakeShimRequestsReceived *metricsfakes.Counter
fakeShimRequestsCompleted *metricsfakes.Counter
fakeShimRequestDuration *metricsfakes.Histogram
......@@ -63,12 +64,16 @@ var _ = Describe("Handler", func() {
fakeTxSimulator = &mock.TxSimulator{}
fakeHistoryQueryExecutor = &mock.HistoryQueryExecutor{}
fakeCollectionStore = &mock.CollectionStore{}
responseNotifier = make(chan *pb.ChaincodeMessage, 1)
txContext = &chaincode.TransactionContext{
ChainID: "channel-id",
TXSimulator: fakeTxSimulator,
HistoryQueryExecutor: fakeHistoryQueryExecutor,
ResponseNotifier: responseNotifier,
ChainID: "channel-id",
TXSimulator: fakeTxSimulator,
HistoryQueryExecutor: fakeHistoryQueryExecutor,
ResponseNotifier: responseNotifier,
CollectionStore: fakeCollectionStore,
AllowedCollectionAccess: make(map[string]bool),
}
fakeACLProvider = &mock.ACLProvider{}
......@@ -883,6 +888,7 @@ var _ = Describe("Handler", func() {
Expect(err).NotTo(HaveOccurred())
incomingMessage.Payload = payload
fakeCollectionStore.HasReadAccessReturns(true, nil)
fakeTxSimulator.GetPrivateDataReturns([]byte("get-private-data-response"), nil)
expectedResponse.Payload = []byte("get-private-data-response")
})
......@@ -898,7 +904,7 @@ var _ = Describe("Handler", func() {
Expect(key).To(Equal("get-state-key"))
})
Context("and GetPrivateData fails", func() {
Context("and GetPrivateData fails due to ledger error", func() {
BeforeEach(func() {
fakeTxSimulator.GetPrivateDataReturns(nil, errors.New("french fries"))
})
......@@ -909,6 +915,49 @@ var _ = Describe("Handler", func() {
})
})
Context("and GetPrivateData fails due to no read access", func() {
BeforeEach(func() {
fakeCollectionStore.HasReadAccessReturns(false, nil)
})
It("returns the error from errorIfCreatorHasNoReadAccess", func() {
_, err := handler.HandleGetState(incomingMessage, txContext)
Expect(err).To(MatchError("tx creator does not have read access" +
" permission on privatedata in chaincodeName:cc-instance-name" +
" collectionName: collection-name"))
})
})
Context("and GetPrivateData fails due to error in checking the read access", func() {
BeforeEach(func() {
fakeCollectionStore.HasReadAccessReturns(false, errors.New("no collection config"))
})
It("returns the error from errorIfCreatorHasNoReadAccess", func() {
_, err := handler.HandleGetState(incomingMessage, txContext)
Expect(err).To(MatchError("no collection config"))
})
})
Context("and GetPrivateData returns the response message", func() {
BeforeEach(func() {
txContext.AllowedCollectionAccess["collection-name"] = true
fakeCollectionStore.HasReadAccessReturns(false, nil) // to
// ensure that the access cache is used
})
It("returns the the response message from GetPrivateData", func() {
resp, err := handler.HandleGetState(incomingMessage, txContext)
Expect(err).NotTo(HaveOccurred())
Expect(resp).To(Equal(&pb.ChaincodeMessage{
Type: pb.ChaincodeMessage_RESPONSE,
Payload: []byte("get-private-data-response"),
Txid: "tx-id",
ChannelId: "channel-id",
}))
})
})
It("returns the response message from GetPrivateData", func() {
resp, err := handler.HandleGetState(incomingMessage, txContext)
Expect(err).NotTo(HaveOccurred())
......@@ -1044,6 +1093,7 @@ var _ = Describe("Handler", func() {
metadata := map[string][]byte{
"get-state-metakey": []byte("get-private-metadata-response"),
}
fakeCollectionStore.HasReadAccessReturns(true, nil)
fakeTxSimulator.GetPrivateDataMetadataReturns(metadata, nil)
responsePayload, err := proto.Marshal(&pb.StateMetadataResult{
Entries: []*pb.StateMetadata{{
......@@ -1072,7 +1122,7 @@ var _ = Describe("Handler", func() {
Expect(resp).To(Equal(expectedResponse))
})
Context("and GetPrivateDataMetadata fails", func() {
Context("and GetPrivateDataMetadata fails due to ledger error", func() {
BeforeEach(func() {
fakeTxSimulator.GetPrivateDataMetadataReturns(nil, errors.New("french fries"))
})
......@@ -1082,6 +1132,30 @@ var _ = Describe("Handler", func() {
Expect(err).To(MatchError("french fries"))
})
})
Context("and GetPrivateDataMetadata fails due to no read access", func() {
BeforeEach(func() {
fakeCollectionStore.HasReadAccessReturns(false, nil)
})
It("returns the error from GetPrivateDataMetadata", func() {
_, err := handler.HandleGetStateMetadata(incomingMessage, txContext)
Expect(err).To(MatchError("tx creator does not have read access" +
" permission on privatedata in chaincodeName:cc-instance-name" +
" collectionName: collection-name"))
})
})
Context("and GetPrivateDataMetadata fails due to error in checking the read access", func() {
BeforeEach(func() {
fakeCollectionStore.HasReadAccessReturns(false, errors.New("no collection config"))
})
It("returns the error from GetPrivateDataMetadata", func() {
_, err := handler.HandleGetStateMetadata(incomingMessage, txContext)
Expect(err).To(MatchError("no collection config"))
})
})
})
Context("when collection is not set", func() {
......@@ -1230,6 +1304,7 @@ var _ = Describe("Handler", func() {
Expect(err).NotTo(HaveOccurred())
incomingMessage.Payload = payload
fakeCollectionStore.HasReadAccessReturns(true, nil)
fakeTxSimulator.GetPrivateDataRangeScanIteratorReturns(fakeIterator, nil)
})
......@@ -1245,7 +1320,7 @@ var _ = Describe("Handler", func() {
Expect(endKey).To(Equal("get-state-end-key"))
})
Context("and GetPrivateDataRangeScanIterator fails", func() {
Context("and GetPrivateDataRangeScanIterator fails due to ledger error", func() {
BeforeEach(func() {
fakeTxSimulator.GetPrivateDataRangeScanIteratorReturns(nil, errors.New("french fries"))
})
......@@ -1255,6 +1330,30 @@ var _ = Describe("Handler", func() {
Expect(err).To(MatchError("french fries"))
})
})
Context("and GetPrivateDataRangeScanIterator fails due to no read access", func() {
BeforeEach(func() {
fakeCollectionStore.HasReadAccessReturns(false, nil)
})
It("returns the error from GetPrivateDataRangeScanIterator", func() {
_, err := handler.HandleGetStateByRange(incomingMessage, txContext)
Expect(err).To(MatchError("tx creator does not have read access" +
" permission on privatedata in chaincodeName:cc-instance-name" +
" collectionName: collection-name"))
})
})
Context("and GetPrivateDataRangeScanIterator fails due to error in checking the read access", func() {
BeforeEach(func() {
fakeCollectionStore.HasReadAccessReturns(false, errors.New("no collection config"))
})
It("returns the error from GetPrivateDataRangeScanIterator", func() {
_, err := handler.HandleGetStateByRange(incomingMessage, txContext)
Expect(err).To(MatchError("no collection config"))
})
})
})
Context("when unmarshalling the request fails", func() {
......@@ -1564,6 +1663,7 @@ var _ = Describe("Handler", func() {
Expect(err).NotTo(HaveOccurred())
incomingMessage.Payload = payload
fakeCollectionStore.HasReadAccessReturns(true, nil)
fakeTxSimulator.ExecuteQueryOnPrivateDataReturns(fakeIterator, nil)
})
......@@ -1590,7 +1690,7 @@ var _ = Describe("Handler", func() {
Expect(*retCount).To(Equal(int32(0)))
})
Context("and ExecuteQueryOnPrivateData fails", func() {
Context("and ExecuteQueryOnPrivateData fails due to ledger error", func() {
BeforeEach(func() {
fakeTxSimulator.ExecuteQueryOnPrivateDataReturns(nil, errors.New("pizza"))
})
......@@ -1600,6 +1700,30 @@ var _ = Describe("Handler", func() {
Expect(err).To(MatchError("pizza"))
})
})
Context("and ExecuteQueryOnPrivateData fails due to no read access", func() {
BeforeEach(func() {
fakeCollectionStore.HasReadAccessReturns(false, nil)
})
It("returns the error", func() {
_, err := handler.HandleGetQueryResult(incomingMessage, txContext)
Expect(err).To(MatchError("tx creator does not have read access" +
" permission on privatedata in chaincodeName:cc-instance-name" +
" collectionName: collection-name"))
})
})
Context("and ExecuteQueryOnPrivateData fails due to error in checking the read access", func() {
BeforeEach(func() {
fakeCollectionStore.HasReadAccessReturns(false, errors.New("no collection config"))
})
It("returns the error", func() {
_, err := handler.HandleGetQueryResult(incomingMessage, txContext)
Expect(err).To(MatchError("no collection config"))
})
})
})
It("builds the query response", func() {
......
// Code generated by counterfeiter. DO NOT EDIT.
package mock
import (
sync "sync"
privdata "github.com/hyperledger/fabric/core/common/privdata"
ledger "github.com/hyperledger/fabric/core/ledger"
common "github.com/hyperledger/fabric/protos/common"
peer "github.com/hyperledger/fabric/protos/peer"
)
type CollectionStore struct {
AccessFilterStub func(string, *common.CollectionPolicyConfig) (privdata.Filter, error)
accessFilterMutex sync.RWMutex
accessFilterArgsForCall []struct {
arg1 string
arg2 *common.CollectionPolicyConfig
}
accessFilterReturns struct {
result1 privdata.Filter
result2 error
}
accessFilterReturnsOnCall map[int]struct {
result1 privdata.Filter
result2 error
}
HasReadAccessStub func(common.CollectionCriteria, *peer.SignedProposal, ledger.QueryExecutor) (bool, error)
hasReadAccessMutex sync.RWMutex
hasReadAccessArgsForCall []struct {
arg1 common.CollectionCriteria
arg2 *peer.SignedProposal
arg3 ledger.QueryExecutor
}
hasReadAccessReturns struct {
result1 bool
result2 error
}
hasReadAccessReturnsOnCall map[int]struct {
result1 bool
result2 error
}
RetrieveCollectionStub func(common.CollectionCriteria) (privdata.Collection, error)
retrieveCollectionMutex sync.RWMutex
retrieveCollectionArgsForCall []struct {
arg1 common.CollectionCriteria
}
retrieveCollectionReturns struct {
result1 privdata.Collection
result2 error
}
retrieveCollectionReturnsOnCall map[int]struct {
result1 privdata.Collection
result2 error
}
RetrieveCollectionAccessPolicyStub func(common.CollectionCriteria) (privdata.CollectionAccessPolicy, error)
retrieveCollectionAccessPolicyMutex sync.RWMutex
retrieveCollectionAccessPolicyArgsForCall []struct {
arg1 common.CollectionCriteria
}
retrieveCollectionAccessPolicyReturns struct {
result1 privdata.CollectionAccessPolicy
result2 error
}
retrieveCollectionAccessPolicyReturnsOnCall map[int]struct {
result1 privdata.CollectionAccessPolicy
result2 error
}
RetrieveCollectionConfigPackageStub func(common.CollectionCriteria) (*common.CollectionConfigPackage, error)
retrieveCollectionConfigPackageMutex sync.RWMutex
retrieveCollectionConfigPackageArgsForCall []struct {
arg1 common.CollectionCriteria
}
retrieveCollectionConfigPackageReturns struct {
result1 *common.CollectionConfigPackage
result2 error
}
retrieveCollectionConfigPackageReturnsOnCall map[int]struct {
result1 *common.CollectionConfigPackage
result2 error
}
RetrieveCollectionPersistenceConfigsStub func(common.CollectionCriteria) (privdata.CollectionPersistenceConfigs, error)
retrieveCollectionPersistenceConfigsMutex sync.RWMutex
retrieveCollectionPersistenceConfigsArgsForCall []struct {
arg1 common.CollectionCriteria
}
retrieveCollectionPersistenceConfigsReturns struct {
result1 privdata.CollectionPersistenceConfigs
result2 error
}
retrieveCollectionPersistenceConfigsReturnsOnCall map[int]struct {
result1 privdata.CollectionPersistenceConfigs
result2 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *CollectionStore) AccessFilter(arg1 string, arg2 *common.CollectionPolicyConfig) (privdata.Filter, error) {
fake.accessFilterMutex.Lock()
ret, specificReturn := fake.accessFilterReturnsOnCall[len(fake.accessFilterArgsForCall)]
fake.accessFilterArgsForCall = append(fake.accessFilterArgsForCall, struct {
arg1 string
arg2 *common.CollectionPolicyConfig
}{arg1, arg2})
fake.recordInvocation("AccessFilter", []interface{}{arg1, arg2})
fake.accessFilterMutex.Unlock()
if fake.AccessFilterStub != nil {
return fake.AccessFilterStub(arg1, arg2)
}
if specificReturn {
return ret.result1, ret.result2
}
fakeReturns := fake.accessFilterReturns
return fakeReturns.result1, fakeReturns.result2
}
func (fake *CollectionStore) AccessFilterCallCount() int {
fake.accessFilterMutex.RLock()
defer fake.accessFilterMutex.RUnlock()
return len(fake.accessFilterArgsForCall)
}
func (fake *CollectionStore) AccessFilterCalls(stub func(string, *common.CollectionPolicyConfig) (privdata.Filter, error)) {
fake.accessFilterMutex.Lock()
defer fake.accessFilterMutex.Unlock()
fake.AccessFilterStub = stub
}
func (fake *CollectionStore) AccessFilterArgsForCall(i int) (string, *common.CollectionPolicyConfig) {
fake.accessFilterMutex.RLock()
defer fake.accessFilterMutex.RUnlock()
argsForCall := fake.accessFilterArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2
}
func (fake *CollectionStore) AccessFilterReturns(result1 privdata.Filter, result2 error) {
fake.accessFilterMutex.Lock()
defer fake.accessFilterMutex.Unlock()
fake.AccessFilterStub = nil
fake.accessFilterReturns = struct {
result1 privdata.Filter
result2 error
}{result1, result2}
}
func (fake *CollectionStore) AccessFilterReturnsOnCall(i int, result1 privdata.Filter, result2 error) {
fake.accessFilterMutex.Lock()
defer fake.accessFilterMutex.Unlock()
fake.AccessFilterStub = nil
if fake.accessFilterReturnsOnCall == nil {
fake.accessFilterReturnsOnCall = make(map[int]struct {
result1 privdata.Filter
result2 error
})
}
fake.accessFilterReturnsOnCall[i] = struct {