update document

pull/10/head
xuxueli 6 years ago
parent 802e3d3cce
commit 649170d58d

@ -1,6 +1,6 @@
package com.xxl.job.admin.controller; package com.xxl.job.admin.controller;
import com.xxl.job.admin.controller.annotation.PermessionLimit; import com.xxl.job.admin.controller.annotation.PermissionLimit;
import com.xxl.job.admin.service.LoginService; import com.xxl.job.admin.service.LoginService;
import com.xxl.job.admin.service.XxlJobService; import com.xxl.job.admin.service.XxlJobService;
import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.biz.model.ReturnT;
@ -50,7 +50,7 @@ public class IndexController {
} }
@RequestMapping("/toLogin") @RequestMapping("/toLogin")
@PermessionLimit(limit=false) @PermissionLimit(limit=false)
public String toLogin(HttpServletRequest request, HttpServletResponse response) { public String toLogin(HttpServletRequest request, HttpServletResponse response) {
if (loginService.ifLogin(request, response) != null) { if (loginService.ifLogin(request, response) != null) {
return "redirect:/"; return "redirect:/";
@ -60,7 +60,7 @@ public class IndexController {
@RequestMapping(value="login", method=RequestMethod.POST) @RequestMapping(value="login", method=RequestMethod.POST)
@ResponseBody @ResponseBody
@PermessionLimit(limit=false) @PermissionLimit(limit=false)
public ReturnT<String> loginDo(HttpServletRequest request, HttpServletResponse response, String userName, String password, String ifRemember){ public ReturnT<String> loginDo(HttpServletRequest request, HttpServletResponse response, String userName, String password, String ifRemember){
boolean ifRem = (ifRemember!=null && ifRemember.trim().length()>0 && "on".equals(ifRemember))?true:false; boolean ifRem = (ifRemember!=null && ifRemember.trim().length()>0 && "on".equals(ifRemember))?true:false;
return loginService.login(request, response, userName, password, ifRem); return loginService.login(request, response, userName, password, ifRem);
@ -68,7 +68,7 @@ public class IndexController {
@RequestMapping(value="logout", method=RequestMethod.POST) @RequestMapping(value="logout", method=RequestMethod.POST)
@ResponseBody @ResponseBody
@PermessionLimit(limit=false) @PermissionLimit(limit=false)
public ReturnT<String> logout(HttpServletRequest request, HttpServletResponse response){ public ReturnT<String> logout(HttpServletRequest request, HttpServletResponse response){
return loginService.logout(request, response); return loginService.logout(request, response);
} }

@ -1,6 +1,6 @@
package com.xxl.job.admin.controller; package com.xxl.job.admin.controller;
import com.xxl.job.admin.controller.annotation.PermessionLimit; import com.xxl.job.admin.controller.annotation.PermissionLimit;
import com.xxl.job.admin.core.schedule.XxlJobDynamicScheduler; import com.xxl.job.admin.core.schedule.XxlJobDynamicScheduler;
import com.xxl.job.core.biz.AdminBiz; import com.xxl.job.core.biz.AdminBiz;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
@ -25,7 +25,7 @@ public class JobApiController implements InitializingBean {
} }
@RequestMapping(AdminBiz.MAPPING) @RequestMapping(AdminBiz.MAPPING)
@PermessionLimit(limit=false) @PermissionLimit(limit=false)
public void api(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { public void api(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
XxlJobDynamicScheduler.invokeAdminService(request, response); XxlJobDynamicScheduler.invokeAdminService(request, response);
} }

@ -131,7 +131,7 @@ public class JobInfoController {
@RequestMapping("/trigger") @RequestMapping("/trigger")
@ResponseBody @ResponseBody
//@PermessionLimit(limit = false) //@PermissionLimit(limit = false)
public ReturnT<String> triggerJob(int id, String executorParam) { public ReturnT<String> triggerJob(int id, String executorParam) {
// force cover job param // force cover job param
if (executorParam == null) { if (executorParam == null) {

@ -1,6 +1,6 @@
package com.xxl.job.admin.controller; package com.xxl.job.admin.controller;
import com.xxl.job.admin.controller.annotation.PermessionLimit; import com.xxl.job.admin.controller.annotation.PermissionLimit;
import com.xxl.job.admin.core.model.XxlJobGroup; import com.xxl.job.admin.core.model.XxlJobGroup;
import com.xxl.job.admin.core.model.XxlJobUser; import com.xxl.job.admin.core.model.XxlJobUser;
import com.xxl.job.admin.core.util.I18nUtil; import com.xxl.job.admin.core.util.I18nUtil;
@ -35,7 +35,7 @@ public class UserController {
private XxlJobGroupDao xxlJobGroupDao; private XxlJobGroupDao xxlJobGroupDao;
@RequestMapping @RequestMapping
@PermessionLimit(adminuser = true) @PermissionLimit(adminuser = true)
public String index(Model model) { public String index(Model model) {
// 执行器列表 // 执行器列表
@ -47,7 +47,7 @@ public class UserController {
@RequestMapping("/pageList") @RequestMapping("/pageList")
@ResponseBody @ResponseBody
@PermessionLimit(adminuser = true) @PermissionLimit(adminuser = true)
public Map<String, Object> pageList(@RequestParam(required = false, defaultValue = "0") int start, public Map<String, Object> pageList(@RequestParam(required = false, defaultValue = "0") int start,
@RequestParam(required = false, defaultValue = "10") int length, @RequestParam(required = false, defaultValue = "10") int length,
String username, int role) { String username, int role) {
@ -66,7 +66,7 @@ public class UserController {
@RequestMapping("/add") @RequestMapping("/add")
@ResponseBody @ResponseBody
@PermessionLimit(adminuser = true) @PermissionLimit(adminuser = true)
public ReturnT<String> add(XxlJobUser xxlJobUser) { public ReturnT<String> add(XxlJobUser xxlJobUser) {
// valid username // valid username
@ -101,7 +101,7 @@ public class UserController {
@RequestMapping("/update") @RequestMapping("/update")
@ResponseBody @ResponseBody
@PermessionLimit(adminuser = true) @PermissionLimit(adminuser = true)
public ReturnT<String> update(HttpServletRequest request, XxlJobUser xxlJobUser) { public ReturnT<String> update(HttpServletRequest request, XxlJobUser xxlJobUser) {
// avoid opt login seft // avoid opt login seft
@ -129,7 +129,7 @@ public class UserController {
@RequestMapping("/remove") @RequestMapping("/remove")
@ResponseBody @ResponseBody
@PermessionLimit(adminuser = true) @PermissionLimit(adminuser = true)
public ReturnT<String> remove(HttpServletRequest request, int id) { public ReturnT<String> remove(HttpServletRequest request, int id) {
// avoid opt login seft // avoid opt login seft

@ -1,29 +1,29 @@
package com.xxl.job.admin.controller.annotation; package com.xxl.job.admin.controller.annotation;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
/** /**
* *
* @author xuxueli 2015-12-12 18:29:02 * @author xuxueli 2015-12-12 18:29:02
*/ */
@Target(ElementType.METHOD) @Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
public @interface PermessionLimit { public @interface PermissionLimit {
/** /**
* () * ()
*/ */
boolean limit() default true; boolean limit() default true;
/** /**
* *
* *
* @return * @return
*/ */
boolean adminuser() default false; boolean adminuser() default false;
} }

@ -1,6 +1,6 @@
package com.xxl.job.admin.controller.interceptor; package com.xxl.job.admin.controller.interceptor;
import com.xxl.job.admin.controller.annotation.PermessionLimit; import com.xxl.job.admin.controller.annotation.PermissionLimit;
import com.xxl.job.admin.core.model.XxlJobUser; import com.xxl.job.admin.core.model.XxlJobUser;
import com.xxl.job.admin.core.util.I18nUtil; import com.xxl.job.admin.core.util.I18nUtil;
import com.xxl.job.admin.service.LoginService; import com.xxl.job.admin.service.LoginService;
@ -34,7 +34,7 @@ public class PermissionInterceptor extends HandlerInterceptorAdapter {
boolean needLogin = true; boolean needLogin = true;
boolean needAdminuser = false; boolean needAdminuser = false;
HandlerMethod method = (HandlerMethod)handler; HandlerMethod method = (HandlerMethod)handler;
PermessionLimit permission = method.getMethodAnnotation(PermessionLimit.class); PermissionLimit permission = method.getMethodAnnotation(PermissionLimit.class);
if (permission!=null) { if (permission!=null) {
needLogin = permission.limit(); needLogin = permission.limit();
needAdminuser = permission.adminuser(); needAdminuser = permission.adminuser();

Loading…
Cancel
Save