mirror of
https://github.com/bitwarden/server.git
synced 2025-07-01 08:02:49 -05:00
organizations to account profile
This commit is contained in:
@ -9,7 +9,7 @@ namespace Bit.Api.Models
|
||||
: base("authToken")
|
||||
{
|
||||
Token = token;
|
||||
Profile = user == null ? null : new ProfileResponseModel(user);
|
||||
Profile = user == null ? null : new ProfileResponseModel(user, null);
|
||||
}
|
||||
|
||||
public string Token { get; set; }
|
||||
|
@ -1,11 +1,13 @@
|
||||
using System;
|
||||
using Bit.Core.Domains;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Bit.Api.Models
|
||||
{
|
||||
public class ProfileResponseModel : ResponseModel
|
||||
{
|
||||
public ProfileResponseModel(User user)
|
||||
public ProfileResponseModel(User user, IEnumerable<Organization> organizations)
|
||||
: base("profile")
|
||||
{
|
||||
if(user == null)
|
||||
@ -19,6 +21,7 @@ namespace Bit.Api.Models
|
||||
MasterPasswordHint = string.IsNullOrWhiteSpace(user.MasterPasswordHint) ? null : user.MasterPasswordHint;
|
||||
Culture = user.Culture;
|
||||
TwoFactorEnabled = user.TwoFactorEnabled;
|
||||
Organizations = organizations?.Select(o => new OrganizationResponseModel(o));
|
||||
}
|
||||
|
||||
public string Id { get; set; }
|
||||
@ -27,5 +30,18 @@ namespace Bit.Api.Models
|
||||
public string MasterPasswordHint { get; set; }
|
||||
public string Culture { get; set; }
|
||||
public bool TwoFactorEnabled { get; set; }
|
||||
public IEnumerable<OrganizationResponseModel> Organizations { get; set; }
|
||||
|
||||
public class OrganizationResponseModel
|
||||
{
|
||||
public OrganizationResponseModel(Organization organization)
|
||||
{
|
||||
Id = organization.Id.ToString();
|
||||
Name = organization.Name;
|
||||
}
|
||||
|
||||
public string Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user