mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
非超管获取菜单权限没有机构限制问题修复
This commit is contained in:
-3
@@ -8,7 +8,6 @@ import com.cf.imes.framework.common.pojo.CommonResult;
|
|||||||
import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
|
import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
|
||||||
import com.cf.imes.framework.security.config.SecurityProperties;
|
import com.cf.imes.framework.security.config.SecurityProperties;
|
||||||
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
||||||
import com.cf.imes.module.system.controller.admin.auth.vo.*;
|
|
||||||
import com.cf.imes.module.system.controller.admin.auth.vo.AuthLoginReqVO;
|
import com.cf.imes.module.system.controller.admin.auth.vo.AuthLoginReqVO;
|
||||||
import com.cf.imes.module.system.controller.admin.auth.vo.AuthPermissionInfoRespVO;
|
import com.cf.imes.module.system.controller.admin.auth.vo.AuthPermissionInfoRespVO;
|
||||||
import com.cf.imes.module.system.controller.admin.auth.vo.AuthSocialLoginReqVO;
|
import com.cf.imes.module.system.controller.admin.auth.vo.AuthSocialLoginReqVO;
|
||||||
@@ -118,9 +117,7 @@ public class AuthController {
|
|||||||
roles.removeIf(role -> !CommonStatusEnum.ENABLE.getStatus().equals(role.getStatus())); // 移除禁用的角色
|
roles.removeIf(role -> !CommonStatusEnum.ENABLE.getStatus().equals(role.getStatus())); // 移除禁用的角色
|
||||||
|
|
||||||
// 1.3 获得菜单列表
|
// 1.3 获得菜单列表
|
||||||
//Set<Long> menuIds = permissionService.getRoleMenuListByRoleId(convertSet(roles, RoleDO::getId));
|
|
||||||
Set<Long> menuIds = permissionService.getRoleMenuListByRoleId2(convertSet(roles, RoleDO::getId));
|
Set<Long> menuIds = permissionService.getRoleMenuListByRoleId2(convertSet(roles, RoleDO::getId));
|
||||||
//List<MenuDO> menuList = menuService.getMenuList(menuIds);
|
|
||||||
List<MenuDO> menuList = menuService.getMenuList1(menuIds);
|
List<MenuDO> menuList = menuService.getMenuList1(menuIds);
|
||||||
menuList.removeIf(menu -> !CommonStatusEnum.ENABLE.getStatus().equals(menu.getStatus())); // 移除禁用的菜单
|
menuList.removeIf(menu -> !CommonStatusEnum.ENABLE.getStatus().equals(menu.getStatus())); // 移除禁用的菜单
|
||||||
|
|
||||||
|
|||||||
+14
-3
@@ -23,6 +23,19 @@ public interface RoleMenuMapper extends BaseMapperX<RoleMenuDO> {
|
|||||||
return selectList(RoleMenuDO::getRoleId, roleIds);
|
return selectList(RoleMenuDO::getRoleId, roleIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 基于角色id列表和组织id查询角色菜单列表
|
||||||
|
*
|
||||||
|
* @param roleIds
|
||||||
|
* @param organId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
default List<RoleMenuDO> selectListByRoleIdsAndOrganId(Collection<Long> roleIds, Long organId) {
|
||||||
|
return selectList(new LambdaQueryWrapperX<RoleMenuDO>()
|
||||||
|
.eq(RoleMenuDO::getOrganId, organId)
|
||||||
|
.in(RoleMenuDO::getRoleId, roleIds));
|
||||||
|
}
|
||||||
|
|
||||||
default List<RoleMenuDO> selectListByMenuId(Long menuId) {
|
default List<RoleMenuDO> selectListByMenuId(Long menuId) {
|
||||||
return selectList(RoleMenuDO::getMenuId, menuId);
|
return selectList(RoleMenuDO::getMenuId, menuId);
|
||||||
}
|
}
|
||||||
@@ -43,8 +56,6 @@ public interface RoleMenuMapper extends BaseMapperX<RoleMenuDO> {
|
|||||||
|
|
||||||
@OrganIgnore
|
@OrganIgnore
|
||||||
default List<RoleMenuDO> selectListByRoleIdWithOrganAdmin(Collection<Long> roleIds) {
|
default List<RoleMenuDO> selectListByRoleIdWithOrganAdmin(Collection<Long> roleIds) {
|
||||||
return selectList(new LambdaQueryWrapperX<RoleMenuDO>()
|
return selectListByRoleIdsAndOrganId(roleIds, InternalRoleConstants.INTERNAL_ROLE_ORGAN_ID);
|
||||||
.eq(RoleMenuDO::getOrganId, InternalRoleConstants.INTERNAL_ROLE_ORGAN_ID)
|
|
||||||
.in(RoleMenuDO::getRoleId, roleIds));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -265,7 +265,7 @@ public class PermissionServiceImpl implements PermissionService {
|
|||||||
return convertSet(menuService.getMenuList(), MenuDO::getId);
|
return convertSet(menuService.getMenuList(), MenuDO::getId);
|
||||||
}
|
}
|
||||||
// 如果是非管理员的情况下,获得拥有的菜单编号
|
// 如果是非管理员的情况下,获得拥有的菜单编号
|
||||||
List<RoleMenuDO> from = roleMenuMapper.selectListByRoleId(roleIds);
|
List<RoleMenuDO> from = roleMenuMapper.selectListByRoleIdsAndOrganId(roleIds, OrganContextHolder.getOrganId());
|
||||||
return convertSet(from, RoleMenuDO::getMenuId);
|
return convertSet(from, RoleMenuDO::getMenuId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user