mirror of
https://github.com/bitwarden/server.git
synced 2025-04-05 05:00:19 -05:00
Calculated seat addition for SM.
This commit is contained in:
parent
06d091178f
commit
e86dd00da5
@ -1,4 +1,5 @@
|
|||||||
using Bit.Core.AdminConsole.Errors;
|
using Bit.Core.AdminConsole.Errors;
|
||||||
|
using Bit.Core.AdminConsole.Models.Business;
|
||||||
using Bit.Core.AdminConsole.OrganizationFeatures.OrganizationUsers.InviteUsers.Models;
|
using Bit.Core.AdminConsole.OrganizationFeatures.OrganizationUsers.InviteUsers.Models;
|
||||||
using Bit.Core.AdminConsole.OrganizationFeatures.OrganizationUsers.InviteUsers.Validation.PasswordManager;
|
using Bit.Core.AdminConsole.OrganizationFeatures.OrganizationUsers.InviteUsers.Validation.PasswordManager;
|
||||||
using Bit.Core.AdminConsole.Shared.Validation;
|
using Bit.Core.AdminConsole.Shared.Validation;
|
||||||
@ -46,8 +47,10 @@ public class InviteUsersValidator(
|
|||||||
organization: await organizationRepository.GetByIdAsync(request.InviteOrganization.OrganizationId),
|
organization: await organizationRepository.GetByIdAsync(request.InviteOrganization.OrganizationId),
|
||||||
plan: request.InviteOrganization.Plan,
|
plan: request.InviteOrganization.Plan,
|
||||||
autoscaling: true)
|
autoscaling: true)
|
||||||
.AdjustSeats(request.Invites.Count(x => x.AccessSecretsManager));
|
.AdjustSeats(GetSecretManagerSeatAdjustment(
|
||||||
|
occupiedSeats: request.OccupiedSmSeats,
|
||||||
|
organization: request.InviteOrganization,
|
||||||
|
invitesToSend: request.Invites.Count(x => x.AccessSecretsManager)));
|
||||||
|
|
||||||
await secretsManagerSubscriptionCommand.ValidateUpdateAsync(smSubscriptionUpdate);
|
await secretsManagerSubscriptionCommand.ValidateUpdateAsync(smSubscriptionUpdate);
|
||||||
|
|
||||||
@ -60,5 +63,8 @@ public class InviteUsersValidator(
|
|||||||
{
|
{
|
||||||
return new Invalid<InviteUserOrganizationValidationRequest>(new Error<InviteUserOrganizationValidationRequest>(ex.Message, request));
|
return new Invalid<InviteUserOrganizationValidationRequest>(new Error<InviteUserOrganizationValidationRequest>(ex.Message, request));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GetSecretManagerSeatAdjustment(int occupiedSeats, InviteOrganization organization, int invitesToSend) =>
|
||||||
|
organization.SmSeats - (occupiedSeats + invitesToSend) ?? 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user