Blame view

泰额版/Food Labeling Management Code/Yi.Abp.Net8/module/food-labeling-us/FoodLabeling.Application.Contracts/Constants/RoleAccessPermissionCodes.cs 1.05 KB
59e51671   “wangming”   1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
  namespace FoodLabeling.Application.Contracts.Constants;
  
  /// <summary>
  /// 角色「访问权限」勾选项编码(与前端约定一致,存库为 JSON 数组字符串)。
  /// </summary>
  public static class RoleAccessPermissionCodes
  {
      public const string ManageLabels = "manage_labels";
  
      public const string ManagePeople = "manage_people";
  
      public const string EditSettings = "edit_settings";
  
      public const string ManageProducts = "manage_products";
  
      public const string ViewReports = "view_reports";
  
      public const string ApproveBatches = "approve_batches";
  
      /// <summary>全部合法编码(顺序即 UI 展示顺序)</summary>
      public static readonly IReadOnlyList<string> All = new[]
      {
          ManageLabels,
          ManagePeople,
          EditSettings,
          ManageProducts,
          ViewReports,
          ApproveBatches
      };
  
      private static readonly HashSet<string> _allSet = new(All, StringComparer.Ordinal);
  
      public static bool IsKnown(string code) => !string.IsNullOrWhiteSpace(code) && _allSet.Contains(code.Trim());
  }