S8PermissionCatalog.cs 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. namespace Admin.NET.Plugin.AiDOP.Const.S8;
  2. /// <summary>
  3. /// S8 权限点条目(Catalog 真源,不依赖数据库)。
  4. /// </summary>
  5. public sealed class S8PermissionItem
  6. {
  7. public string Code { get; init; } = string.Empty;
  8. public string Label { get; init; } = string.Empty;
  9. public string Group { get; init; } = string.Empty;
  10. public int SortNo { get; init; }
  11. /// <summary>
  12. /// S8-P0-4-API-AUTHORIZATION-1:已废弃的历史能力码。
  13. /// <para>不删除、不从种子移除 —— 对应 <c>SysMenu</c> 行与 <c>SysRoleMenu</c> 授权已存在于各环境,
  14. /// 删除属破坏性数据变更。标记后:目录仍列出(便于运维识别),但**任何 Action 都不得引用**,
  15. /// 由 <c>S8AuthorizationGuardTests</c> 强制。</para>
  16. /// </summary>
  17. public bool Deprecated { get; init; }
  18. }
  19. /// <summary>
  20. /// S8 权限点目录(B0 阶段静态 catalog;后续 B2 矩阵 / B3 v-auth / B4 后端兜底统一从此读取)。
  21. /// 命名规范:s8:&lt;resource&gt;:&lt;action&gt;
  22. /// </summary>
  23. public static class S8PermissionCatalog
  24. {
  25. public const string GroupException = "exception";
  26. public const string GroupVerification = "verification";
  27. public const string GroupConfig = "config";
  28. public const string GroupDashboard = "dashboard";
  29. public const string GroupDebug = "debug";
  30. // ───────── S8-P0-4-API-AUTHORIZATION-1:capability 级权限码常量 ─────────
  31. // 只在此处声明字面量;Controller 一律引用常量,杜绝手写字符串拼错导致「声明了但永远匹配不到」。
  32. public const string ExceptionRead = "s8:exception:read";
  33. public const string ExceptionCreate = "s8:exception:create";
  34. public const string ExceptionAssign = "s8:exception:assign";
  35. public const string ExceptionClaim = "s8:exception:claim";
  36. public const string ExceptionStart = "s8:exception:start";
  37. public const string ExceptionReject = "s8:exception:reject";
  38. public const string ExceptionUpgrade = "s8:exception:upgrade";
  39. public const string ExceptionClose = "s8:exception:close";
  40. public const string ExceptionComment = "s8:exception:comment";
  41. public const string VerificationSubmit = "s8:verification:submit";
  42. public const string VerificationApprove = "s8:verification:approve";
  43. public const string VerificationReject = "s8:verification:reject";
  44. public const string ConfigRead = "s8:config:read";
  45. public const string ConfigOperatorBind = "s8:config:operator:bind";
  46. public const string ConfigRoleWrite = "s8:config:role:write";
  47. public const string ConfigWatchRule = "s8:config:watch-rule";
  48. public const string ConfigDataSource = "s8:config:data-source";
  49. public const string ConfigExceptionType = "s8:config:exception-type";
  50. public const string ConfigNotification = "s8:config:notification";
  51. public const string ConfigScene = "s8:config:scene";
  52. public const string ConfigKpi = "s8:config:kpi";
  53. public const string ConfigDashboard = "s8:config:dashboard";
  54. public const string DashboardRead = "s8:dashboard:read";
  55. public const string DebugRun = "s8:debug:run";
  56. private static readonly IReadOnlyList<S8PermissionItem> _all = new List<S8PermissionItem>
  57. {
  58. new() { Code = "s8:exception:read", Label = "查看异常", Group = GroupException, SortNo = 10 },
  59. new() { Code = "s8:exception:create", Label = "主动提报", Group = GroupException, SortNo = 20 },
  60. new() { Code = "s8:exception:assign", Label = "分派异常", Group = GroupException, SortNo = 30 },
  61. new() { Code = "s8:exception:claim", Label = "认领异常", Group = GroupException, SortNo = 40 },
  62. new() { Code = "s8:exception:start", Label = "开始处理", Group = GroupException, SortNo = 50 },
  63. new() { Code = "s8:exception:reject", Label = "驳回异常", Group = GroupException, SortNo = 60 },
  64. new() { Code = "s8:exception:upgrade", Label = "升级异常", Group = GroupException, SortNo = 70 },
  65. // S8-P0-4:S8 没有独立「关闭异常」接口 —— 关闭是 approve-verification 走状态机
  66. // PENDING_VERIFICATION → CLOSED 的结果(S8StatusRules 无 CLOSE 动作)。
  67. // 该码自始无对应 Action,标记为 deprecated;既有 SysMenu 行与授权保持不动。
  68. new() { Code = "s8:exception:close", Label = "关闭异常", Group = GroupException, SortNo = 80, Deprecated = true },
  69. new() { Code = "s8:verification:submit", Label = "提交复检", Group = GroupVerification, SortNo = 110 },
  70. new() { Code = "s8:verification:approve", Label = "检验通过", Group = GroupVerification, SortNo = 120 },
  71. new() { Code = "s8:verification:reject", Label = "检验退回", Group = GroupVerification, SortNo = 130 },
  72. new() { Code = "s8:exception:comment", Label = "补充说明", Group = GroupException, SortNo = 90 },
  73. new() { Code = "s8:config:read", Label = "查看配置", Group = GroupConfig, SortNo = 210 },
  74. new() { Code = "s8:config:operator:bind", Label = "维护操作员绑定", Group = GroupConfig, SortNo = 220 },
  75. new() { Code = "s8:config:role:write", Label = "维护角色权限", Group = GroupConfig, SortNo = 230 },
  76. new() { Code = "s8:config:watch-rule", Label = "维护监控规则", Group = GroupConfig, SortNo = 240 },
  77. new() { Code = "s8:config:data-source", Label = "维护数据源", Group = GroupConfig, SortNo = 250 },
  78. new() { Code = "s8:config:exception-type", Label = "维护异常类型", Group = GroupConfig, SortNo = 260 },
  79. new() { Code = "s8:config:notification", Label = "维护通知分层", Group = GroupConfig, SortNo = 270 },
  80. new() { Code = "s8:config:scene", Label = "维护场景配置", Group = GroupConfig, SortNo = 280 },
  81. new() { Code = "s8:config:kpi", Label = "维护KPI目标值", Group = GroupConfig, SortNo = 290 },
  82. new() { Code = "s8:config:dashboard", Label = "维护大屏卡片", Group = GroupConfig, SortNo = 300 },
  83. new() { Code = "s8:dashboard:read", Label = "查看看板", Group = GroupDashboard, SortNo = 310 },
  84. new() { Code = "s8:debug:run", Label = "运维调试接口", Group = GroupDebug, SortNo = 900 },
  85. };
  86. public static IReadOnlyList<S8PermissionItem> All => _all;
  87. }