update document

master
xuxueli 6 years ago
parent 802e3d3cce
commit 649170d58d
  1. 8
      xxl-job-admin/src/main/java/com/xxl/job/admin/controller/IndexController.java
  2. 4
      xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobApiController.java
  3. 2
      xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java
  4. 12
      xxl-job-admin/src/main/java/com/xxl/job/admin/controller/UserController.java
  5. 56
      xxl-job-admin/src/main/java/com/xxl/job/admin/controller/annotation/PermissionLimit.java
  6. 4
      xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/PermissionInterceptor.java

@ -1,6 +1,6 @@
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.XxlJobService;
import com.xxl.job.core.biz.model.ReturnT;
@ -50,7 +50,7 @@ public class IndexController {
}
@RequestMapping("/toLogin")
@PermessionLimit(limit=false)
@PermissionLimit(limit=false)
public String toLogin(HttpServletRequest request, HttpServletResponse response) {
if (loginService.ifLogin(request, response) != null) {
return "redirect:/";
@ -60,7 +60,7 @@ public class IndexController {
@RequestMapping(value="login", method=RequestMethod.POST)
@ResponseBody
@PermessionLimit(limit=false)
@PermissionLimit(limit=false)
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;
return loginService.login(request, response, userName, password, ifRem);
@ -68,7 +68,7 @@ public class IndexController {
@RequestMapping(value="logout", method=RequestMethod.POST)
@ResponseBody
@PermessionLimit(limit=false)
@PermissionLimit(limit=false)
public ReturnT<String> logout(HttpServletRequest request, HttpServletResponse response){
return loginService.logout(request, response);
}

@ -1,6 +1,6 @@
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.core.biz.AdminBiz;
import org.springframework.beans.factory.InitializingBean;
@ -25,7 +25,7 @@ public class JobApiController implements InitializingBean {
}
@RequestMapping(AdminBiz.MAPPING)
@PermessionLimit(limit=false)
@PermissionLimit(limit=false)
public void api(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
XxlJobDynamicScheduler.invokeAdminService(request, response);
}

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

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

@ -1,29 +1,29 @@
package com.xxl.job.admin.controller.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* 权限限制
* @author xuxueli 2015-12-12 18:29:02
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface PermessionLimit {
/**
* 登录拦截 (默认拦截)
*/
boolean limit() default true;
/**
* 要求管理员权限
*
* @return
*/
boolean adminuser() default false;
package com.xxl.job.admin.controller.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* 权限限制
* @author xuxueli 2015-12-12 18:29:02
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface PermissionLimit {
/**
* 登录拦截 (默认拦截)
*/
boolean limit() default true;
/**
* 要求管理员权限
*
* @return
*/
boolean adminuser() default false;
}

@ -1,6 +1,6 @@
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.util.I18nUtil;
import com.xxl.job.admin.service.LoginService;
@ -34,7 +34,7 @@ public class PermissionInterceptor extends HandlerInterceptorAdapter {
boolean needLogin = true;
boolean needAdminuser = false;
HandlerMethod method = (HandlerMethod)handler;
PermessionLimit permission = method.getMethodAnnotation(PermessionLimit.class);
PermissionLimit permission = method.getMethodAnnotation(PermissionLimit.class);
if (permission!=null) {
needLogin = permission.limit();
needAdminuser = permission.adminuser();

Loading…
Cancel
Save