- 在菜单系统中新增 RenderType、FormDefinitionId 和 RuntimeViewMode 字段 - 实现自定义表单菜单类型的组件映射和验证逻辑 - 为分片上传相关端点添加 file:upload 权限控制 - 为桶和文件夹操作添加 bucket:write 和 file:write 权限控制 - 为文件共享功能添加 file-share:write 权限控制 - 为文件读取操作添加 file:read 权限控制 - 扩展 AI 模型提供商枚举,支持更多模型供应商 - 在 AI 模型创建和更新时添加枚举值验证 - 重构工作流按钮权限检查逻辑,使用统一的权限码查询方式 - 为 JSON 格式文档添加提取器支持 - 增强表单数据派生服务,支持自定义表单关联解析 - 为表单数据添加按表单定义 ID 的索引优化 - 添加聊天消息搜索和上下文获取的集成测试 - 修正删除菜单端点的 ID 类型从 Guid 改为 long
59 lines
2.3 KiB
C#
59 lines
2.3 KiB
C#
namespace BuildFlow.Architecture.Tests;
|
||
|
||
using Xunit;
|
||
|
||
/// <summary>
|
||
/// BuildFlow 低代码按钮权限架构约束。按钮运行时需要查 platform 权限时,
|
||
/// 必须通过目标模块 CQRS Query 调用,不能在 Host 注册 in-process service bridge。
|
||
/// </summary>
|
||
public class BuildFlowButtonCqrsArchitectureTests
|
||
{
|
||
[Fact]
|
||
public void BuildFlowButtonPermissionShouldNotUseHostServiceBridge()
|
||
{
|
||
var repoRoot = FindRepoRoot();
|
||
var sourceFiles = Directory
|
||
.EnumerateFiles(Path.Combine(repoRoot.FullName, "src"), "*.cs", SearchOption.AllDirectories)
|
||
.Where(path => !ContainsPathSegment(path, "bin") && !ContainsPathSegment(path, "obj"))
|
||
.Select(path => new
|
||
{
|
||
RelativePath = Path.GetRelativePath(repoRoot.FullName, path).Replace('\\', '/'),
|
||
Text = File.ReadAllText(path),
|
||
})
|
||
.Where(file =>
|
||
file.Text.Contains("IBuildFlowButtonPermissionChecker", StringComparison.Ordinal) ||
|
||
file.Text.Contains("InProcessBuildFlowButtonPermissionChecker", StringComparison.Ordinal))
|
||
.Select(file => file.RelativePath)
|
||
.Order(StringComparer.Ordinal)
|
||
.ToArray();
|
||
|
||
Assert.True(
|
||
sourceFiles.Length == 0,
|
||
"BuildFlow 按钮权限不能通过 Host service/interface bridge 串联 platform;请在 workflow 命令处理链路中通过 IMediator 发送 platform Query。当前残留:" +
|
||
Environment.NewLine +
|
||
string.Join(Environment.NewLine, sourceFiles));
|
||
}
|
||
|
||
private static DirectoryInfo FindRepoRoot()
|
||
{
|
||
var current = new DirectoryInfo(AppContext.BaseDirectory);
|
||
while (current is not null)
|
||
{
|
||
if (File.Exists(Path.Combine(current.FullName, "BuildFlow.slnx")))
|
||
{
|
||
return current;
|
||
}
|
||
|
||
current = current.Parent;
|
||
}
|
||
|
||
throw new InvalidOperationException("无法定位 BuildFlow.slnx,架构测试无法确定仓库边界。");
|
||
}
|
||
|
||
private static bool ContainsPathSegment(string path, string segment)
|
||
{
|
||
return path.Split(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar)
|
||
.Any(part => string.Equals(part, segment, StringComparison.Ordinal));
|
||
}
|
||
}
|