mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 15:42:48 -05:00
[AC-1200] Admin Console code ownership - move OrganizationFeatures (#3369)
This commit is contained in:
@ -1,12 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bit.Api.Models.Request;
|
||||
|
||||
public class OrganizationDomainRequestModel
|
||||
{
|
||||
[Required]
|
||||
public string Txt { get; set; }
|
||||
|
||||
[Required]
|
||||
public string DomainName { get; set; }
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
using System.Text.Json;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Models.Data.Organizations.OrganizationConnections;
|
||||
using Bit.Core.Models.OrganizationConnectionConfigs;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Api.Models.Request.Organizations;
|
||||
|
||||
public class OrganizationConnectionRequestModel
|
||||
{
|
||||
public OrganizationConnectionType Type { get; set; }
|
||||
public Guid OrganizationId { get; set; }
|
||||
public bool Enabled { get; set; }
|
||||
public JsonDocument Config { get; set; }
|
||||
|
||||
public OrganizationConnectionRequestModel() { }
|
||||
}
|
||||
|
||||
|
||||
public class OrganizationConnectionRequestModel<T> : OrganizationConnectionRequestModel where T : IConnectionConfig
|
||||
{
|
||||
public T ParsedConfig { get; private set; }
|
||||
|
||||
public OrganizationConnectionRequestModel(OrganizationConnectionRequestModel model)
|
||||
{
|
||||
Type = model.Type;
|
||||
OrganizationId = model.OrganizationId;
|
||||
Enabled = model.Enabled;
|
||||
Config = model.Config;
|
||||
|
||||
try
|
||||
{
|
||||
ParsedConfig = model.Config.ToObject<T>(JsonHelpers.IgnoreCase);
|
||||
}
|
||||
catch (JsonException)
|
||||
{
|
||||
throw new BadRequestException("Organization Connection configuration malformed");
|
||||
}
|
||||
}
|
||||
|
||||
public OrganizationConnectionData<T> ToData(Guid? id = null) =>
|
||||
new()
|
||||
{
|
||||
Id = id,
|
||||
Type = Type,
|
||||
OrganizationId = OrganizationId,
|
||||
Enabled = Enabled,
|
||||
Config = ParsedConfig,
|
||||
};
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bit.Api.Models.Request.Organizations;
|
||||
|
||||
public class OrganizationDomainSsoDetailsRequestModel
|
||||
{
|
||||
[Required]
|
||||
[EmailAddress]
|
||||
public string Email { get; set; }
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
using System.Text.Json;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
|
||||
namespace Bit.Api.Models.Response.Organizations;
|
||||
|
||||
public class OrganizationConnectionResponseModel
|
||||
{
|
||||
public Guid? Id { get; set; }
|
||||
public OrganizationConnectionType Type { get; set; }
|
||||
public Guid OrganizationId { get; set; }
|
||||
public bool Enabled { get; set; }
|
||||
public JsonDocument Config { get; set; }
|
||||
|
||||
public OrganizationConnectionResponseModel(OrganizationConnection connection, Type configType)
|
||||
{
|
||||
if (connection == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Id = connection.Id;
|
||||
Type = connection.Type;
|
||||
OrganizationId = connection.OrganizationId;
|
||||
Enabled = connection.Enabled;
|
||||
Config = JsonDocument.Parse(connection.Config);
|
||||
}
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Models.Api;
|
||||
|
||||
namespace Bit.Api.Models.Response.Organizations;
|
||||
|
||||
public class OrganizationDomainResponseModel : ResponseModel
|
||||
{
|
||||
public OrganizationDomainResponseModel(OrganizationDomain organizationDomain, string obj = "organizationDomain")
|
||||
: base(obj)
|
||||
{
|
||||
if (organizationDomain == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(organizationDomain));
|
||||
}
|
||||
|
||||
Id = organizationDomain.Id;
|
||||
OrganizationId = organizationDomain.OrganizationId;
|
||||
Txt = organizationDomain.Txt;
|
||||
DomainName = organizationDomain.DomainName;
|
||||
CreationDate = organizationDomain.CreationDate;
|
||||
NextRunDate = organizationDomain.NextRunDate;
|
||||
JobRunCount = organizationDomain.JobRunCount;
|
||||
VerifiedDate = organizationDomain.VerifiedDate;
|
||||
LastCheckedDate = organizationDomain.LastCheckedDate;
|
||||
}
|
||||
|
||||
public Guid Id { get; set; }
|
||||
public Guid OrganizationId { get; set; }
|
||||
public string Txt { get; set; }
|
||||
public string DomainName { get; set; }
|
||||
public DateTime CreationDate { get; set; }
|
||||
public DateTime NextRunDate { get; set; }
|
||||
public int JobRunCount { get; set; }
|
||||
public DateTime? VerifiedDate { get; set; }
|
||||
public DateTime? LastCheckedDate { get; set; }
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.Models.Data.Organizations;
|
||||
|
||||
namespace Bit.Api.Models.Response.Organizations;
|
||||
|
||||
public class OrganizationDomainSsoDetailsResponseModel : ResponseModel
|
||||
{
|
||||
public OrganizationDomainSsoDetailsResponseModel(OrganizationDomainSsoDetailsData data, string obj = "organizationDomainSsoDetails")
|
||||
: base(obj)
|
||||
{
|
||||
if (data == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(data));
|
||||
}
|
||||
|
||||
SsoAvailable = data.SsoAvailable;
|
||||
DomainName = data.DomainName;
|
||||
OrganizationIdentifier = data.OrganizationIdentifier;
|
||||
VerifiedDate = data.VerifiedDate;
|
||||
}
|
||||
|
||||
public bool SsoAvailable { get; private set; }
|
||||
public string DomainName { get; private set; }
|
||||
public string OrganizationIdentifier { get; private set; }
|
||||
public DateTime? VerifiedDate { get; private set; }
|
||||
}
|
Reference in New Issue
Block a user