feat: 重构标准 Skill 管理与发布链路

- 统一标准 ZIP 导入导出与通用资源模型

- 收口分类范围权限和创建人查询

- 完善发布快照、审批幂等与数据库清理迁移
This commit is contained in:
2026-08-14 18:53:26 +08:00
parent 9be9bd7665
commit 77d66e1b42
91 changed files with 1660 additions and 10957 deletions

View File

@@ -7,14 +7,12 @@ import tech.easyflow.common.entity.LoginAccount;
import tech.easyflow.system.enums.CategoryResourceType;
import tech.easyflow.system.enums.ResourceAction;
import tech.easyflow.system.enums.VisibilityScope;
import tech.easyflow.system.entity.vo.RoleCategoryAccessSnapshot;
import tech.easyflow.system.permission.resource.VisibilityResource;
import tech.easyflow.system.service.CategoryPermissionService;
import tech.easyflow.system.service.SysDeptService;
import java.lang.reflect.Field;
import java.math.BigInteger;
import java.util.Set;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@@ -113,19 +111,16 @@ public class ResourceAccessServiceImplTest {
}
/**
* 验证 Skill 分类 ALL 范围可以读取其他创建者的未分类私有草稿。
* 验证 Skill 分类 ALL 范围也不能读取其他创建者的未分类私有草稿。
*/
@Test
public void allCategoryScopeShouldReadUnclassifiedPrivateSkill() {
public void allCategoryScopeShouldRejectUnclassifiedPrivateSkill() {
LoginAccount account = account(8, 80);
VisibilityResource resource = new TestVisibilityResource(
BigInteger.ONE, BigInteger.valueOf(7), BigInteger.valueOf(90), null,
VisibilityScope.PRIVATE.name());
Mockito.when(categoryPermissionService.getAccess(CategoryResourceType.SKILL.getCode(), account))
.thenReturn(new RoleCategoryAccessSnapshot(
CategoryResourceType.SKILL.getCode(), account.getId(), false, true, Set.of()));
assertTrue(service.canAccess(account, CategoryResourceType.SKILL, resource, ResourceAction.READ));
assertFalse(service.canAccess(account, CategoryResourceType.SKILL, resource, ResourceAction.READ));
assertFalse(service.canAccess(account, CategoryResourceType.SKILL, resource, ResourceAction.MANAGE));
}