mirror of
https://github.com/bitwarden/server.git
synced 2025-04-05 05:00:19 -05:00
Removed valid wrapper to pass in to validation methods.
This commit is contained in:
parent
8d2c723c09
commit
75c6d2b0dc
@ -33,12 +33,12 @@ public class InviteUsersValidator(
|
||||
return invalidSubscriptionUpdate.Map(request);
|
||||
}
|
||||
|
||||
if (ValidateEnvironment(globalSettings, passwordManagerValidationResult as Valid<PasswordManagerSubscriptionUpdate>) is Invalid<IGlobalSettings> invalidEnvironment)
|
||||
if (ValidateEnvironment(globalSettings, subscriptionUpdate) is Invalid<IGlobalSettings> invalidEnvironment)
|
||||
{
|
||||
return invalidEnvironment.Map(request);
|
||||
}
|
||||
|
||||
var organizationValidationResult = InviteUserOrganizationValidator.Validate(request.InviteOrganization, passwordManagerValidationResult as Valid<PasswordManagerSubscriptionUpdate>);
|
||||
var organizationValidationResult = InviteUserOrganizationValidator.Validate(request.InviteOrganization, subscriptionUpdate);
|
||||
|
||||
if (organizationValidationResult is Invalid<InviteOrganization> organizationValidation)
|
||||
{
|
||||
@ -82,8 +82,8 @@ public class InviteUsersValidator(
|
||||
smSubscriptionUpdate));
|
||||
}
|
||||
|
||||
public static ValidationResult<IGlobalSettings> ValidateEnvironment(IGlobalSettings globalSettings, Valid<PasswordManagerSubscriptionUpdate> subscriptionUpdate) =>
|
||||
globalSettings.SelfHosted && subscriptionUpdate?.Value.SeatsRequiredToAdd > 0
|
||||
public static ValidationResult<IGlobalSettings> ValidateEnvironment(IGlobalSettings globalSettings, PasswordManagerSubscriptionUpdate subscriptionUpdate) =>
|
||||
globalSettings.SelfHosted && subscriptionUpdate.SeatsRequiredToAdd > 0
|
||||
? new Invalid<IGlobalSettings>(new CannotAutoScaleOnSelfHostError(globalSettings))
|
||||
: new Valid<IGlobalSettings>(globalSettings);
|
||||
}
|
||||
|
@ -7,9 +7,9 @@ namespace Bit.Core.AdminConsole.OrganizationFeatures.OrganizationUsers.InviteUse
|
||||
public static class InviteUserOrganizationValidator
|
||||
{
|
||||
public static ValidationResult<InviteOrganization> Validate(InviteOrganization inviteOrganization,
|
||||
Valid<PasswordManagerSubscriptionUpdate> passwordManagerValidationResult)
|
||||
PasswordManagerSubscriptionUpdate subscriptionUpdate)
|
||||
{
|
||||
if (inviteOrganization.Seats is null || passwordManagerValidationResult.Value.SeatsRequiredToAdd is 0)
|
||||
if (inviteOrganization.Seats is null || subscriptionUpdate.SeatsRequiredToAdd is 0)
|
||||
{
|
||||
return new Valid<InviteOrganization>(inviteOrganization);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user