feat: 增加分类权限控制
- 新增角色分类授权模型与超级管理员配置接口 - 接入助手、插件、工作流、知识库、素材的分类可见性过滤 - 增加角色页分类权限树与插件多分类可见性支持
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
package tech.easyflow.system.enums;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public enum CategoryResourceType {
|
||||
|
||||
BOT("BOT"),
|
||||
PLUGIN("PLUGIN"),
|
||||
WORKFLOW("WORKFLOW"),
|
||||
KNOWLEDGE("KNOWLEDGE"),
|
||||
RESOURCE("RESOURCE");
|
||||
|
||||
private final String code;
|
||||
|
||||
CategoryResourceType(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public static CategoryResourceType from(String code) {
|
||||
if (code == null) {
|
||||
throw new IllegalArgumentException("resourceType不能为空");
|
||||
}
|
||||
String normalized = code.trim().toUpperCase(Locale.ROOT);
|
||||
return Arrays.stream(values())
|
||||
.filter(item -> item.code.equals(normalized))
|
||||
.findFirst()
|
||||
.orElseThrow(() -> new IllegalArgumentException("不支持的resourceType: " + code));
|
||||
}
|
||||
|
||||
public static List<String> allCodes() {
|
||||
return Arrays.stream(values()).map(CategoryResourceType::getCode).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package tech.easyflow.system.enums;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
|
||||
public enum CategoryScopeMode {
|
||||
|
||||
ALL("ALL"),
|
||||
CUSTOM("CUSTOM");
|
||||
|
||||
private final String code;
|
||||
|
||||
CategoryScopeMode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public static CategoryScopeMode from(String code) {
|
||||
if (code == null) {
|
||||
return CUSTOM;
|
||||
}
|
||||
String normalized = code.trim().toUpperCase(Locale.ROOT);
|
||||
return Arrays.stream(values())
|
||||
.filter(item -> item.code.equals(normalized))
|
||||
.findFirst()
|
||||
.orElseThrow(() -> new IllegalArgumentException("不支持的scopeMode: " + code));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user