1
0
mirror of https://github.com/bitwarden/server.git synced 2025-05-14 16:12:18 -05:00
bitwarden/src/Api/AdminConsole/Models/Response/PendingOrganizationAuthRequestResponseModel.cs

39 lines
1.5 KiB
C#

using System.ComponentModel.DataAnnotations;
using System.Reflection;
using Bit.Core.Auth.Models.Data;
using Bit.Core.Models.Api;
namespace Bit.Api.AdminConsole.Models.Response;
public class PendingOrganizationAuthRequestResponseModel : ResponseModel
{
public PendingOrganizationAuthRequestResponseModel(OrganizationAdminAuthRequest authRequest, string obj = "pending-org-auth-request") : base(obj)
{
if (authRequest == null)
{
throw new ArgumentNullException(nameof(authRequest));
}
Id = authRequest.Id;
UserId = authRequest.UserId;
OrganizationUserId = authRequest.OrganizationUserId;
Email = authRequest.Email;
PublicKey = authRequest.PublicKey;
RequestDeviceIdentifier = authRequest.RequestDeviceIdentifier;
RequestDeviceType = authRequest.RequestDeviceType.GetType().GetMember(authRequest.RequestDeviceType.ToString())
.FirstOrDefault()?.GetCustomAttribute<DisplayAttribute>()?.GetName();
RequestIpAddress = authRequest.RequestIpAddress;
CreationDate = authRequest.CreationDate;
}
public Guid Id { get; set; }
public Guid UserId { get; set; }
public Guid OrganizationUserId { get; set; }
public string Email { get; set; }
public string PublicKey { get; set; }
public string RequestDeviceIdentifier { get; set; }
public string RequestDeviceType { get; set; }
public string RequestIpAddress { get; set; }
public DateTime CreationDate { get; set; }
}