diff --git a/src/main/java/com/zcloud/controller/system/MainController.java b/src/main/java/com/zcloud/controller/system/MainController.java index 0952579..45b2f69 100644 --- a/src/main/java/com/zcloud/controller/system/MainController.java +++ b/src/main/java/com/zcloud/controller/system/MainController.java @@ -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 readRoute(String USERNAME, List menuList, String roleRights, List arrayRoleRights, Collection shiroSet, Map uqxmap, Map> uqxmap2) { - for (int i = 0; i < menuList.size(); i++) { + public List readRoute(String USERNAME, List menuList, String roleRights, List arrayRoleRights, Collection shiroSet, Map uqxmap, Map> 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;