mirror of
https://github.com/go-admin-team/go-admin.git
synced 2026-10-15 01:21:00 +00:00
fix🔒: require JWT and role check on /job/start and /job/remove
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.
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user