Skip to content

Commit

Permalink
AddOrgToConsortium shouldn't allow adding org that already exists
Browse files Browse the repository at this point in the history
This resulted in overwriting the existing org definition.

FAB-17645

Signed-off-by: Will Lahti <wtlahti@us.ibm.com>
  • Loading branch information
wlahti authored and sykesm committed Mar 23, 2020
1 parent 0e178b4 commit 67cb2df
Show file tree
Hide file tree
Showing 2 changed files with 281 additions and 152 deletions.
4 changes: 4 additions & 0 deletions pkg/config/consortiums.go
Expand Up @@ -37,6 +37,10 @@ func AddOrgToConsortium(config *cb.Config, org Organization, consortium string)
return fmt.Errorf("consortium '%s' does not exist", consortium)
}

if _, ok := consortiumGroup.Groups[org.Name]; ok {
return fmt.Errorf("org '%s' already defined in consortium '%s'", org.Name, consortium)
}

consortiumGroup.Groups[org.Name], err = newOrgConfigGroup(org)
if err != nil {
return fmt.Errorf("failed to create consortium org: %v", err)
Expand Down

0 comments on commit 67cb2df

Please sign in to comment.