Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
R
restful
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李永强
restful
Commits
41012341
Commit
41012341
authored
Oct 24, 2019
by
李永强
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整功能
parent
2659e062
Pipeline
#218
canceled with stages
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
11 deletions
+19
-11
LoginIntercept.java
...ain/java/com/restful/common/intercept/LoginIntercept.java
+5
-6
Menu.java
src/main/java/com/restful/domain/Menu.java
+14
-5
No files found.
src/main/java/com/restful/common/intercept/LoginIntercept.java
View file @
41012341
...
@@ -76,7 +76,7 @@ public class LoginIntercept implements HandlerInterceptor {
...
@@ -76,7 +76,7 @@ public class LoginIntercept implements HandlerInterceptor {
returnJson
(
response
,
result
);
returnJson
(
response
,
result
);
return
false
;
return
false
;
}
}
if
(!
getJurisdictionByRoles
(
user
,
request
.
getRequestURL
().
toString
()))
{
if
(!
getJurisdictionByRoles
(
user
,
request
.
getRequestURL
().
toString
()
,
request
.
getMethod
()
))
{
ApiResult
result
=
new
ApiResult
(
Constants
.
FAIL
,
"No access to this interface"
);
ApiResult
result
=
new
ApiResult
(
Constants
.
FAIL
,
"No access to this interface"
);
returnJson
(
response
,
result
);
returnJson
(
response
,
result
);
return
false
;
return
false
;
...
@@ -100,7 +100,7 @@ public class LoginIntercept implements HandlerInterceptor {
...
@@ -100,7 +100,7 @@ public class LoginIntercept implements HandlerInterceptor {
}
}
}
}
private
boolean
getJurisdictionByRoles
(
User
user
,
String
requestUrl
)
{
private
boolean
getJurisdictionByRoles
(
User
user
,
String
requestUrl
,
String
method
)
{
if
(
user
==
null
)
if
(
user
==
null
)
return
false
;
return
false
;
List
<
Role
>
roleList
=
user
.
getRoleList
();
List
<
Role
>
roleList
=
user
.
getRoleList
();
...
@@ -110,11 +110,10 @@ public class LoginIntercept implements HandlerInterceptor {
...
@@ -110,11 +110,10 @@ public class LoginIntercept implements HandlerInterceptor {
if
(
RoleTable
.
admin
.
getId
().
equals
(
role
.
getId
()))
if
(
RoleTable
.
admin
.
getId
().
equals
(
role
.
getId
()))
return
true
;
return
true
;
Role
complexRole
=
jurisdictionService
.
findMenusByRoleId
(
role
.
getId
());
Role
complexRole
=
jurisdictionService
.
findMenusByRoleId
(
role
.
getId
());
for
(
Menu
menu
:
complexRole
.
getMenuList
())
{
if
(
complexRole
.
getMenuList
().
stream
().
if
(
requestUrl
.
indexOf
(
menu
.
getUrl
())
>
0
)
anyMatch
(
menu
->
menu
.
getMethod
().
toUpperCase
().
equals
(
method
)
&&
requestUrl
.
contains
(
menu
.
getUrl
()))
)
return
true
;
return
true
;
}
}
}
return
false
;
return
false
;
}
}
...
...
src/main/java/com/restful/domain/Menu.java
View file @
41012341
...
@@ -3,7 +3,8 @@ package com.restful.domain;
...
@@ -3,7 +3,8 @@ package com.restful.domain;
public
class
Menu
extends
BaseInfo
{
public
class
Menu
extends
BaseInfo
{
private
String
url
;
private
String
url
;
private
String
remark
;
//接口描述
private
String
method
;
private
String
describe
;
public
String
getUrl
()
{
public
String
getUrl
()
{
return
url
;
return
url
;
...
@@ -13,11 +14,19 @@ public class Menu extends BaseInfo {
...
@@ -13,11 +14,19 @@ public class Menu extends BaseInfo {
this
.
url
=
url
;
this
.
url
=
url
;
}
}
public
String
get
Remark
()
{
public
String
get
Method
()
{
return
remark
;
return
method
;
}
}
public
void
setRemark
(
String
remark
)
{
public
void
setMethod
(
String
method
)
{
this
.
remark
=
remark
;
this
.
method
=
method
;
}
public
String
getDescribe
()
{
return
describe
;
}
public
void
setDescribe
(
String
describe
)
{
this
.
describe
=
describe
;
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment