FakeSessionContext.cs 1.5 KB

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