mirror of
https://github.com/bitwarden/server.git
synced 2025-07-01 08:02:49 -05:00
org user details apis
This commit is contained in:
@ -6,7 +6,7 @@ namespace Bit.Api.Models
|
||||
{
|
||||
public class OrganizationUserResponseModel : ResponseModel
|
||||
{
|
||||
public OrganizationUserResponseModel(OrganizationUserDetails organizationUser, string obj = "organizationUser")
|
||||
public OrganizationUserResponseModel(OrganizationUserUserDetails organizationUser, string obj = "organizationUser")
|
||||
: base(obj)
|
||||
{
|
||||
if(organizationUser == null)
|
||||
|
22
src/Api/Models/Response/ProfileOrganizationResponseModel.cs
Normal file
22
src/Api/Models/Response/ProfileOrganizationResponseModel.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Data;
|
||||
|
||||
namespace Bit.Api.Models
|
||||
{
|
||||
public class ProfileOrganizationResponseModel : ResponseModel
|
||||
{
|
||||
public ProfileOrganizationResponseModel(OrganizationUserOrganizationDetails organization)
|
||||
: base("profileOrganization")
|
||||
{
|
||||
Id = organization.OrganizationId.ToString();
|
||||
Name = organization.Name;
|
||||
Key = organization.Key;
|
||||
Status = organization.Status;
|
||||
}
|
||||
|
||||
public string Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Key { get; set; }
|
||||
public OrganizationUserStatusType Status { get; set; }
|
||||
}
|
||||
}
|
@ -2,12 +2,14 @@
|
||||
using Bit.Core.Domains;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Enums;
|
||||
|
||||
namespace Bit.Api.Models
|
||||
{
|
||||
public class ProfileResponseModel : ResponseModel
|
||||
{
|
||||
public ProfileResponseModel(User user, IEnumerable<Organization> organizations)
|
||||
public ProfileResponseModel(User user, IEnumerable<OrganizationUserOrganizationDetails> organizationsUserDetails)
|
||||
: base("profile")
|
||||
{
|
||||
if(user == null)
|
||||
@ -21,7 +23,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));
|
||||
Organizations = organizationsUserDetails?.Select(o => new ProfileOrganizationResponseModel(o));
|
||||
}
|
||||
|
||||
public string Id { get; set; }
|
||||
@ -30,18 +32,6 @@ 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; }
|
||||
}
|
||||
public IEnumerable<ProfileOrganizationResponseModel> Organizations { get; set; }
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user