permissions: fixed update org status failing for invalid orgs

This commit is contained in:
vsmk98 2019-05-10 21:56:28 +08:00
parent 26279ea288
commit 927f789c1e
1 changed files with 5 additions and 1 deletions

View File

@ -310,9 +310,13 @@ func (s *QuorumControlsAPI) checkPendingOp(orgId string, pinterf *pbind.PermInte
func (s *QuorumControlsAPI) checkOrgStatus(orgId string, op uint8) (ExecStatus, error) {
org := types.OrgInfoMap.GetOrg(orgId)
if org == nil {
return ErrOrgDoesNotExists, errors.New("org does not exist")
}
// check if its a master org. operation is allowed only if its a master org
if org.Level.Cmp(big.NewInt(1)) != 0 {
return ErrNotMasterOrg, errors.New("Org not a master org")
return ErrNotMasterOrg, errors.New("org not a master org")
}
if !((op == 3 && org.Status == types.OrgApproved) || (op == 5 && org.Status == types.OrgSuspended)) {