ProvinceSessionContext.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using Hotline.Configurations;
  2. using XF.Domain.Authentications;
  3. namespace Hotline.Authentications
  4. {
  5. public class ProvinceSessionContext : ISessionContext
  6. {
  7. public ProvinceSessionContext(CityProvinceConfiguration config)
  8. {
  9. UserId = config.UserId;
  10. UserName = config.UserName;
  11. OrgId = config.OrgId;
  12. OrgName = config.OrgName;
  13. OrgLevel = 1;
  14. }
  15. //取消写入
  16. /// <summary>
  17. /// Id of current tenant or null for host
  18. /// </summary>
  19. public string? UserId { get; }
  20. /// <summary>
  21. /// Id of current user or throw Exception for guest
  22. /// </summary>
  23. /// <exception cref="AuthenticationException"></exception>
  24. public string RequiredUserId => UserId ?? throw new ArgumentNullException();
  25. //取消写入
  26. public string? UserName { get; }
  27. public string? Phone { get; }
  28. /// <summary>
  29. /// Roles
  30. /// </summary>
  31. public string[] Roles { get; }
  32. public string? OrgId { get; set; }
  33. public string RequiredOrgId => OrgId ?? throw new ArgumentNullException();
  34. public string? OrgName { get; set; }
  35. public int OrgLevel { get; set; }
  36. public string? OrgAreaCode { get; set; }
  37. public bool OrgIsCenter { get; set; }
  38. /// <summary>
  39. /// 部门行政区划名称
  40. /// </summary>
  41. public string? OrgAreaName { get; set; }
  42. public string? AreaId { get; }
  43. public string? ClientId { get; }
  44. /// <summary>
  45. /// 工号
  46. /// </summary>
  47. public string? StaffNo { get; }
  48. }
  49. }