2017-03-04 21:28:41 -05:00
|
|
|
|
using System;
|
|
|
|
|
|
using Bit.Core.Enums;
|
|
|
|
|
|
using Bit.Core.Models.Data;
|
2017-03-11 15:34:57 -05:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
2017-05-11 10:32:25 -04:00
|
|
|
|
using Bit.Core.Models.Table;
|
2017-03-04 21:28:41 -05:00
|
|
|
|
|
2017-03-08 21:55:08 -05:00
|
|
|
|
namespace Bit.Core.Models.Api
|
2017-03-04 21:28:41 -05:00
|
|
|
|
{
|
|
|
|
|
|
public class OrganizationUserResponseModel : ResponseModel
|
|
|
|
|
|
{
|
2017-05-11 10:32:25 -04:00
|
|
|
|
public OrganizationUserResponseModel(OrganizationUser organizationUser, string obj = "organizationUser")
|
|
|
|
|
|
: base(obj)
|
|
|
|
|
|
{
|
|
|
|
|
|
if(organizationUser == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new ArgumentNullException(nameof(organizationUser));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Id = organizationUser.Id.ToString();
|
|
|
|
|
|
UserId = organizationUser.UserId?.ToString();
|
|
|
|
|
|
Type = organizationUser.Type;
|
|
|
|
|
|
Status = organizationUser.Status;
|
|
|
|
|
|
AccessAll = organizationUser.AccessAll;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-03-06 20:51:13 -05:00
|
|
|
|
public OrganizationUserResponseModel(OrganizationUserUserDetails organizationUser, string obj = "organizationUser")
|
2017-03-04 21:28:41 -05:00
|
|
|
|
: base(obj)
|
|
|
|
|
|
{
|
|
|
|
|
|
if(organizationUser == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new ArgumentNullException(nameof(organizationUser));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Id = organizationUser.Id.ToString();
|
|
|
|
|
|
UserId = organizationUser.UserId?.ToString();
|
|
|
|
|
|
Type = organizationUser.Type;
|
|
|
|
|
|
Status = organizationUser.Status;
|
2017-04-27 15:35:26 -04:00
|
|
|
|
AccessAll = organizationUser.AccessAll;
|
2017-03-04 21:28:41 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public string Id { get; set; }
|
|
|
|
|
|
public string UserId { get; set; }
|
|
|
|
|
|
public OrganizationUserType Type { get; set; }
|
|
|
|
|
|
public OrganizationUserStatusType Status { get; set; }
|
2017-04-27 15:35:26 -04:00
|
|
|
|
public bool AccessAll { get; set; }
|
2017-03-04 21:28:41 -05:00
|
|
|
|
}
|
2017-03-11 15:34:57 -05:00
|
|
|
|
|
|
|
|
|
|
public class OrganizationUserDetailsResponseModel : OrganizationUserResponseModel
|
|
|
|
|
|
{
|
2017-05-11 10:32:25 -04:00
|
|
|
|
public OrganizationUserDetailsResponseModel(OrganizationUser organizationUser,
|
|
|
|
|
|
IEnumerable<SelectionReadOnly> collections)
|
2017-03-11 15:34:57 -05:00
|
|
|
|
: base(organizationUser, "organizationUserDetails")
|
|
|
|
|
|
{
|
2017-05-11 11:41:13 -04:00
|
|
|
|
Collections = collections.Select(c => new SelectionReadOnlyResponseModel(c));
|
2017-03-11 15:34:57 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-05-11 11:41:13 -04:00
|
|
|
|
public IEnumerable<SelectionReadOnlyResponseModel> Collections { get; set; }
|
2017-05-11 10:32:25 -04:00
|
|
|
|
}
|
|
|
|
|
|
public class OrganizationUserUserDetailsResponseModel : OrganizationUserResponseModel
|
|
|
|
|
|
{
|
|
|
|
|
|
public OrganizationUserUserDetailsResponseModel(OrganizationUserUserDetails organizationUser,
|
|
|
|
|
|
string obj = "organizationUserUserDetails")
|
|
|
|
|
|
: base(organizationUser, obj)
|
|
|
|
|
|
{
|
|
|
|
|
|
if(organizationUser == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new ArgumentNullException(nameof(organizationUser));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Name = organizationUser.Name;
|
|
|
|
|
|
Email = organizationUser.Email;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
|
public string Email { get; set; }
|
2017-03-11 15:34:57 -05:00
|
|
|
|
}
|
2017-03-04 21:28:41 -05:00
|
|
|
|
}
|