Skip to content

Commit

Permalink
user batch register bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
tangbin committed Jul 13, 2020
1 parent 32638ac commit b52eb84
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions pkg/apigateway/handler/misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,18 +297,6 @@ func (mh *MiscHandler) DoBatchUserRegister(ctx context.Context, w http.ResponseW
return
}

if _, ok := names[name]; ok {
e := httperrors.NewClientError("row %d duplicate name %s", rowIdx, name)
httperrors.JsonClientError(w, e)
return
} else {
names[name] = true
_, err := modules.UsersV3.Get(s, name, nil)
if err == nil {
continue
}
}

domainId, ok := domains[domain]
if !ok {
if len(domain) == 0 {
Expand All @@ -327,6 +315,18 @@ func (mh *MiscHandler) DoBatchUserRegister(ctx context.Context, w http.ResponseW
domains[domain] = id
}

if _, ok := names[name+"/"+domainId]; ok {
e := httperrors.NewClientError("row %d duplicate name %s", rowIdx, name)
httperrors.JsonClientError(w, e)
return
} else {
names[name+"/"+domainId] = true
_, err := modules.UsersV3.Get(s, name, nil)
if err == nil {
continue
}
}

user := jsonutils.NewDict()
user.Add(jsonutils.NewString(name), "name")
user.Add(jsonutils.NewString(domainId), "domain_id")
Expand Down

0 comments on commit b52eb84

Please sign in to comment.