fix: 存储管理及菜单管理功能优化 (#52)

存储管理功能优化:
1、私钥脱敏修改为注解/数据库敏感字段加密
2、兼容私钥脱敏修改场景下的数据回带
3、修复存储配置禁用情况下修改报错 || -> &&

菜单管理优化:
1、非外链类型菜单兼容"/"路径
This commit is contained in:
kils
2024-04-24 16:52:21 +08:00
committed by GitHub
parent 79a3de8971
commit f17076e128
4 changed files with 36 additions and 29 deletions

View File

@@ -18,6 +18,7 @@ package top.continew.admin.webapi.system;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
@@ -27,6 +28,7 @@ import top.continew.admin.system.model.query.MenuQuery;
import top.continew.admin.system.model.req.MenuReq;
import top.continew.admin.system.model.resp.MenuResp;
import top.continew.admin.system.service.MenuService;
import top.continew.starter.core.constant.StringConstants;
import top.continew.starter.core.util.URLUtils;
import top.continew.starter.core.util.validate.ValidationUtils;
import top.continew.starter.extension.crud.annotation.CrudRequestMapping;
@@ -69,6 +71,11 @@ public class MenuController extends BaseController<MenuService, MenuResp, MenuRe
Boolean isExternal = ObjectUtil.defaultIfNull(req.getIsExternal(), false);
String path = req.getPath();
ValidationUtils.throwIf(isExternal && !URLUtils.isHttpUrl(path), "路由地址格式错误,请以 http:// 或 https:// 开头");
ValidationUtils.throwIf(!isExternal && URLUtils.isHttpUrl(path), "路由地址格式错误");
if (!isExternal) {
ValidationUtils.throwIf(URLUtils.isHttpUrl(path), "路由地址格式错误");
req.setPath(StrUtil.prependIfMissing(req.getPath(), StringConstants.SLASH));
req.setName(StrUtil.removePrefix(req.getName(), StringConstants.SLASH));
req.setComponent(StrUtil.removePrefix(req.getComponent(), StringConstants.SLASH));
}
}
}