Files
server/src/Core/Models/Api/Response/ProfileResponseModel.cs

38 lines
1.3 KiB
C#
Raw Normal View History

2015-12-08 22:57:38 -05:00
using System;
2017-03-08 21:45:08 -05:00
using Bit.Core.Models.Table;
2017-03-02 21:51:03 -05:00
using System.Collections.Generic;
using System.Linq;
2017-03-06 20:51:13 -05:00
using Bit.Core.Models.Data;
using Bit.Core.Enums;
2015-12-08 22:57:38 -05:00
2017-03-08 21:55:08 -05:00
namespace Bit.Core.Models.Api
2015-12-08 22:57:38 -05:00
{
public class ProfileResponseModel : ResponseModel
{
2017-03-06 20:51:13 -05:00
public ProfileResponseModel(User user, IEnumerable<OrganizationUserOrganizationDetails> organizationsUserDetails)
2015-12-08 22:57:38 -05:00
: base("profile")
{
if(user == null)
{
throw new ArgumentNullException(nameof(user));
}
Id = user.Id.ToString();
2015-12-08 22:57:38 -05:00
Name = user.Name;
Email = user.Email;
MasterPasswordHint = string.IsNullOrWhiteSpace(user.MasterPasswordHint) ? null : user.MasterPasswordHint;
Culture = user.Culture;
TwoFactorEnabled = user.TwoFactorEnabled;
2017-03-06 20:51:13 -05:00
Organizations = organizationsUserDetails?.Select(o => new ProfileOrganizationResponseModel(o));
2015-12-08 22:57:38 -05:00
}
public string Id { get; set; }
public string Name { get; set; }
public string Email { get; set; }
public string MasterPasswordHint { get; set; }
public string Culture { get; set; }
public bool TwoFactorEnabled { get; set; }
2017-03-06 20:51:13 -05:00
public IEnumerable<ProfileOrganizationResponseModel> Organizations { get; set; }
2015-12-08 22:57:38 -05:00
}
}