Skip to content

Commit 3135bcc

Browse files
erda-botharverywxu
andauthored
batch cluster upgrade bugfix (#2304) (#2308)
Co-authored-by: xuwei <[email protected]>
1 parent 0c5b2de commit 3135bcc

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

modules/cmp/endpoints/cluster.go

+5-6
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626

2727
"github.com/erda-project/erda/apistructs"
2828
"github.com/erda-project/erda/modules/cmp/impl/ess"
29+
"github.com/erda-project/erda/modules/pkg/user"
2930
"github.com/erda-project/erda/pkg/http/httpserver"
3031
"github.com/erda-project/erda/pkg/http/httpserver/errorresp"
3132
"github.com/erda-project/erda/pkg/http/httputil"
@@ -93,19 +94,17 @@ func (e *Endpoints) BatchUpgradeEdgeCluster(ctx context.Context, r *http.Request
9394
logrus.Debugf("batch upgrade request header:%+v", r.Header)
9495

9596
// get identity info
96-
i, resp := e.GetIdentity(r)
97-
if resp != nil {
98-
err = fmt.Errorf("failed to get User-ID or Org-ID from request header")
97+
userID, err := user.GetUserID(r)
98+
if err != nil {
9999
return
100100
}
101101

102102
// permission check
103-
err = e.PermissionCheck(i.UserID, i.OrgID, "", apistructs.DeleteAction)
103+
err = e.PermissionCheck(userID.String(), "", "", apistructs.DeleteAction)
104104
if err != nil {
105-
return
106105
}
107106

108-
go e.clusters.BatchUpgradeEdgeCluster(req, i.UserID)
107+
go e.clusters.BatchUpgradeEdgeCluster(req, userID.String())
109108

110109
return mkResponse(apistructs.BatchUpgradeEdgeClusterResponse{
111110
Header: apistructs.Header{Success: true},

modules/cmp/endpoints/common.go

+1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ func (e *Endpoints) IsManager(userID string, scopeType apistructs.ScopeType, sco
7979
if err != nil {
8080
return err
8181
}
82+
logrus.Debugf("scopeRole: %+v", scopeRole)
8283
if scopeRole.Access {
8384
for _, role := range scopeRole.Roles {
8485
if e.bdl.CheckIfRoleIsManager(role) {

0 commit comments

Comments
 (0)