Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
tool
/
xxl-job
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 649170d5
authored
May 08, 2019
by
xuxueli
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
update document
1 parent
802e3d3c
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
43 additions
and
43 deletions
xxl-job-admin/src/main/java/com/xxl/job/admin/controller/IndexController.java
xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobApiController.java
xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java
xxl-job-admin/src/main/java/com/xxl/job/admin/controller/UserController.java
xxl-job-admin/src/main/java/com/xxl/job/admin/controller/annotation/PermessionLimit.java → xxl-job-admin/src/main/java/com/xxl/job/admin/controller/annotation/PermissionLimit.java
xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/PermissionInterceptor.java
xxl-job-admin/src/main/java/com/xxl/job/admin/controller/IndexController.java
View file @
649170d
package
com
.
xxl
.
job
.
admin
.
controller
;
package
com
.
xxl
.
job
.
admin
.
controller
;
import
com.xxl.job.admin.controller.annotation.Perm
e
ssionLimit
;
import
com.xxl.job.admin.controller.annotation.Perm
i
ssionLimit
;
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 {
...
@@ -50,7 +50,7 @@ public class IndexController {
}
}
@RequestMapping
(
"/toLogin"
)
@RequestMapping
(
"/toLogin"
)
@Perm
e
ssionLimit
(
limit
=
false
)
@Perm
i
ssionLimit
(
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 {
...
@@ -60,7 +60,7 @@ public class IndexController {
@RequestMapping
(
value
=
"login"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"login"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
@Perm
e
ssionLimit
(
limit
=
false
)
@Perm
i
ssionLimit
(
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 {
...
@@ -68,7 +68,7 @@ public class IndexController {
@RequestMapping
(
value
=
"logout"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"logout"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
@Perm
e
ssionLimit
(
limit
=
false
)
@Perm
i
ssionLimit
(
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
);
}
}
...
...
xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobApiController.java
View file @
649170d
package
com
.
xxl
.
job
.
admin
.
controller
;
package
com
.
xxl
.
job
.
admin
.
controller
;
import
com.xxl.job.admin.controller.annotation.Perm
e
ssionLimit
;
import
com.xxl.job.admin.controller.annotation.Perm
i
ssionLimit
;
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 {
...
@@ -25,7 +25,7 @@ public class JobApiController implements InitializingBean {
}
}
@RequestMapping
(
AdminBiz
.
MAPPING
)
@RequestMapping
(
AdminBiz
.
MAPPING
)
@Perm
e
ssionLimit
(
limit
=
false
)
@Perm
i
ssionLimit
(
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
);
}
}
...
...
xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java
View file @
649170d
...
@@ -131,7 +131,7 @@ public class JobInfoController {
...
@@ -131,7 +131,7 @@ public class JobInfoController {
@RequestMapping
(
"/trigger"
)
@RequestMapping
(
"/trigger"
)
@ResponseBody
@ResponseBody
//@Perm
e
ssionLimit(limit = false)
//@Perm
i
ssionLimit(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
)
{
...
...
xxl-job-admin/src/main/java/com/xxl/job/admin/controller/UserController.java
View file @
649170d
package
com
.
xxl
.
job
.
admin
.
controller
;
package
com
.
xxl
.
job
.
admin
.
controller
;
import
com.xxl.job.admin.controller.annotation.Perm
e
ssionLimit
;
import
com.xxl.job.admin.controller.annotation.Perm
i
ssionLimit
;
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 {
...
@@ -35,7 +35,7 @@ public class UserController {
private
XxlJobGroupDao
xxlJobGroupDao
;
private
XxlJobGroupDao
xxlJobGroupDao
;
@RequestMapping
@RequestMapping
@Perm
e
ssionLimit
(
adminuser
=
true
)
@Perm
i
ssionLimit
(
adminuser
=
true
)
public
String
index
(
Model
model
)
{
public
String
index
(
Model
model
)
{
// 执行器列表
// 执行器列表
...
@@ -47,7 +47,7 @@ public class UserController {
...
@@ -47,7 +47,7 @@ public class UserController {
@RequestMapping
(
"/pageList"
)
@RequestMapping
(
"/pageList"
)
@ResponseBody
@ResponseBody
@Perm
e
ssionLimit
(
adminuser
=
true
)
@Perm
i
ssionLimit
(
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 {
...
@@ -66,7 +66,7 @@ public class UserController {
@RequestMapping
(
"/add"
)
@RequestMapping
(
"/add"
)
@ResponseBody
@ResponseBody
@Perm
e
ssionLimit
(
adminuser
=
true
)
@Perm
i
ssionLimit
(
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 {
...
@@ -101,7 +101,7 @@ public class UserController {
@RequestMapping
(
"/update"
)
@RequestMapping
(
"/update"
)
@ResponseBody
@ResponseBody
@Perm
e
ssionLimit
(
adminuser
=
true
)
@Perm
i
ssionLimit
(
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 {
...
@@ -129,7 +129,7 @@ public class UserController {
@RequestMapping
(
"/remove"
)
@RequestMapping
(
"/remove"
)
@ResponseBody
@ResponseBody
@Perm
e
ssionLimit
(
adminuser
=
true
)
@Perm
i
ssionLimit
(
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
...
...
xxl-job-admin/src/main/java/com/xxl/job/admin/controller/annotation/Perm
e
ssionLimit.java
→
xxl-job-admin/src/main/java/com/xxl/job/admin/controller/annotation/Perm
i
ssionLimit.java
View file @
649170d
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
Perm
essionLimit
{
public
@interface
Perm
issionLimit
{
/**
/**
* 登录拦截 (默认拦截)
* 登录拦截 (默认拦截)
*/
*/
boolean
limit
()
default
true
;
boolean
limit
()
default
true
;
/**
/**
* 要求管理员权限
* 要求管理员权限
*
*
* @return
* @return
*/
*/
boolean
adminuser
()
default
false
;
boolean
adminuser
()
default
false
;
}
}
\ No newline at end of file
\ No newline at end of file
xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/PermissionInterceptor.java
View file @
649170d
package
com
.
xxl
.
job
.
admin
.
controller
.
interceptor
;
package
com
.
xxl
.
job
.
admin
.
controller
.
interceptor
;
import
com.xxl.job.admin.controller.annotation.Perm
e
ssionLimit
;
import
com.xxl.job.admin.controller.annotation.Perm
i
ssionLimit
;
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 {
...
@@ -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
;
Perm
essionLimit
permission
=
method
.
getMethodAnnotation
(
Perme
ssionLimit
.
class
);
Perm
issionLimit
permission
=
method
.
getMethodAnnotation
(
Permi
ssionLimit
.
class
);
if
(
permission
!=
null
)
{
if
(
permission
!=
null
)
{
needLogin
=
permission
.
limit
();
needLogin
=
permission
.
limit
();
needAdminuser
=
permission
.
adminuser
();
needAdminuser
=
permission
.
adminuser
();
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment