Skip to content

Commit

Permalink
feat: add access group dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
XavierChanth committed Oct 11, 2024
1 parent d3f442c commit 405997d
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 21 deletions.
4 changes: 3 additions & 1 deletion tools/windows-installer/NoPortsInstaller/Controller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class Controller
public string DeviceName { get; set; }
public string RegionAtsign { get; set; }
public string AdditionalArgs { get; set; }
public string AccessGroup { get; set; }
public bool IsInstalled
{
get { return Directory.Exists(InstallDirectory); }
Expand Down Expand Up @@ -61,6 +62,7 @@ public Controller()
AdditionalArgs = "";
Pages = [];
IsInstalled = false;
AccessGroup = "Users";
LogEnvironment();
}

Expand Down Expand Up @@ -214,7 +216,7 @@ private void CreateDirectories(string userHome)
DirectorySecurity securityRules = new();
DirectoryInfo di;
securityRules.AddAccessRule(
new FileSystemAccessRule("Users", FileSystemRights.Modify, AccessControlType.Allow)
new FileSystemAccessRule(AccessGroup, FileSystemRights.ExecuteFile, AccessControlType.Allow)
);
List<string> directories =
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,10 @@ private void DeviceCombo_Initialized(object sender, EventArgs e)
_controller.PopulateAtsigns(comboBox);
}

private void ValidateInputs(object sender, SelectionChangedEventArgs e)
{
if (ClientCombo.Text == "" || DeviceCombo.Text == "")
{
NextPageButton.IsEnabled = false;
}
else
{
NextPageButton.IsEnabled = true;
}
}

private void ValidateInputs(object sender, TextChangedEventArgs e)
{
if (ClientCombo.Text == "" || DeviceCombo.Text == "" || DeviceNameText.ToString() == "" )
private void ValidateInputs(object sender, dynamic e)
{
if (ClientCombo.Text == "" || DeviceCombo.Text == "" || DeviceNameText.Text == "")
{
NextPageButton.IsEnabled = false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<ColumnDefinition Width="23*"/>
</Grid.ColumnDefinitions>
<TextBox x:Name="AdditionalArgs" Grid.ColumnSpan="5" HorizontalAlignment="Left" Margin="22,28,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="219" Height="45" RenderTransformOrigin="0.501,0.621"/>
<Label Content="Additional Arguments:" HorizontalAlignment="Left" Height="28" VerticalAlignment="Top" Width="272" FontSize="11" Grid.ColumnSpan="6" Margin="10,0,0,0"/>
<Label Content="Additional NoPorts Arguments:" HorizontalAlignment="Left" Height="28" VerticalAlignment="Top" Width="272" FontSize="11" Grid.ColumnSpan="6" Margin="10,0,0,0"/>
</Grid>
</Grid>
</Grid>
Expand Down
2 changes: 2 additions & 0 deletions tools/windows-installer/NoPortsInstaller/Pages/Setup.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,7 @@
<Button x:Name="Onboard" Content="Activate atSign" HorizontalAlignment="Left" Height="24" Margin="176,221,0,0" VerticalAlignment="Top" Width="154" RenderTransformOrigin="0.536,-0.009" Grid.ColumnSpan="3" Click="Onboard_Click"/>
<Button x:Name="Apkam_Enroll" Content="Generate Keys" HorizontalAlignment="Left" Height="24" Margin="176,256,0,0" VerticalAlignment="Top" Width="154" RenderTransformOrigin="0.536,-0.009" Grid.ColumnSpan="3" Click="Enroll_Click"/>
<Button x:Name="Apkam_Otp" Content="Manage Keys" HorizontalAlignment="Left" Height="24" Margin="176,292,0,0" VerticalAlignment="Top" Width="154" RenderTransformOrigin="0.536,-0.009" Grid.ColumnSpan="3" Click="Otp_Click"/>
<Label Content="Access Group:" HorizontalAlignment="Left" Height="28" VerticalAlignment="Top" Width="136" Margin="39,264,0,0" FontSize="11" Grid.Column="2"/>
<TextBox x:Name="AccessGroupText" HorizontalAlignment="Left" Margin="39,292,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="133" Height="24" TextChanged="AccessGroupText_TextChanged" Grid.Column="2" />
</Grid>
</Page>
19 changes: 14 additions & 5 deletions tools/windows-installer/NoPortsInstaller/Pages/Setup.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ namespace NoPortsInstaller.Pages
public partial class Setup : Page
{
private readonly Controller _controller;
public Setup()

public Setup()
{
InitializeComponent();
_controller = App.ControllerInstance;
}
_controller = App.ControllerInstance;
AccessGroupText.Text = _controller.AccessGroup;
}

private void OpenDialogButton_Click(object sender, RoutedEventArgs e)
private void OpenDialogButton_Click(object sender, RoutedEventArgs e)
{
OpenFolderDialog dialog = new();
dialog.InitialDirectory = _controller.InstallDirectory;
Expand Down Expand Up @@ -58,6 +60,13 @@ private void Otp_Click(object sender, RoutedEventArgs e)
_controller.LoadPages(InstallType.Approve);
_controller.NextPage();
}
}

private void AccessGroupText_TextChanged(object sender, TextChangedEventArgs e)
{
InstallLogger.Log(AccessGroupText.Text);
InstallLogger.DumpLog();
_controller.AccessGroup = AccessGroupText.Text;
}
}
}

0 comments on commit 405997d

Please sign in to comment.