1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-21 12:05:42 +01:00

Prevent manually adding SM to an MSP-managed org

This commit is contained in:
Thomas Rittson 2023-08-31 15:43:35 +10:00
parent e4600a199f
commit 51b086243b
No known key found for this signature in database
GPG Key ID: CDDDA03861C35E27

View File

@ -5,6 +5,7 @@ using Bit.Admin.Utilities;
using Bit.Core.Context;
using Bit.Core.Entities;
using Bit.Core.Enums;
using Bit.Core.Enums.Provider;
using Bit.Core.Exceptions;
using Bit.Core.Models.OrganizationConnectionConfigs;
using Bit.Core.OrganizationFeatures.OrganizationSponsorships.FamiliesForEnterprise.Interfaces;
@ -208,6 +209,12 @@ public class OrganizationsController : Controller
throw new BadRequestException("Plan does not support Secrets Manager");
}
if (organization.UseSecretsManager && model.Provider is { Type: ProviderType.Msp })
{
throw new BadRequestException(
"Organizations with a Managed Service Provider do not support Secrets Manager.");
}
await _organizationRepository.ReplaceAsync(organization);
await _applicationCacheService.UpsertOrganizationAbilityAsync(organization);
await _referenceEventService.RaiseEventAsync(new ReferenceEvent(ReferenceEventType.OrganizationEditedByAdmin, organization, _currentContext)