MaximumVaultTimeout policy fixes (#1573)

This commit is contained in:
Oscar Hinton 2021-10-12 15:35:01 +02:00 committed by GitHub
parent 34aba0e168
commit c9ce7256e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 20 deletions

View File

@ -418,6 +418,21 @@ namespace Bit.App.Pages
new SettingsPageListItem { Name = AppResources.LockNow },
new SettingsPageListItem { Name = AppResources.TwoStepLogin }
};
if (_supportsBiometric || _biometric)
{
var biometricName = AppResources.Biometrics;
if (Device.RuntimePlatform == Device.iOS)
{
biometricName = _deviceActionService.SupportsFaceBiometric() ? AppResources.FaceID :
AppResources.TouchID;
}
var item = new SettingsPageListItem
{
Name = string.Format(AppResources.UnlockWith, biometricName),
SubLabel = _biometric ? AppResources.Enabled : AppResources.Disabled
};
securityItems.Insert(2, item);
}
if (_vaultTimeoutDisplayValue == AppResources.Custom)
{
securityItems.Insert(1, new SettingsPageListItem
@ -437,21 +452,6 @@ namespace Bit.App.Pages
UseFrame = true,
});
}
if (_supportsBiometric || _biometric)
{
var biometricName = AppResources.Biometrics;
if (Device.RuntimePlatform == Device.iOS)
{
biometricName = _deviceActionService.SupportsFaceBiometric() ? AppResources.FaceID :
AppResources.TouchID;
}
var item = new SettingsPageListItem
{
Name = string.Format(AppResources.UnlockWith, biometricName),
SubLabel = _biometric ? AppResources.Enabled : AppResources.Disabled
};
securityItems.Insert(2, item);
}
var accountItems = new List<SettingsPageListItem>
{
new SettingsPageListItem { Name = AppResources.FingerprintPhrase },

View File

@ -220,10 +220,20 @@ namespace Bit.Core.Services
o.Enabled &&
o.Status >= OrganizationUserStatusType.Accepted &&
o.UsePolicies &&
!o.isExemptFromPolicies &&
!isExcemptFromPolicies(o, policyType) &&
policySet.Contains(o.Id));
}
private bool isExcemptFromPolicies(Organization organization, PolicyType policyType)
{
if (policyType == PolicyType.MaximumVaultTimeout)
{
return organization.Type == OrganizationUserType.Owner;
}
return organization.isExemptFromPolicies;
}
public int? GetPolicyInt(Policy policy, string key)
{
if (policy.Data.ContainsKey(key))