Skip to content

Commit 07a3cc1

Browse files
committed
Feature (settings): remember Remote Desktop AD import LDAP search base
Store RemoteDesktop_ActiveDirectoryImportLdapSearchBase after a successful directory query and prefill the import dialog on next open.
1 parent 6cdec70 commit 07a3cc1

2 files changed

Lines changed: 24 additions & 1 deletion

File tree

Source/NETworkManager.Settings/SettingsInfo.cs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using DnsClient;
1+
using DnsClient;
22
using Lextm.SharpSnmpLib.Messaging;
33
using NETworkManager.Controls;
44
using NETworkManager.Models;
@@ -2682,6 +2682,24 @@ public double RemoteDesktop_ProfileWidth
26822682
}
26832683
}
26842684

2685+
private string _remoteDesktop_ActiveDirectoryImportLdapSearchBase;
2686+
2687+
/// <summary>
2688+
/// Last LDAP search base (OU DN) used for Remote Desktop Active Directory computer import.
2689+
/// </summary>
2690+
public string RemoteDesktop_ActiveDirectoryImportLdapSearchBase
2691+
{
2692+
get => _remoteDesktop_ActiveDirectoryImportLdapSearchBase;
2693+
set
2694+
{
2695+
if (value == _remoteDesktop_ActiveDirectoryImportLdapSearchBase)
2696+
return;
2697+
2698+
_remoteDesktop_ActiveDirectoryImportLdapSearchBase = value;
2699+
OnPropertyChanged();
2700+
}
2701+
}
2702+
26852703
#endregion
26862704

26872705
#region PowerShell

Source/NETworkManager/ViewModels/ImportAdComputersViewModel.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ public ImportAdComputersViewModel(Window parentWindow, string suggestedTargetGro
3838
? GroupNames.FirstOrDefault() ?? string.Empty
3939
: suggestedTargetGroup;
4040

41+
LdapSearchBase = SettingsManager.Current.RemoteDesktop_ActiveDirectoryImportLdapSearchBase ?? string.Empty;
42+
4143
ImportCommand = new RelayCommand(_ => ImportAction(), Import_CanExecute);
4244
CancelCommand = new RelayCommand(_ => CancelAction());
4345
}
@@ -166,6 +168,9 @@ await DialogHelper.ShowMessageAsync(_parentWindow, Strings.Error,
166168
return;
167169
}
168170

171+
SettingsManager.Current.RemoteDesktop_ActiveDirectoryImportLdapSearchBase = searchBase;
172+
SettingsManager.Save();
173+
169174
var targetGroupInfo = ProfileManager.LoadedProfileFileData.Groups
170175
.FirstOrDefault(group => group.Name.Equals(targetGroup, StringComparison.OrdinalIgnoreCase));
171176

0 commit comments

Comments
 (0)