From 13a52c65dfc4cb238120c19daf2f2708ed20cecc Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Thu, 8 Oct 2026 20:00:11 +0800 Subject: [PATCH] =?UTF-8?q?fix=F0=9F=94=92:=20require=20JWT=20and=20role?= =?UTF-8?q?=20check=20on=20/job/start=20and=20/job/remove?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The two routes were registered on the bare v1 group, so they ran without any authentication. Mount them on a group with the same JWT and AuthCheckRole middleware as /sysjob. --- app/jobs/router/sys_job.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/jobs/router/sys_job.go b/app/jobs/router/sys_job.go index 3c6d44d5..bb057e90 100644 --- a/app/jobs/router/sys_job.go +++ b/app/jobs/router/sys_job.go @@ -29,6 +29,9 @@ func registerSysJobRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddlew } sysJob := apis.SysJob{} - v1.GET("/job/remove/:id", sysJob.RemoveJobForService) - v1.GET("/job/start/:id", sysJob.StartJobForService) + r2 := v1.Group("/job").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) + { + r2.GET("/remove/:id", sysJob.RemoveJobForService) + r2.GET("/start/:id", sysJob.StartJobForService) + } }