From 30f28c42e18bd6f1b03509bc751ba9563a5217c0 Mon Sep 17 00:00:00 2001 From: lewis <747342561@qq.com> Date: Tue, 2 Nov 2021 10:16:35 +0800 Subject: [PATCH] debug task signed in --- routers/repo/cloudbrain.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index a49d4026f..e4b90a6d9 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -321,6 +321,11 @@ func CloudBrainShow(ctx *context.Context) { func CloudBrainDebug(ctx *context.Context) { var jobID = ctx.Params(":jobid") + if !ctx.IsSigned { + log.Error("the user has not signed in") + ctx.Error(http.StatusForbidden, "","the user has not signed in") + return + } task, err := models.GetCloudbrainByJobID(jobID) if err != nil { ctx.ServerError("GetCloudbrainByJobID failed", err) @@ -333,6 +338,11 @@ func CloudBrainDebug(ctx *context.Context) { func CloudBrainCommitImage(ctx *context.Context, form auth.CommitImageCloudBrainForm) { var jobID = ctx.Params(":jobid") + if !ctx.IsSigned { + log.Error("the user has not signed in") + ctx.Error(http.StatusForbidden, "","the user has not signed in") + return + } task, err := models.GetCloudbrainByJobID(jobID) if err != nil { ctx.JSON(200, map[string]string{ @@ -365,6 +375,11 @@ func CloudBrainCommitImage(ctx *context.Context, form auth.CommitImageCloudBrain func CloudBrainStop(ctx *context.Context) { var jobID = ctx.Params(":jobid") + if !ctx.IsSigned { + log.Error("the user has not signed in") + ctx.Error(http.StatusForbidden, "","the user has not signed in") + return + } task, err := models.GetCloudbrainByJobID(jobID) if err != nil { ctx.ServerError("GetCloudbrainByJobID failed", err)