Skip to content

Commit

Permalink
Specify which identities should be hidden (resolves #53) (#54)
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Stone <sstone1@uk.ibm.com>
  • Loading branch information
Simon Stone committed Sep 21, 2020
1 parent d6beaea commit f0290e4
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions internal/pkg/console/console.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ type jsonIdentity struct {
CA []byte `json:"ca"`
MSPID string `json:"msp_id"`
Wallet string `json:"wallet"`
Hide bool `json:"hide"`
}

type components map[string]interface{}
Expand All @@ -83,18 +84,21 @@ type Console struct {
func New(organizations []*organization.Organization, orderer *orderer.Orderer, peers []*peer.Peer, cas []*ca.CA, port int32, curl string) (*Console, error) {
staticComponents := components{}
for _, organization := range organizations {
for _, orgIdentity := range organization.GetIdentities() {
id := strings.ToLower(orgIdentity.Name())
orgHide := organization == orderer.Organization()
for _, identity := range organization.GetIdentities() {
identityHide := orgHide || identity != organization.Admin()
id := strings.ToLower(identity.Name())
id = strings.ReplaceAll(id, " ", "")
staticComponents[id] = &jsonIdentity{
ID: id,
DisplayName: orgIdentity.Name(),
DisplayName: identity.Name(),
Type: "identity",
Certificate: orgIdentity.Certificate().Bytes(),
PrivateKey: orgIdentity.PrivateKey().Bytes(),
CA: orgIdentity.CA().Bytes(),
Certificate: identity.Certificate().Bytes(),
PrivateKey: identity.PrivateKey().Bytes(),
CA: identity.CA().Bytes(),
MSPID: organization.MSPID(),
Wallet: organization.Name(),
Hide: identityHide,
}
}
}
Expand Down

0 comments on commit f0290e4

Please sign in to comment.