From 695cb6d76b838b1e4cb161bae335faa948dca12a Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期三, 27 十月 2021 13:16:19 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into satoken --- ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java | 29 ++++++++++++++++++----------- 1 files changed, 18 insertions(+), 11 deletions(-) diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java index 6ceb7ba..7a86393 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java @@ -1,5 +1,6 @@ package com.ruoyi.quartz.controller; +import cn.dev33.satoken.annotation.SaCheckPermission; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.core.controller.BaseController; @@ -14,7 +15,6 @@ import com.ruoyi.quartz.util.CronUtils; import org.quartz.SchedulerException; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; @@ -23,6 +23,7 @@ /** * 璋冨害浠诲姟淇℃伅鎿嶄綔澶勭悊 * + * @deprecated 3.4.0鍒犻櫎 杩佺Щ鑷硏xl-job * @author ruoyi */ @RestController @@ -35,7 +36,7 @@ /** * 鏌ヨ瀹氭椂浠诲姟鍒楄〃 */ - @PreAuthorize("@ss.hasPermi('monitor:job:list')") + @SaCheckPermission("monitor:job:list") @GetMapping("/list") public TableDataInfo list(SysJob sysJob) { @@ -45,7 +46,7 @@ /** * 瀵煎嚭瀹氭椂浠诲姟鍒楄〃 */ - @PreAuthorize("@ss.hasPermi('monitor:job:export')") + @SaCheckPermission("monitor:job:export") @Log(title = "瀹氭椂浠诲姟", businessType = BusinessType.EXPORT) @GetMapping("/export") public void export(SysJob sysJob, HttpServletResponse response) @@ -57,7 +58,7 @@ /** * 鑾峰彇瀹氭椂浠诲姟璇︾粏淇℃伅 */ - @PreAuthorize("@ss.hasPermi('monitor:job:query')") + @SaCheckPermission("monitor:job:query") @GetMapping(value = "/{jobId}") public AjaxResult getInfo(@PathVariable("jobId") Long jobId) { @@ -67,7 +68,7 @@ /** * 鏂板瀹氭椂浠诲姟 */ - @PreAuthorize("@ss.hasPermi('monitor:job:add')") + @SaCheckPermission("monitor:job:add") @Log(title = "瀹氭椂浠诲姟", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody SysJob job) throws SchedulerException, TaskException @@ -80,18 +81,21 @@ { return error("鏂板浠诲姟'" + job.getJobName() + "'澶辫触锛岀洰鏍囧瓧绗︿覆涓嶅厑璁�'rmi://'璋冪敤"); } + else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_LDAP)) + { + return error("鏂板浠诲姟'" + job.getJobName() + "'澶辫触锛岀洰鏍囧瓧绗︿覆涓嶅厑璁�'ldap://'璋冪敤"); + } else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.HTTP, Constants.HTTPS })) { return error("鏂板浠诲姟'" + job.getJobName() + "'澶辫触锛岀洰鏍囧瓧绗︿覆涓嶅厑璁�'http(s)//'璋冪敤"); } - job.setCreateBy(getUsername()); return toAjax(jobService.insertJob(job)); } /** * 淇敼瀹氭椂浠诲姟 */ - @PreAuthorize("@ss.hasPermi('monitor:job:edit')") + @SaCheckPermission("monitor:job:edit") @Log(title = "瀹氭椂浠诲姟", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody SysJob job) throws SchedulerException, TaskException @@ -104,18 +108,21 @@ { return error("淇敼浠诲姟'" + job.getJobName() + "'澶辫触锛岀洰鏍囧瓧绗︿覆涓嶅厑璁�'rmi://'璋冪敤"); } + else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_LDAP)) + { + return error("淇敼浠诲姟'" + job.getJobName() + "'澶辫触锛岀洰鏍囧瓧绗︿覆涓嶅厑璁�'ldap://'璋冪敤"); + } else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.HTTP, Constants.HTTPS })) { return error("淇敼浠诲姟'" + job.getJobName() + "'澶辫触锛岀洰鏍囧瓧绗︿覆涓嶅厑璁�'http(s)//'璋冪敤"); } - job.setUpdateBy(getUsername()); return toAjax(jobService.updateJob(job)); } /** * 瀹氭椂浠诲姟鐘舵�佷慨鏀� */ - @PreAuthorize("@ss.hasPermi('monitor:job:changeStatus')") + @SaCheckPermission("monitor:job:changeStatus") @Log(title = "瀹氭椂浠诲姟", businessType = BusinessType.UPDATE) @PutMapping("/changeStatus") public AjaxResult changeStatus(@RequestBody SysJob job) throws SchedulerException @@ -128,7 +135,7 @@ /** * 瀹氭椂浠诲姟绔嬪嵆鎵ц涓�娆� */ - @PreAuthorize("@ss.hasPermi('monitor:job:changeStatus')") + @SaCheckPermission("monitor:job:changeStatus") @Log(title = "瀹氭椂浠诲姟", businessType = BusinessType.UPDATE) @PutMapping("/run") public AjaxResult run(@RequestBody SysJob job) throws SchedulerException @@ -140,7 +147,7 @@ /** * 鍒犻櫎瀹氭椂浠诲姟 */ - @PreAuthorize("@ss.hasPermi('monitor:job:remove')") + @SaCheckPermission("monitor:job:remove") @Log(title = "瀹氭椂浠诲姟", businessType = BusinessType.DELETE) @DeleteMapping("/{jobIds}") public AjaxResult remove(@PathVariable Long[] jobIds) throws SchedulerException, TaskException -- Gitblit v1.9.3