Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-platform-auth
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-platform-auth
Commits
e81c77f7
Commit
e81c77f7
authored
Mar 24, 2020
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
应用菜单权限优化:根据菜单code获取对应的菜单
parent
9edf0a74
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
11 deletions
+22
-11
MenuController.java
...main/java/com/gic/auth/web/controller/MenuController.java
+22
-11
No files found.
gic-platform-auth-web/src/main/java/com/gic/auth/web/controller/MenuController.java
View file @
e81c77f7
...
...
@@ -74,14 +74,7 @@ public class MenuController {
LOGGER
.
info
(
"查询登录用户的应用的菜单参数:{}-{}-{}"
,
currentMenu
,
appId
,
menuCode
);
Integer
userId
=
UserDetailUtils
.
getUserDetail
().
getUserId
();
Integer
enterpriseId
=
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
();
if
(
StringUtils
.
isBlank
(
appId
))
{
//根据menuCode去查询对应的appId
ServiceResponse
<
MenuDTO
>
menuDTOServiceResponse
=
menuApiService
.
getMenuByMenuCode
(
menuCode
);
if
(
menuDTOServiceResponse
.
isSuccess
())
{
MenuDTO
tempDTO
=
menuDTOServiceResponse
.
getResult
();
appId
=
tempDTO
.
getProject
();
}
}
appId
=
getAppId
(
appId
,
menuCode
);
ServiceResponse
<
List
<
MenuDTO
>>
userMenu
=
this
.
menuApiService
.
getUserMenuOfApp
(
enterpriseId
,
userId
,
currentMenu
,
appId
);
if
(
userMenu
.
isSuccess
())
{
...
...
@@ -91,8 +84,10 @@ public class MenuController {
}
@RequestMapping
(
"login-collaborator-menu-of-app"
)
public
RestResponse
getCollaboratorMenu
(
String
appId
)
{
public
RestResponse
getCollaboratorMenu
(
String
appId
,
String
menuCode
)
{
LOGGER
.
info
(
"查询登录用户的协作应用的菜单参数:{}-{}"
,
appId
,
menuCode
);
UserDetail
userDetail
=
UserDetailUtils
.
getUserDetail
();
appId
=
getAppId
(
appId
,
menuCode
);
ServiceResponse
<
List
<
MenuDTO
>>
userMenu
=
this
.
collaboratorApiService
.
getCollaboratorMenuPage
(
userDetail
.
getEnterpriseId
(),
userDetail
.
getUserInfo
().
getPhoneNumber
(),
appId
);
if
(
userMenu
.
isSuccess
())
{
...
...
@@ -102,8 +97,10 @@ public class MenuController {
}
@RequestMapping
(
"login-collaborator-operation-item"
)
public
RestResponse
getCollaboratorOperationItem
(
String
appId
)
{
public
RestResponse
getCollaboratorOperationItem
(
String
appId
,
String
menuCode
)
{
LOGGER
.
info
(
"查询登录用户的协作应用的操作项参数:{}-{}"
,
appId
,
menuCode
);
UserDetail
userDetail
=
UserDetailUtils
.
getUserDetail
();
appId
=
getAppId
(
appId
,
menuCode
);
boolean
isSuperAdmin
=
userDetail
.
getUserInfo
().
getSuperAdmin
().
intValue
()
==
1
;
ServiceResponse
<
List
<
MenuDTO
>>
userMenu
=
this
.
collaboratorApiService
.
getCollaboratorOperationItem
(
userDetail
.
getEnterpriseId
(),
userDetail
.
getUserInfo
().
getPhoneNumber
(),
appId
,
isSuperAdmin
);
...
...
@@ -134,8 +131,10 @@ public class MenuController {
* @return com.gic.commons.webapi.reponse.RestResponse
*/
@RequestMapping
(
"login-user-operation-item-of-app"
)
public
RestResponse
loginUserOperationItemOfApp
(
String
appId
)
{
public
RestResponse
loginUserOperationItemOfApp
(
String
appId
,
String
menuCode
)
{
LOGGER
.
info
(
"登陆用户没有权限的操作项列表数据:{}-{}"
,
appId
,
menuCode
);
Integer
userId
=
UserDetailUtils
.
getUserDetail
().
getUserId
();
appId
=
getAppId
(
appId
,
menuCode
);
ServiceResponse
<
List
<
MenuDTO
>>
menuList
=
this
.
menuApiService
.
getNoAuthOperationItemOfApp
(
userId
,
""
);
List
<
UserOperationItemAuthVO
>
resultList
=
new
ArrayList
<>();
if
(
menuList
.
isSuccess
())
{
...
...
@@ -223,4 +222,16 @@ public class MenuController {
return
result
;
}
private
String
getAppId
(
String
appId
,
String
menuCode
)
{
if
(
StringUtils
.
isBlank
(
appId
))
{
//根据menuCode去查询对应的appId
ServiceResponse
<
MenuDTO
>
menuDTOServiceResponse
=
menuApiService
.
getMenuByMenuCode
(
menuCode
);
if
(
menuDTOServiceResponse
.
isSuccess
())
{
MenuDTO
tempDTO
=
menuDTOServiceResponse
.
getResult
();
appId
=
tempDTO
.
getProject
();
}
}
return
appId
;
}
}
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