Skip to content

Commit

Permalink
[AC-1046] check plan when activating policy
Browse files Browse the repository at this point in the history
  • Loading branch information
jlf0dev committed Mar 6, 2023
1 parent 924d4c9 commit 67a4398
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Core/Services/Implementations/PolicyService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ public async Task SaveAsync(Policy policy, IUserService userService, IOrganizati
await DependsOnSingleOrgAsync(org);
}
break;

// Activate Autofill is only available to Enterprise 2020-current plans
case PolicyType.ActivateAutofill:
if (policy.Enabled)
{
LockedTo2020Plan(org);
}
break;
}

var now = DateTime.UtcNow;
Expand Down Expand Up @@ -168,4 +176,12 @@ private async Task RequiredByVaultTimeoutAsync(Organization org)
throw new BadRequestException("Maximum Vault Timeout policy is enabled.");
}
}

private void LockedTo2020Plan(Organization org)
{
if (org.PlanType != PlanType.EnterpriseAnnually && org.PlanType != PlanType.EnterpriseMonthly)
{
throw new BadRequestException("This policy is only available to 2020 Enterprise plans.");
}
}
}

0 comments on commit 67a4398

Please sign in to comment.