AdoS8ExceptionActionRole.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. namespace Admin.NET.Plugin.AiDOP.Entity.S8;
  2. /// <summary>
  3. /// S8-ACTION-PERMISSION-1:异常单「动作 ↔ 角色」授权行。
  4. ///
  5. /// <para><b>身份是 (tenant_id, action_code, role_id)</b>,不含 factory ——
  6. /// 工厂从来不是隔离维度(真库 <c>factory_ref_id = 1000</c> 横跨两个租户)。</para>
  7. ///
  8. /// <para><b>为什么 S8 自己存一份,而不是继续用 <c>SysRoleMenu</c></b>:
  9. /// 平台那条链的语义是「这个角色能看见哪个菜单按钮」,租户校验只覆盖菜单、不覆盖角色,
  10. /// 于是别家租户的角色可以把 S8 能力带进本租户(见 <see cref="Infrastructure.S8.S8TenantRoleResolver"/>
  11. /// 的取证)。本表把「谁能对异常单做什么」这个问题收回 S8 自己回答,
  12. /// <c>tenant_id</c> 是行上的一等字段,跨租户在结构上就不成立。</para>
  13. ///
  14. /// <para><b>只存 Action ↔ Role,不存 Action ↔ User</b>:角色成员继续由平台的角色管理维护,
  15. /// S8 不再造第二套「谁属于哪个角色」。</para>
  16. /// </summary>
  17. [SugarTable("ado_s8_exception_action_role", "S8 异常动作角色授权")]
  18. [SugarIndex("uk_s8_action_role", nameof(TenantId), OrderByType.Asc, nameof(ActionCode), OrderByType.Asc, nameof(RoleId), OrderByType.Asc, IsUnique = true)]
  19. public class AdoS8ExceptionActionRole
  20. {
  21. [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true, ColumnDataType = "bigint")]
  22. public long Id { get; set; }
  23. /// <summary>租户。<b>唯一安全边界</b>。</summary>
  24. [SugarColumn(ColumnName = "tenant_id", ColumnDataType = "bigint")]
  25. public long TenantId { get; set; }
  26. /// <summary>动作码,取值必须在 <c>S8ExceptionActionCatalog</c> 内;不在目录 = 未知动作 = 拒绝。</summary>
  27. [SugarColumn(ColumnName = "action_code", Length = 64)]
  28. public string ActionCode { get; set; } = string.Empty;
  29. /// <summary>被授权的角色(<c>SysRole.Id</c>)。写入时校验该角色属于 <see cref="TenantId"/>。</summary>
  30. [SugarColumn(ColumnName = "role_id", ColumnDataType = "bigint")]
  31. public long RoleId { get; set; }
  32. [SugarColumn(ColumnName = "created_at")]
  33. public DateTime CreatedAt { get; set; } = DateTime.Now;
  34. [SugarColumn(ColumnName = "created_by", Length = 64, IsNullable = true)]
  35. public string? CreatedBy { get; set; }
  36. }