mirror of
https://github.com/bitwarden/server.git
synced 2025-02-27 03:41:30 +01:00
[Require SSO] Added service layer dependent policy check (#977)
* Added service layer dependent policy check * Updated to SingleOrg
This commit is contained in:
parent
0eccfb8784
commit
a5db233e51
@ -45,6 +45,24 @@ namespace Bit.Core.Services
|
||||
throw new BadRequestException("This organization cannot use policies.");
|
||||
}
|
||||
|
||||
// Handle dependent policy checks
|
||||
switch(policy.Type)
|
||||
{
|
||||
case PolicyType.RequireSso:
|
||||
if (policy.Enabled)
|
||||
{
|
||||
var singleOrg = await _policyRepository.GetByOrganizationIdTypeAsync(org.Id, PolicyType.SingleOrg);
|
||||
if (singleOrg?.Enabled != true)
|
||||
{
|
||||
throw new BadRequestException("Single Organization policy not enabled.");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
var now = DateTime.UtcNow;
|
||||
if (policy.Id == default(Guid))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user