Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions pkg/cid/cid.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"encoding/hex"
"encoding/pem"
"fmt"
"slices"

"github.com/hyperledger/fabric-chaincode-go/v2/pkg/attrmgr"
"github.com/hyperledger/fabric-protos-go-apiv2/msp"
Expand Down Expand Up @@ -143,12 +144,7 @@ func (c *ClientID) HasOUValue(OUValue string) (bool, error) {
return false, fmt.Errorf("cannot obtain an X509 certificate for the identity")
}

for _, OU := range x509Cert.Subject.OrganizationalUnit {
if OU == OUValue {
return true, nil
}
}
return false, nil
return slices.Contains(x509Cert.Subject.OrganizationalUnit, OUValue), nil
}

// GetX509Certificate returns the X509 certificate associated with the client,
Expand Down