Merge pull request #991 from wansir/app-management

fix: add missing parameter
This commit is contained in:
KubeSphere CI Bot
2019-10-16 14:27:44 +08:00
committed by GitHub
3 changed files with 10 additions and 4 deletions

View File

@@ -391,6 +391,8 @@ func CreateApp(req *restful.Request, resp *restful.Response) {
return
}
createAppRequest.Username = req.HeaderParameter(constants.UserNameHeader)
validate, _ := strconv.ParseBool(req.QueryParameter("validate"))
var result interface{}
@@ -431,8 +433,8 @@ func CreateAppVersion(req *restful.Request, resp *restful.Response) {
return
}
// override app id
appId := req.PathParameter("app")
createAppVersionRequest.AppId = appId
createAppVersionRequest.AppId = req.PathParameter("app")
createAppVersionRequest.Username = req.HeaderParameter(constants.UserNameHeader)
validate, _ := strconv.ParseBool(req.QueryParameter("validate"))

View File

@@ -152,7 +152,7 @@ func CreateApp(request *CreateAppRequest) (*CreateAppResponse, error) {
if request.Isv != "" {
createAppRequest.Isv = &wrappers.StringValue{Value: request.Isv}
}
resp, err := op.App().CreateApp(openpitrix.SystemContext(), createAppRequest)
resp, err := op.App().CreateApp(openpitrix.ContextWithUsername(request.Username), createAppRequest)
if err != nil {
klog.Error(err)
return nil, err
@@ -254,7 +254,7 @@ func CreateAppVersion(request *CreateAppVersionRequest) (*CreateAppVersionRespon
createAppVersionRequest.Package = &wrappers.BytesValue{Value: request.Package}
}
resp, err := op.App().CreateAppVersion(openpitrix.SystemContext(), createAppVersionRequest)
resp, err := op.App().CreateAppVersion(openpitrix.ContextWithUsername(request.Username), createAppVersionRequest)
if err != nil {
klog.Error(err)
return nil, err

View File

@@ -288,6 +288,8 @@ type CreateAppRequest struct {
// optional, vmbased/helm
VersionType string `json:"version_type,omitempty"`
Username string `json:"-"`
}
type CreateAppResponse struct {
@@ -413,6 +415,8 @@ type CreateAppVersionRequest struct {
// optional: vmbased/helm
Type string `json:"type,omitempty"`
Username string `json:"-"`
}
type GetAppVersionFilesRequest struct {