Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-enterprise-base
Overview
Overview
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
base_platform_enterprise
gic-enterprise-base
Commits
a2423d57
Commit
a2423d57
authored
Sep 23, 2020
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登录拦截response status改动
parent
76ef9144
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
AuthInterceptor.java
.../java/com/gic/enterprise/interceptor/AuthInterceptor.java
+8
-0
No files found.
gic-enterprise-common/src/main/java/com/gic/enterprise/interceptor/AuthInterceptor.java
View file @
a2423d57
...
...
@@ -88,6 +88,8 @@ public class AuthInterceptor extends HandlerInterceptorAdapter {
return
true
;
}
if
(
userDetail
==
null
||
userDetail
.
getUserInfo
()
==
null
)
{
response
.
setStatus
(
6666
);
response
.
sendError
(
6666
,
"登录信息不存在,请登录"
);
throw
new
CommonException
(
ErrorCode
.
LOGIN_INVALID
.
getErrorCode
(),
"登录信息不存在,请登录"
);
}
request
.
setAttribute
(
"user"
,
userDetail
);
...
...
@@ -109,6 +111,8 @@ public class AuthInterceptor extends HandlerInterceptorAdapter {
//判断是否有权限
Map
<
String
,
Object
>
menuUrlMap
=
userDetail
.
getMenuUrlMap
();
if
(
menuUrlMap
==
null
||
menuUrlMap
.
isEmpty
())
{
response
.
setStatus
(
0003
);
response
.
sendError
(
0003
,
"sorry,您无该页面的访问权限,请联系超级管理员!"
);
throw
new
CommonException
(
ErrorCode
.
SYSTEM_ERROR
.
getErrorCode
(),
"sorry,您无该页面的访问权限,请联系超级管理员!"
);
}
...
...
@@ -116,12 +120,16 @@ public class AuthInterceptor extends HandlerInterceptorAdapter {
//说明是操作项
//如果匹配上了,说明是没权限
if
(
menuUrlMap
.
containsKey
(
uri
))
{
response
.
setStatus
(
0003
);
response
.
sendError
(
0003
,
"sorry,您无该页面的访问权限,请联系超级管理员!"
);
throw
new
CommonException
(
ErrorCode
.
SYSTEM_ERROR
.
getErrorCode
(),
"sorry,您无该页面的访问权限,请联系超级管理员!"
);
}
}
else
{
//说明是页面
//如果没有匹配上,说明没权限
if
(!
menuUrlMap
.
containsKey
(
uri
))
{
response
.
setStatus
(
0003
);
response
.
sendError
(
0003
,
"sorry,您无该页面的访问权限,请联系超级管理员!"
);
throw
new
CommonException
(
ErrorCode
.
SYSTEM_ERROR
.
getErrorCode
(),
"sorry,您无该页面的访问权限,请联系超级管理员!"
);
}
}
...
...
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