|
@@ -110,6 +110,21 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IR
|
|
|
if (!AuthUtil.isAdministrator() && administratorCount > 0L) {
|
|
|
throw new ServiceException("无权配置超管角色!");
|
|
|
}
|
|
|
+
|
|
|
+ /*超级管理员角色,不能删除角色管理菜单(避免超管误删角色管理菜单,导致菜单消失不可查看)*/
|
|
|
+ if (roleIds.contains(1123598816738675201L)) {
|
|
|
+ /*角色管理菜单ids*/
|
|
|
+ String[] arrRoleMenu = {"1123598815738675308", "1123598815738675241", "1123598815738675242", "1123598815738675243", "1123598815738675244"};
|
|
|
+ long var = menuIds.stream()
|
|
|
+ .map(menuId -> menuId.split("---")[0])
|
|
|
+ .filter(id -> Arrays.asList(arrRoleMenu).contains(id))
|
|
|
+ .count();
|
|
|
+
|
|
|
+ if (arrRoleMenu.length != var) {
|
|
|
+ throw new ServiceException("后管菜单权限【权限管理-角色管理】中的菜单无权进行更改,请重新配置!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 防止越权配置管理员角色
|
|
|
Long adminCount = baseMapper.selectCount(Wrappers.<Role>query().lambda().eq(Role::getRoleAlias, RoleConstant.ADMIN).in(Role::getId, roleIds));
|
|
|
if (!AuthUtil.isAdmin() && adminCount > 0L) {
|
|
@@ -120,7 +135,7 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IR
|
|
|
|
|
|
// 组装配置-后台
|
|
|
List<RoleMenu> roleMenus = new ArrayList<>();
|
|
|
- if (menuIds != null && menuIds.size() >= 1) {
|
|
|
+ if (menuIds.size() >= 1) {
|
|
|
roleIds.forEach(roleId -> menuIds.forEach(menuId -> {
|
|
|
RoleMenu roleMenu = new RoleMenu();
|
|
|
roleMenu.setRoleId(roleId);
|