mirror of
https://github.com/bitwarden/server.git
synced 2024-11-22 12:15:36 +01:00
[AC-1046] add browser autofill policy (#2751)
* [EC-1046] add browser autofill policy * [AC-1046] check plan when activating policy * [AC-1046] add useActivateAutofillPolicy to Organization response * [AC-1046] add UseActivateAutofillPolicy to provider org response
This commit is contained in:
parent
397f3d6865
commit
e5aafe1c8b
@ -28,6 +28,8 @@ public class ProfileOrganizationResponseModel : ResponseModel
|
|||||||
UseSecretsManager = organization.UseSecretsManager;
|
UseSecretsManager = organization.UseSecretsManager;
|
||||||
UsersGetPremium = organization.UsersGetPremium;
|
UsersGetPremium = organization.UsersGetPremium;
|
||||||
UseCustomPermissions = organization.UseCustomPermissions;
|
UseCustomPermissions = organization.UseCustomPermissions;
|
||||||
|
UseActivateAutofillPolicy = organization.PlanType == PlanType.EnterpriseAnnually ||
|
||||||
|
organization.PlanType == PlanType.EnterpriseMonthly;
|
||||||
SelfHost = organization.SelfHost;
|
SelfHost = organization.SelfHost;
|
||||||
Seats = organization.Seats;
|
Seats = organization.Seats;
|
||||||
MaxCollections = organization.MaxCollections;
|
MaxCollections = organization.MaxCollections;
|
||||||
@ -78,6 +80,7 @@ public class ProfileOrganizationResponseModel : ResponseModel
|
|||||||
public bool UseSecretsManager { get; set; }
|
public bool UseSecretsManager { get; set; }
|
||||||
public bool UsersGetPremium { get; set; }
|
public bool UsersGetPremium { get; set; }
|
||||||
public bool UseCustomPermissions { get; set; }
|
public bool UseCustomPermissions { get; set; }
|
||||||
|
public bool UseActivateAutofillPolicy { get; set; }
|
||||||
public bool SelfHost { get; set; }
|
public bool SelfHost { get; set; }
|
||||||
public int? Seats { get; set; }
|
public int? Seats { get; set; }
|
||||||
public short? MaxCollections { get; set; }
|
public short? MaxCollections { get; set; }
|
||||||
|
@ -24,6 +24,8 @@ public class ProfileProviderOrganizationResponseModel : ProfileOrganizationRespo
|
|||||||
UseResetPassword = organization.UseResetPassword;
|
UseResetPassword = organization.UseResetPassword;
|
||||||
UsersGetPremium = organization.UsersGetPremium;
|
UsersGetPremium = organization.UsersGetPremium;
|
||||||
UseCustomPermissions = organization.UseCustomPermissions;
|
UseCustomPermissions = organization.UseCustomPermissions;
|
||||||
|
UseActivateAutofillPolicy = organization.PlanType == PlanType.EnterpriseAnnually ||
|
||||||
|
organization.PlanType == PlanType.EnterpriseMonthly;
|
||||||
SelfHost = organization.SelfHost;
|
SelfHost = organization.SelfHost;
|
||||||
Seats = organization.Seats;
|
Seats = organization.Seats;
|
||||||
MaxCollections = organization.MaxCollections;
|
MaxCollections = organization.MaxCollections;
|
||||||
|
@ -13,4 +13,5 @@ public enum PolicyType : byte
|
|||||||
ResetPassword = 8,
|
ResetPassword = 8,
|
||||||
MaximumVaultTimeout = 9,
|
MaximumVaultTimeout = 9,
|
||||||
DisablePersonalVaultExport = 10,
|
DisablePersonalVaultExport = 10,
|
||||||
|
ActivateAutofill = 11,
|
||||||
}
|
}
|
||||||
|
@ -73,6 +73,14 @@ public class PolicyService : IPolicyService
|
|||||||
await DependsOnSingleOrgAsync(org);
|
await DependsOnSingleOrgAsync(org);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// Activate Autofill is only available to Enterprise 2020-current plans
|
||||||
|
case PolicyType.ActivateAutofill:
|
||||||
|
if (policy.Enabled)
|
||||||
|
{
|
||||||
|
LockedTo2020Plan(org);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
var now = DateTime.UtcNow;
|
var now = DateTime.UtcNow;
|
||||||
@ -168,4 +176,12 @@ public class PolicyService : IPolicyService
|
|||||||
throw new BadRequestException("Maximum Vault Timeout policy is enabled.");
|
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.");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user