build: continew-starter 2.13.3 => 2.13.4

1.移除 continew-starter-security-password 模块依赖及相关配置(已融合到 security-crypto 模块)
2.更新 continew-starter-security-crypto 模块配置
3.BaseController 增加跳过 DICT、DICT_TREE 接口权限处理
4.EnableCrudRestController => EnableCrudApi
5.调整 CRUD 相关 Controller API 接口配置,增加 DICT 或 DICT_TREE 接口,移除原 CommonController 接口
This commit is contained in:
2025-07-27 09:36:29 +08:00
parent d95bb15beb
commit e6169bdb6c
21 changed files with 97 additions and 134 deletions

View File

@@ -102,12 +102,6 @@
<artifactId>continew-starter-auth-justauth</artifactId>
</dependency>
<!-- ContiNew Starter 安全模块 - 密码编码器 -->
<dependency>
<groupId>top.continew.starter</groupId>
<artifactId>continew-starter-security-password</artifactId>
</dependency>
<!-- ContiNew Starter 安全模块 - 加密 -->
<dependency>
<groupId>top.continew.starter</groupId>

View File

@@ -73,6 +73,10 @@ public class BaseController<S extends BaseService<L, D, Q, C>, L, D, Q, C> exten
return;
}
}
// 不需要校验 DICT、DICT_TREE 接口权限
if (Api.DICT.equals(crudApi.value()) || Api.DICT_TREE.equals(crudApi.value())) {
return;
}
// 校验权限例如创建用户接口POST /system/user => 校验 system:user:create 权限
String permissionPrefix = CrudApiPermissionPrefixCache.get(targetClass);
String apiName = getApiName(crudApi.value());

View File

@@ -19,14 +19,16 @@ package top.continew.admin.common.config.doc;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaCheckRole;
import cn.dev33.satoken.annotation.SaMode;
import cn.hutool.core.text.CharSequenceUtil;
import org.springframework.web.method.HandlerMethod;
import top.continew.admin.common.base.controller.BaseController;
import top.continew.admin.common.config.crud.CrudApiPermissionPrefixCache;
import top.continew.starter.core.constant.StringConstants;
import top.continew.starter.extension.crud.annotation.CrudApi;
import top.continew.starter.extension.crud.annotation.CrudRequestMapping;
import top.continew.starter.extension.crud.enums.Api;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
@@ -160,18 +162,21 @@ public class OperationDescriptionCustomizer {
*
* @param handlerMethod 处理程序方法
* @return 拼接好的权限信息字符串
* @see BaseController#preHandle(CrudApi, Object[], Method, Class)
*/
private String getCrudPermissionInfo(HandlerMethod handlerMethod) {
CrudRequestMapping crudRequestMapping = handlerMethod.getBeanType().getAnnotation(CrudRequestMapping.class);
Class<?> targetClass = handlerMethod.getBeanType();
CrudRequestMapping crudRequestMapping = targetClass.getAnnotation(CrudRequestMapping.class);
CrudApi crudApi = handlerMethod.getMethodAnnotation(CrudApi.class);
if (crudRequestMapping == null || crudApi == null) {
return StringConstants.EMPTY;
}
String path = crudRequestMapping.value();
String prefix = String.join(StringConstants.COLON, CharSequenceUtil.splitTrim(path, StringConstants.SLASH));
if (Api.DICT.equals(crudApi.value()) || Api.DICT_TREE.equals(crudApi.value())) {
return StringConstants.EMPTY;
}
String permissionPrefix = CrudApiPermissionPrefixCache.get(targetClass);
String apiName = BaseController.getApiName(crudApi.value());
String permission = "%s:%s".formatted(prefix, apiName.toLowerCase());
String permission = "%s:%s".formatted(permissionPrefix, apiName.toLowerCase());
return "<font style=\"color:red\" class=\"light-red\">CRUD 权限校验:</font></br><font style=\"color:red\" class=\"light-red\">方法:</font><font style=\"color:red\" class=\"light-red\">" + permission + "</font>";
}
}