1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-05 13:08:17 -05:00

Removed unused request model

This commit is contained in:
jrmccannon 2025-03-07 12:23:38 -06:00
parent 4317276f5d
commit 9dab9160a5
No known key found for this signature in database
GPG Key ID: CF03F3DB01CE96A6
7 changed files with 28 additions and 36 deletions

View File

@ -27,7 +27,7 @@ public class ScimUserRequestModel : BaseScimUserModel
};
}
public InviteScimOrganizationUserRequest ToRequest(
public OrganizationUserSingleEmailInvite ToRequest(
ScimProviderType scimProvider,
bool hasSecretsManager,
InviteOrganization inviteOrganization,

View File

@ -5,5 +5,5 @@ namespace Bit.Core.AdminConsole.OrganizationFeatures.OrganizationUsers.InviteUse
public interface IInviteOrganizationUsersCommand
{
Task<CommandResult<ScimInviteOrganizationUsersResponse>> InviteScimOrganizationUserAsync(InviteScimOrganizationUserRequest request);
Task<CommandResult<ScimInviteOrganizationUsersResponse>> InviteScimOrganizationUserAsync(OrganizationUserSingleEmailInvite request);
}

View File

@ -36,7 +36,7 @@ public class InviteOrganizationUsersCommand(IEventService eventService,
public const string IssueNotifyingOwnersOfSeatLimitReached = "Error encountered notifying organization owners of seat limit reached.";
public const string FailedToInviteUsers = "Failed to invite user(s).";
public async Task<CommandResult<ScimInviteOrganizationUsersResponse>> InviteScimOrganizationUserAsync(InviteScimOrganizationUserRequest request)
public async Task<CommandResult<ScimInviteOrganizationUsersResponse>> InviteScimOrganizationUserAsync(OrganizationUserSingleEmailInvite request)
{
var result = await InviteOrganizationUsersAsync(new InviteOrganizationUsersRequest(request));

View File

@ -20,8 +20,8 @@ public class InviteOrganizationUsersRequest
PerformedAt = performedAt;
}
public InviteOrganizationUsersRequest(InviteScimOrganizationUserRequest request) :
this([OrganizationUserInvite.Create(request, request.ExternalId)],
public InviteOrganizationUsersRequest(OrganizationUserSingleEmailInvite request) :
this([OrganizationUserInvite.Create(request)],
request.InviteOrganization,
Guid.Empty,
request.PerformedAt)

View File

@ -1,28 +0,0 @@
using Bit.Core.AdminConsole.Models.Business;
using Bit.Core.Enums;
using Bit.Core.Models.Data;
namespace Bit.Core.AdminConsole.OrganizationFeatures.OrganizationUsers.InviteUsers.Models;
public record InviteScimOrganizationUserRequest : OrganizationUserSingleEmailInvite
{
public InviteOrganization InviteOrganization { get; private init; }
public DateTimeOffset PerformedAt { get; private init; }
public string ExternalId { get; private init; } = string.Empty;
public InviteScimOrganizationUserRequest(string email,
bool hasSecretsManager,
InviteOrganization inviteOrganization,
DateTimeOffset performedAt,
string externalId) : base(
email: email,
accessibleCollections: [],
type: OrganizationUserType.User,
permissions: new Permissions(),
accessSecretsManager: hasSecretsManager)
{
InviteOrganization = inviteOrganization;
PerformedAt = performedAt;
ExternalId = externalId;
}
}

View File

@ -42,12 +42,12 @@ public class OrganizationUserInvite
};
}
public static OrganizationUserInvite Create(OrganizationUserSingleEmailInvite invite, string externalId) =>
public static OrganizationUserInvite Create(OrganizationUserSingleEmailInvite invite) =>
Create([invite.Email],
invite.AccessibleCollections,
invite.Type,
invite.Permissions,
externalId,
invite.ExternalId,
invite.AccessSecretsManager);
private static void ValidateEmailAddresses(string[] emails)

View File

@ -1,4 +1,5 @@
using Bit.Core.Enums;
using Bit.Core.AdminConsole.Models.Business;
using Bit.Core.Enums;
using Bit.Core.Exceptions;
using Bit.Core.Models.Data;
using Bit.Core.Utilities;
@ -14,6 +15,25 @@ public record OrganizationUserSingleEmailInvite
public Permissions Permissions { get; init; } = new();
public OrganizationUserType Type { get; init; } = OrganizationUserType.User;
public bool AccessSecretsManager { get; init; }
public InviteOrganization InviteOrganization { get; private init; }
public DateTimeOffset PerformedAt { get; private init; }
public string ExternalId { get; private init; } = string.Empty;
public OrganizationUserSingleEmailInvite(string email,
bool hasSecretsManager,
InviteOrganization inviteOrganization,
DateTimeOffset performedAt,
string externalId) : this(
email: email,
accessibleCollections: [],
type: OrganizationUserType.User,
permissions: new Permissions(),
accessSecretsManager: hasSecretsManager)
{
InviteOrganization = inviteOrganization;
PerformedAt = performedAt;
ExternalId = externalId;
}
public OrganizationUserSingleEmailInvite(string email,
IEnumerable<CollectionAccessSelection> accessibleCollections,