mirror of
https://github.com/bitwarden/android.git
synced 2024-12-24 18:08:26 +03:00
Disable Private Vault Export Policy (#1546)
This commit is contained in:
parent
6023374fbe
commit
f2857397f0
5 changed files with 47 additions and 2 deletions
|
@ -27,6 +27,18 @@
|
||||||
<ScrollView>
|
<ScrollView>
|
||||||
<StackLayout Spacing="20">
|
<StackLayout Spacing="20">
|
||||||
<StackLayout StyleClass="box">
|
<StackLayout StyleClass="box">
|
||||||
|
<Frame
|
||||||
|
IsVisible="{Binding DisablePrivateVaultPolicyEnabled}"
|
||||||
|
Padding="10"
|
||||||
|
Margin="0, 12, 0, 0"
|
||||||
|
HasShadow="False"
|
||||||
|
BackgroundColor="Transparent"
|
||||||
|
BorderColor="Accent">
|
||||||
|
<Label
|
||||||
|
Text="{u:I18n DisablePersonalVaultExportPolicyInEffect}"
|
||||||
|
StyleClass="text-muted, text-sm, text-bold"
|
||||||
|
HorizontalTextAlignment="Center" />
|
||||||
|
</Frame>
|
||||||
<StackLayout StyleClass="box-row, box-row-input, box-row-input-options-platform">
|
<StackLayout StyleClass="box-row, box-row-input, box-row-input-options-platform">
|
||||||
<Label
|
<Label
|
||||||
Text="{u:I18n FileFormat}"
|
Text="{u:I18n FileFormat}"
|
||||||
|
@ -36,7 +48,8 @@
|
||||||
ItemsSource="{Binding FileFormatOptions, Mode=OneTime}"
|
ItemsSource="{Binding FileFormatOptions, Mode=OneTime}"
|
||||||
SelectedIndex="{Binding FileFormatSelectedIndex}"
|
SelectedIndex="{Binding FileFormatSelectedIndex}"
|
||||||
SelectedIndexChanged="FileFormat_Changed"
|
SelectedIndexChanged="FileFormat_Changed"
|
||||||
StyleClass="box-value" />
|
StyleClass="box-value"
|
||||||
|
IsEnabled="{Binding DisablePrivateVaultPolicyEnabled, Converter={StaticResource inverseBool}}" />
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<Grid StyleClass="box-row">
|
<Grid StyleClass="box-row">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
|
@ -59,6 +72,7 @@
|
||||||
IsSpellCheckEnabled="False"
|
IsSpellCheckEnabled="False"
|
||||||
IsTextPredictionEnabled="False"
|
IsTextPredictionEnabled="False"
|
||||||
IsPassword="{Binding ShowPassword, Converter={StaticResource inverseBool}}"
|
IsPassword="{Binding ShowPassword, Converter={StaticResource inverseBool}}"
|
||||||
|
IsEnabled="{Binding DisablePrivateVaultPolicyEnabled, Converter={StaticResource inverseBool}}"
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
ReturnType="Go"
|
ReturnType="Go"
|
||||||
|
@ -80,7 +94,8 @@
|
||||||
<Button Text="{u:I18n ExportVault}"
|
<Button Text="{u:I18n ExportVault}"
|
||||||
Clicked="ExportVault_Clicked"
|
Clicked="ExportVault_Clicked"
|
||||||
HorizontalOptions="Fill"
|
HorizontalOptions="Fill"
|
||||||
VerticalOptions="End" />
|
VerticalOptions="End"
|
||||||
|
IsEnabled="{Binding DisablePrivateVaultPolicyEnabled, Converter={StaticResource inverseBool}}"/>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
|
|
|
@ -4,8 +4,11 @@ using Bit.App.Resources;
|
||||||
using Bit.Core.Abstractions;
|
using Bit.Core.Abstractions;
|
||||||
using Bit.Core.Utilities;
|
using Bit.Core.Utilities;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Bit.Core;
|
||||||
|
using Bit.Core.Enums;
|
||||||
#if !FDROID
|
#if !FDROID
|
||||||
using Microsoft.AppCenter.Crashes;
|
using Microsoft.AppCenter.Crashes;
|
||||||
#endif
|
#endif
|
||||||
|
@ -20,6 +23,7 @@ namespace Bit.App.Pages
|
||||||
private readonly II18nService _i18nService;
|
private readonly II18nService _i18nService;
|
||||||
private readonly ICryptoService _cryptoService;
|
private readonly ICryptoService _cryptoService;
|
||||||
private readonly IExportService _exportService;
|
private readonly IExportService _exportService;
|
||||||
|
private readonly IPolicyService _policyService;
|
||||||
|
|
||||||
private int _fileFormatSelectedIndex;
|
private int _fileFormatSelectedIndex;
|
||||||
private string _exportWarningMessage;
|
private string _exportWarningMessage;
|
||||||
|
@ -36,6 +40,7 @@ namespace Bit.App.Pages
|
||||||
_i18nService = ServiceContainer.Resolve<II18nService>("i18nService");
|
_i18nService = ServiceContainer.Resolve<II18nService>("i18nService");
|
||||||
_cryptoService = ServiceContainer.Resolve<ICryptoService>("cryptoService");
|
_cryptoService = ServiceContainer.Resolve<ICryptoService>("cryptoService");
|
||||||
_exportService = ServiceContainer.Resolve<IExportService>("exportService");
|
_exportService = ServiceContainer.Resolve<IExportService>("exportService");
|
||||||
|
_policyService = ServiceContainer.Resolve<IPolicyService>("policyService");
|
||||||
|
|
||||||
PageTitle = AppResources.ExportVault;
|
PageTitle = AppResources.ExportVault;
|
||||||
TogglePasswordCommand = new Command(TogglePassword);
|
TogglePasswordCommand = new Command(TogglePassword);
|
||||||
|
@ -53,10 +58,22 @@ namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
_initialized = true;
|
_initialized = true;
|
||||||
FileFormatSelectedIndex = FileFormatOptions.FindIndex(k => k.Key == "json");
|
FileFormatSelectedIndex = FileFormatOptions.FindIndex(k => k.Key == "json");
|
||||||
|
DisablePrivateVaultPolicyEnabled = await _policyService.PolicyAppliesToUser(PolicyType.DisablePersonalVaultExport);
|
||||||
|
|
||||||
UpdateWarning();
|
UpdateWarning();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<KeyValuePair<string, string>> FileFormatOptions { get; set; }
|
public List<KeyValuePair<string, string>> FileFormatOptions { get; set; }
|
||||||
|
private bool _disabledPrivateVaultPolicyEnabled = false;
|
||||||
|
|
||||||
|
public bool DisablePrivateVaultPolicyEnabled
|
||||||
|
{
|
||||||
|
get => _disabledPrivateVaultPolicyEnabled;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _disabledPrivateVaultPolicyEnabled, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public int FileFormatSelectedIndex
|
public int FileFormatSelectedIndex
|
||||||
{
|
{
|
||||||
|
|
9
src/App/Resources/AppResources.Designer.cs
generated
9
src/App/Resources/AppResources.Designer.cs
generated
|
@ -1474,6 +1474,15 @@ namespace Bit.App.Resources {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to One or more organization policies prevents your from exporting your personal vault..
|
||||||
|
/// </summary>
|
||||||
|
public static string DisablePersonalVaultExportPolicyInEffect {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("DisablePersonalVaultExportPolicyInEffect", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Disable Save Prompt.
|
/// Looks up a localized string similar to Disable Save Prompt.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -2040,4 +2040,7 @@
|
||||||
<data name="VaultTimeoutToLarge" xml:space="preserve">
|
<data name="VaultTimeoutToLarge" xml:space="preserve">
|
||||||
<value>Your vault timeout exceeds the restrictions set by your organization.</value>
|
<value>Your vault timeout exceeds the restrictions set by your organization.</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="DisablePersonalVaultExportPolicyInEffect">
|
||||||
|
<value>One or more organization policies prevents your from exporting your personal vault.</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
|
|
|
@ -12,5 +12,6 @@
|
||||||
SendOptions = 7, // Sets restrictions or defaults for Bitwarden Sends
|
SendOptions = 7, // Sets restrictions or defaults for Bitwarden Sends
|
||||||
ResetPassword = 8, // Allows orgs to use reset password : also can enable auto-enrollment during invite flow
|
ResetPassword = 8, // Allows orgs to use reset password : also can enable auto-enrollment during invite flow
|
||||||
MaximumVaultTimeout = 9, // Sets the maximum allowed vault timeout
|
MaximumVaultTimeout = 9, // Sets the maximum allowed vault timeout
|
||||||
|
DisablePersonalVaultExport = 10, // Disable personal vault export
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue