Files
IOT_API/Service/Interface/System/IAuditRecorder.cs
T
dengbolingandClaude Sonnet 4.6 6aca0297bb feat: 网关管理模块 + RBAC权限认证 + 组织架构 + 审计日志
- 网关管理:GatewayEntity/Service/Controller CRUD + 测试连接;设备 GatewayId 外键关联
- JWT 认证:登录签发 Token(权限编码写入 Claims)、RequirePermission 权限过滤器、CurrentUser 上下文
- RBAC:用户/角色/权限实体与 CRUD,预定义 4 角色 + 6 权限种子(admin/admin123)
- 组织架构:sys_org 固定层级树(公司/实验室/部门/班组白夜班),层级校验,用户挂 OrgId/岗位/技能标签
- 数据权限:角色 DataScope(全部/本组织及下级),用户列表按组织子树过滤
- 防锁死保护:禁止删/禁自己,保证至少一名活跃管理员,角色摘除 user:manage 前校验
- 审计日志:AuditRecorder 接入设备增删改/指令下发/登录登出/组织变更,AuditController 查询
- 设备指令下发按网关表取连接参数;设备列表支持 gatewayId/productId 筛选

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-09-10 17:31:39 +08:00

24 lines
1.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
namespace Service.Interface
{
/// <summary>
/// 审计日志记录器:业务服务注入后一行代码记录关键操作(操作人/角色自动取自当前登录上下文)
/// </summary>
public interface IAuditRecorder
{
/// <summary>
/// 记录一条审计日志
/// </summary>
/// <param name="operationType">操作类型(Create/Update/Delete/Login/Command等)</param>
/// <param name="operationTarget">操作对象(IotDevice/Gateway/User/Role等)</param>
/// <param name="targetId">操作对象Id</param>
/// <param name="deviceId">关联设备Id0=无关)</param>
/// <param name="oldValue">操作前值(JSON 或摘要)</param>
/// <param name="newValue">操作后值(JSON 或摘要)</param>
/// <param name="ip">操作IPnull 自动留空)</param>
/// <param name="description">操作描述</param>
Task RecordAsync(string operationType, string operationTarget, long targetId,
long deviceId = 0, string? oldValue = null, string? newValue = null,
string? ip = null, string? description = null);
}
}