Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add security tab to preference menu dialog #12800

Merged
merged 3 commits into from
Apr 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -3084,4 +3084,25 @@ To install the latest version of a package, click Install. \n
<data name="GroupContextMenuColor" xml:space="preserve">
<value>Color</value>
</data>
<data name="PreferencesSecuritySettingsTab" xml:space="preserve">
<value>Security</value>
</data>
<data name="PreferencesViewTrustWarningHeader" xml:space="preserve">
<value>Trust warning</value>
</data>
<data name="PreferencesViewTrustWarningLabel" xml:space="preserve">
<value>Disable receiving trust warning</value>
</data>
<data name="PreferencesViewTrustWarningTooltipText" xml:space="preserve">
<value>We recommend keeping this toggle off to reduce security risks.</value>
</data>
<data name="SecurityPathAddPathButtonName" xml:space="preserve">
<value>Add Path</value>
</data>
<data name="SecurityWarningExpanderName" xml:space="preserve">
<value>Warning</value>
</data>
<data name="TrustedPathsExpanderName" xml:space="preserve">
<value>Trusted location</value>
</data>
</root>
21 changes: 21 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -3071,4 +3071,25 @@ To install the latest version of a package, click Install. \n
<data name="GroupContextMenuColor" xml:space="preserve">
<value>Color</value>
</data>
<data name="PreferencesSecuritySettingsTab" xml:space="preserve">
<value>Security</value>
</data>
<data name="PreferencesViewTrustWarningHeader" xml:space="preserve">
<value>Trust warning</value>
</data>
<data name="PreferencesViewTrustWarningLabel" xml:space="preserve">
<value>Disable receiving trust warning</value>
</data>
<data name="PreferencesViewTrustWarningTooltipText" xml:space="preserve">
<value>We recommend keeping this toggle off to reduce security risks.</value>
</data>
<data name="SecurityPathAddPathButtonName" xml:space="preserve">
<value>Add Path</value>
</data>
<data name="SecurityWarningExpanderName" xml:space="preserve">
<value>Warning</value>
</data>
<data name="TrustedPathsExpanderName" xml:space="preserve">
<value>Trusted location</value>
</data>
</root>
85 changes: 85 additions & 0 deletions src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,91 @@
</Expander>
</Grid>
</TabItem>

<!--Security Settings Tab-->
<TabItem Header="{x:Static p:Resources.PreferencesSecuritySettingsTab}"
Style="{StaticResource LeftTab}"
Visibility="{Binding PreferencesDebugMode, Converter={StaticResource BooleanToVisibilityConverter}}">
<!--This Grid contains the package manager settings tab-->
<Grid x:Name="SecurityTab"
Margin="1"
HorizontalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>

<Expander x:Name="SecurityWarningExpander"
Grid.Row="0"
Style="{StaticResource MenuExpanderStyle}"
IsExpanded="{Binding PreferencesTabs[Features].ExpanderActive, Converter={StaticResource ExpandersBindingConverter}, ConverterParameter=SecurityWarningExpander}"
Header="{x:Static p:Resources.SecurityWarningExpanderName}">
<StackPanel Orientation="Vertical" Margin="0,6,0,0">
<Label Content="{x:Static p:Resources.PreferencesViewTrustWarningHeader}"
Padding="0,5,5,5"
FontSize="13"
Foreground="{StaticResource PreferencesWindowFontColor}"/>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>

<StackPanel Orientation="Horizontal" Margin="0,12,0,0" Grid.Row="0">
<ToggleButton Name="TrustWarningToggle"
Width="{StaticResource ToggleButtonWidth}"
Height="{StaticResource ToggleButtonHeight}"
VerticalAlignment="Center"
IsChecked="False"
Style="{StaticResource EllipseToggleButton1}"/>
<Label Content="{x:Static p:Resources.PreferencesViewTrustWarningLabel}"
Margin="10,0,0,0"
VerticalAlignment="Center"
Foreground="{StaticResource PreferencesWindowFontColor}"/>
<Label HorizontalAlignment="Left"
Name="TrustWarningInfoLabel"
VerticalAlignment="Center"
Height="26"
Width="53"
Margin="0 3 0 0" >
<Label.ToolTip>
<ToolTip Content="{x:Static p:Resources.PreferencesViewTrustWarningTooltipText}" Style="{StaticResource GenericToolTipLight}"/>
</Label.ToolTip>
<Label.Content>
<fa:ImageAwesome Width="15" Height="15" VerticalAlignment="Bottom" HorizontalAlignment="Left" Icon="QuestionCircleOutline" Foreground="{StaticResource PreferencesWindowFontColor}"/>
</Label.Content>
</Label>
</StackPanel>
</Grid>
</StackPanel>
</Expander>

<!--This Grid row contains the Trusted Paths section-->
<Expander x:Name="TrustedPathsExpander"
Grid.Row="1"
Style="{StaticResource MenuExpanderStyle}"
IsExpanded="{Binding PreferencesTabs[Features].ExpanderActive, Converter={StaticResource ExpandersBindingConverter}, ConverterParameter=TrustedPathsExpander}"
Header="{x:Static p:Resources.TrustedPathsExpanderName}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Vertical" Margin="0,6,0,0" Grid.Row="0">
<Button x:Name="AddPath"
HorizontalAlignment="Left"
Margin="0"
Content="{x:Static p:Resources.SecurityPathAddPathButtonName}"
Command="{}">
<Button.Style>
<Style BasedOn="{StaticResource SolidButtonStyle}" TargetType="{x:Type Button}">
<Setter Property="IsEnabled" Value="True"/>
</Style>
</Button.Style>
</Button>
</StackPanel>
</Grid>
</Expander>
</Grid>
</TabItem>
</TabControl>
</Grid>
</Grid>
Expand Down
8 changes: 8 additions & 0 deletions src/DynamoUtilities/DebugModes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ public class DebugMode
public bool IsEnabled;
}

/// <summary>
/// Adds a debug mode
/// </summary>
/// <param name="name">Name of the debug mode</param>
/// <param name="description">Name about the debug mode</param>
/// /// <param name="isEnabled">Sets if the debug mode should be enabled on startup</param>
internal static void AddDebugMode(string name, string description, bool isEnabled = false)
{
debugModes[name] = new DebugMode()
Expand All @@ -48,6 +54,8 @@ private static void RegisterDebugModes()
{
// Register app wide new debug modes here.
AddDebugMode("DumpByteCode", "Dumps bytecode to a log file in a folder called ByteCodeLogs located in the current working dirrectory.", false);

AddDebugMode("DynamoPreferencesMenuDebugMode", "Enable/Disable the Preferences Panel new features in the Dynamo menu.", false);
}

internal static void LoadDebugModesStatusFromConfig(string configPath)
Expand Down