mirror of
https://github.com/bitwarden/mobile
synced 2026-01-06 18:43:43 +00:00
This reverts commit dcb5854557.
This commit is contained in:
@@ -20,7 +20,6 @@ namespace Bit.Core.Abstractions
|
||||
string orgId);
|
||||
Task<bool> PolicyAppliesToUser(PolicyType policyType, Func<Policy, bool> policyFilter = null, string userId = null);
|
||||
int? GetPolicyInt(Policy policy, string key);
|
||||
string GetPolicyString(Policy policy, string key);
|
||||
Task<bool> ShouldShowVaultFilterAsync();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,11 +17,6 @@ namespace Bit.Core.Services
|
||||
|
||||
private IEnumerable<Policy> _policyCache;
|
||||
|
||||
public const string TIMEOUT_POLICY_MINUTES = "minutes";
|
||||
public const string TIMEOUT_POLICY_ACTION = "action";
|
||||
public const string TIMEOUT_POLICY_ACTION_LOCK = "lock";
|
||||
public const string TIMEOUT_POLICY_ACTION_LOGOUT = "logOut";
|
||||
|
||||
public PolicyService(
|
||||
IStateService stateService,
|
||||
IOrganizationService organizationService)
|
||||
@@ -252,10 +247,6 @@ namespace Bit.Core.Services
|
||||
return null;
|
||||
}
|
||||
|
||||
public string GetPolicyString(Policy policy, string key) =>
|
||||
policy.Data.TryGetValue(key, out var val) ? val as string : null;
|
||||
|
||||
|
||||
public async Task<bool> ShouldShowVaultFilterAsync()
|
||||
{
|
||||
var personalOwnershipPolicyApplies = await PolicyAppliesToUser(PolicyType.PersonalOwnership);
|
||||
@@ -281,6 +272,17 @@ namespace Bit.Core.Services
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private string GetPolicyString(Policy policy, string key)
|
||||
{
|
||||
if (policy.Data.ContainsKey(key))
|
||||
{
|
||||
var value = policy.Data[key];
|
||||
if (value != null)
|
||||
{
|
||||
return (string)value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,7 +247,7 @@ namespace Bit.Core.Services
|
||||
{
|
||||
var policy = (await _policyService.GetAll(PolicyType.MaximumVaultTimeout, userId)).First();
|
||||
// Remove negative values, and ensure it's smaller than maximum allowed value according to policy
|
||||
var policyTimeout = _policyService.GetPolicyInt(policy, PolicyService.TIMEOUT_POLICY_MINUTES);
|
||||
var policyTimeout = _policyService.GetPolicyInt(policy, "minutes");
|
||||
if (!policyTimeout.HasValue)
|
||||
{
|
||||
return vaultTimeout;
|
||||
|
||||
Reference in New Issue
Block a user