1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-04 01:22:50 -05:00

[SM-896] restricting access to disabled orgs (#3287)

* restricting access to disabled orgs

* Unit Test Updates

* Update test/Api.IntegrationTest/SecretsManager/Controllers/AccessPoliciesControllerTests.cs

Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>

* Covering all test cases

* making organization enabled NOT default

---------

Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
This commit is contained in:
cd-bitwarden
2023-10-16 10:29:02 -04:00
committed by GitHub
parent 4ff41e9604
commit b772784af3
10 changed files with 417 additions and 264 deletions

View File

@ -25,13 +25,22 @@ public class SecretsManagerOrganizationHelper
_ownerEmail = ownerEmail;
}
public async Task<(Organization organization, OrganizationUser owner)> Initialize(bool useSecrets, bool ownerAccessSecrets)
public async Task<(Organization organization, OrganizationUser owner)> Initialize(bool useSecrets, bool ownerAccessSecrets, bool organizationEnabled)
{
(_organization, _owner) = await OrganizationTestHelpers.SignUpAsync(_factory, ownerEmail: _ownerEmail, billingEmail: _ownerEmail);
if (useSecrets)
if (useSecrets || !organizationEnabled)
{
_organization.UseSecretsManager = true;
if (useSecrets)
{
_organization.UseSecretsManager = true;
}
if (!organizationEnabled)
{
_organization.Enabled = false;
}
await _organizationRepository.ReplaceAsync(_organization);
}