forked from integrated_whb/integrated_whb
路由菜单按权限加载
parent
8061ea3e72
commit
27d2f26bfc
|
@ -152,7 +152,8 @@ public class MainController extends BaseController {
|
|||
if (null == session.getAttribute(USERNAME + Const.SESSION_ALLMENU)) {
|
||||
allRouteList = routeService.listAllMenuJur("0");
|
||||
if (Tools.notEmpty(roleRights)) {
|
||||
allRouteList = this.readRoute(USERNAME, allRouteList, roleRights, arrayRoleRights, shiroSet, uqxmap, uqxmap2); //根据角色权限获取本权限的菜单列表
|
||||
boolean isRoot = true;
|
||||
allRouteList = this.readRoute(USERNAME, allRouteList, roleRights, arrayRoleRights, shiroSet, uqxmap, uqxmap2, isRoot); //根据角色权限获取本权限的菜单列表
|
||||
}
|
||||
session.setAttribute(USERNAME + Const.SESSION_ALLMENU, allRouteList); //菜单权限放入session中
|
||||
} else {
|
||||
|
@ -173,10 +174,17 @@ public class MainController extends BaseController {
|
|||
* @param uqxmap2 副职角色的增删改查权限
|
||||
* @return
|
||||
*/
|
||||
public List<Route> readRoute(String USERNAME, List<Route> menuList, String roleRights, List<String> arrayRoleRights, Collection<String> shiroSet, Map<String, String> uqxmap, Map<String, List<String>> uqxmap2) {
|
||||
for (int i = 0; i < menuList.size(); i++) {
|
||||
public List<Route> readRoute(String USERNAME, List<Route> menuList, String roleRights, List<String> arrayRoleRights, Collection<String> shiroSet, Map<String, String> uqxmap, Map<String, List<String>> uqxmap2, Boolean isRoot) {
|
||||
int size = menuList.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
Boolean b1 = RightsHelper.testRights(roleRights, menuList.get(i).getROUTE_ID());
|
||||
menuList.get(i).setHasMenu(b1); //赋予主职角色菜单权限
|
||||
if (!b1 && isRoot){
|
||||
menuList.remove(i);
|
||||
i--;
|
||||
size--;
|
||||
continue;
|
||||
}
|
||||
if (!b1 && null != arrayRoleRights) {
|
||||
for (int n = 0; n < arrayRoleRights.size(); n++) {
|
||||
if (RightsHelper.testRights(arrayRoleRights.get(n), menuList.get(i).getROUTE_ID())) {
|
||||
|
@ -245,7 +253,7 @@ public class MainController extends BaseController {
|
|||
}
|
||||
}
|
||||
if (menuList.get(i).isHasMenu()) { //判断是否有此菜单权限
|
||||
this.readRoute(USERNAME, menuList.get(i).getChildren(), roleRights, arrayRoleRights, shiroSet, uqxmap, uqxmap2);//是:继续排查其子菜单
|
||||
this.readRoute(USERNAME, menuList.get(i).getChildren(), roleRights, arrayRoleRights, shiroSet, uqxmap, uqxmap2, false);//是:继续排查其子菜单
|
||||
}
|
||||
}
|
||||
return menuList;
|
||||
|
|
Loading…
Reference in New Issue