1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-01 08:02:49 -05:00

check that SingleOrg policy is enabled before saying users cant create new orgs (#1110)

* check that SingleOrg policy is enabled before saying users cant create new orgs

* fixed org user kick check for SingleOrg

* code review cleanup
This commit is contained in:
Addison Beck
2021-01-25 11:19:33 -05:00
committed by GitHub
parent bc4eeff604
commit 445ce33c47
2 changed files with 6 additions and 4 deletions

View File

@ -162,7 +162,7 @@ namespace Bit.Api.Controllers
}
var policies = await _policyRepository.GetManyByUserIdAsync(user.Id);
if (policies.Any(policy => policy.Type == PolicyType.SingleOrg))
if (policies.Any(policy => policy.Enabled && policy.Type == PolicyType.SingleOrg))
{
throw new Exception("You may not create an organization. You belong to an organization " +
"which has a policy that prohibits you from being a member of any other organization.");
@ -190,7 +190,7 @@ namespace Bit.Api.Controllers
}
var policies = await _policyRepository.GetManyByUserIdAsync(user.Id);
if (policies.Any(policy => policy.Type == PolicyType.SingleOrg))
if (policies.Any(policy => policy.Enabled && policy.Type == PolicyType.SingleOrg))
{
throw new Exception("You may not create an organization. You belong to an organization " +
"which has a policy that prohibits you from being a member of any other organization.");