support active directory trust relationships

This commit is contained in:
Gary Sharp
2020-11-26 15:01:03 +11:00
parent 4fca015afa
commit e531ffe2b7
10 changed files with 239 additions and 173 deletions
@@ -241,17 +241,17 @@
</tr>
<tr>
<th style="width: 135px">
Forest:
Directory:
</th>
<td>
@if (Model.ADForestServers == null)
@if (Model.ADAllServers == null)
{
<div>
@Html.CheckBoxFor(m => m.ADSearchAllForestServers, new { disabled = "disabled" }) @Html.LabelFor(m => m.ADSearchAllForestServers)
@Html.CheckBoxFor(m => m.ADSearchAllServers, new { disabled = "disabled" }) @Html.LabelFor(m => m.ADSearchAllServers)
</div>
<div class="info-box">
<p class="fa-p">
<i class="fa fa-info-circle"></i>Forest servers are currently being retrieved.<br />
<i class="fa fa-info-circle"></i>Directory servers are currently being retrieved.<br />
Try refreshing this page in a moment.
</p>
</div>
@@ -260,28 +260,28 @@
{
if (canConfigAD)
{
var canSearchEntireForest = (Model.ADForestServers.Count <= Disco.Services.Interop.ActiveDirectory.ActiveDirectory.MaxForestServerSearch);
var canSearchEntireDirectory = (Model.ADAllServers.Count <= Disco.Services.Interop.ActiveDirectory.ActiveDirectory.MaxAllServerSearch);
<div>
@if (!canSearchEntireForest)
@if (!canSearchEntireDirectory)
{
@Html.CheckBoxFor(m => m.ADSearchAllForestServers, new { disabled = "disabled" }) @Html.LabelFor(m => m.ADSearchAllForestServers)
@Html.CheckBoxFor(m => m.ADSearchAllServers, new { disabled = "disabled" }) @Html.LabelFor(m => m.ADSearchAllServers)
<div class="info-box">
<p class="fa-p">
<i class="fa fa-exclamation-circle warning"></i>Disco will not search entire forests which consist of more than @(Disco.Services.Interop.ActiveDirectory.ActiveDirectory.MaxForestServerSearch) servers. Only servers within this site will be searched.
<i class="fa fa-exclamation-circle warning"></i>Disco will not search the entire directory which consists of more than @(Disco.Services.Interop.ActiveDirectory.ActiveDirectory.MaxAllServerSearch) servers. Only servers within this site will be searched.
</p>
</div>
}
else
{
@Html.CheckBoxFor(m => m.ADSearchAllForestServers) @Html.LabelFor(m => m.ADSearchAllForestServers) @AjaxHelpers.AjaxLoader()
@Html.CheckBoxFor(m => m.ADSearchAllServers) @Html.LabelFor(m => m.ADSearchAllServers) @AjaxHelpers.AjaxLoader()
<div class="info-box">
<p class="fa-p">
<i class="fa fa-info-circle"></i>If this setting is enabled, Disco will query all servers within the forest rather than only servers within this site.
<i class="fa fa-info-circle"></i>If this setting is enabled, Disco will query all servers within the directory rather than only servers within this site.
</p>
</div>
<script>
$(function () {
document.DiscoFunctions.PropertyChangeHelper($('#ADSearchAllForestServers'), null, '@(Url.Action(MVC.API.System.UpdateActiveDirectorySearchAllForestServers()))', 'SearchAllForestServers');
document.DiscoFunctions.PropertyChangeHelper($('#ADSearchAllServers'), null, '@(Url.Action(MVC.API.System.UpdateActiveDirectorySearchAllServers()))', 'SearchAllServers');
});
</script>
}
@@ -290,10 +290,10 @@
else
{
<div>
@Html.CheckBoxFor(m => m.ADSearchAllForestServers, new { disabled = "disabled" }) @Html.LabelFor(m => m.ADSearchAllForestServers)
@Html.CheckBoxFor(m => m.ADSearchAllServers, new { disabled = "disabled" }) @Html.LabelFor(m => m.ADSearchAllServers)
<div class="info-box">
<p class="fa-p">
<i class="fa fa-info-circle"></i>If this setting is enabled, Disco will query all servers within the forest rather than only servers within this site.
<i class="fa fa-info-circle"></i>If this setting is enabled, Disco will query all servers within the directory rather than only servers within this site.
</p>
</div>
</div>
@@ -301,12 +301,12 @@
<div>
<hr />
<span>All Servers:</span>
<ul id="Config_System_AD_ForestServers" class="none">
<ul id="Config_System_AD_AllServers" class="none">
@{
var domainIndex = Model.ADDomains.ToDictionary(d => d.Name, StringComparer.OrdinalIgnoreCase);
foreach (var server in Model.ADForestServers.OrderBy(s => s))
var siteServers = Model.ADServers.Where(s => s.IsSiteServer).ToDictionary(s => s.Name, StringComparer.OrdinalIgnoreCase);
foreach (var server in Model.ADAllServers.OrderBy(s => s))
{
var isSiteServer = Model.ADServers.Any(s => s.IsSiteServer && s.Name.Equals(server, StringComparison.OrdinalIgnoreCase));
var serverDescription = server;
if (server.Contains('.'))
{
@@ -317,7 +317,7 @@
}
}
<li>
<code>@serverDescription</code>@if (isSiteServer)
<code>@serverDescription</code>@if (siteServers.ContainsKey(server))
{ <i class="fa fa-building-o information fa-fw" title="Site Server"></i> }
</li>
}
@@ -326,7 +326,7 @@
<script>
$(function () {
var toManyServers = 5;
var ul = $('#Config_System_AD_ForestServers');
var ul = $('#Config_System_AD_AllServers');
var ulLi = ul.find('li');
if (ulLi.length > toManyServers) {
var liMore = $('<li>').append(
@@ -487,7 +487,7 @@
// Set Buttons
$dialog.dialog('option', 'buttons', {
'Search Entire Forest': function () {
'Search Entire Directory': function () {
var $this = $(this);
$this.css('overflow', 'hidden');
$this.dialog("disable");
@@ -845,7 +845,7 @@ WriteLiteral(" </div>\r\n </td>\r\n </tr>\r\n
WriteLiteral(" style=\"width: 135px\"");
WriteLiteral(">\r\n Forest:\r\n </th>\r\n <td>\r\n");
WriteLiteral(">\r\n Directory:\r\n </th>\r\n <td>\r\n");
#line 247 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
@@ -855,7 +855,7 @@ WriteLiteral(">\r\n Forest:\r\n </th>\r\n <
#line hidden
#line 247 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
if (Model.ADForestServers == null)
if (Model.ADAllServers == null)
{
@@ -867,7 +867,7 @@ WriteLiteral(" ");
#line 250 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
Write(Html.CheckBoxFor(m => m.ADSearchAllForestServers, new { disabled = "disabled" }));
Write(Html.CheckBoxFor(m => m.ADSearchAllServers, new { disabled = "disabled" }));
#line default
@@ -876,7 +876,7 @@ WriteLiteral(" ");
#line 250 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
Write(Html.LabelFor(m => m.ADSearchAllForestServers));
Write(Html.LabelFor(m => m.ADSearchAllServers));
#line default
@@ -895,9 +895,9 @@ WriteLiteral(">\r\n <i");
WriteLiteral(" class=\"fa fa-info-circle\"");
WriteLiteral("></i>Forest servers are currently being retrieved.<br />\r\n " +
" Try refreshing this page in a moment.\r\n </p>\r\n " +
" </div>\r\n");
WriteLiteral("></i>Directory servers are currently being retrieved.<br />\r\n " +
" Try refreshing this page in a moment.\r\n </p>\r\n " +
" </div>\r\n");
#line 258 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
@@ -906,7 +906,7 @@ WriteLiteral("></i>Forest servers are currently being retrieved.<br />\r\n
{
if (canConfigAD)
{
var canSearchEntireForest = (Model.ADForestServers.Count <= Disco.Services.Interop.ActiveDirectory.ActiveDirectory.MaxForestServerSearch);
var canSearchEntireDirectory = (Model.ADAllServers.Count <= Disco.Services.Interop.ActiveDirectory.ActiveDirectory.MaxAllServerSearch);
#line default
@@ -921,7 +921,7 @@ WriteLiteral(" <div>\r\n");
#line hidden
#line 265 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
if (!canSearchEntireForest)
if (!canSearchEntireDirectory)
{
@@ -929,27 +929,27 @@ WriteLiteral(" <div>\r\n");
#line hidden
#line 267 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
Write(Html.CheckBoxFor(m => m.ADSearchAllForestServers, new { disabled = "disabled" }));
Write(Html.CheckBoxFor(m => m.ADSearchAllServers, new { disabled = "disabled" }));
#line default
#line hidden
#line 267 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
#line default
#line hidden
#line 267 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
Write(Html.LabelFor(m => m.ADSearchAllForestServers));
Write(Html.LabelFor(m => m.ADSearchAllServers));
#line default
#line hidden
#line 267 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
#line default
@@ -966,11 +966,11 @@ WriteLiteral(">\r\n <i");
WriteLiteral(" class=\"fa fa-exclamation-circle warning\"");
WriteLiteral("></i>Disco will not search entire forests which consist of more than ");
WriteLiteral("></i>Disco will not search the entire directory which consists of more than ");
#line 270 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
Write(Disco.Services.Interop.ActiveDirectory.ActiveDirectory.MaxForestServerSearch);
Write(Disco.Services.Interop.ActiveDirectory.ActiveDirectory.MaxAllServerSearch);
#line default
@@ -989,40 +989,40 @@ WriteLiteral(" servers. Only servers within this site will be searched.\r\n
#line hidden
#line 276 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
Write(Html.CheckBoxFor(m => m.ADSearchAllForestServers));
Write(Html.CheckBoxFor(m => m.ADSearchAllServers));
#line default
#line hidden
#line 276 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
#line default
#line hidden
#line 276 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
Write(Html.LabelFor(m => m.ADSearchAllForestServers));
Write(Html.LabelFor(m => m.ADSearchAllServers));
#line default
#line hidden
#line 276 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
#line default
#line hidden
#line 276 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
Write(AjaxHelpers.AjaxLoader());
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
#line 276 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
#line default
@@ -1039,23 +1039,23 @@ WriteLiteral(">\r\n <i");
WriteLiteral(" class=\"fa fa-info-circle\"");
WriteLiteral("></i>If this setting is enabled, Disco will query all servers within the forest r" +
"ather than only servers within this site.\r\n <" +
"/p>\r\n </div>\r\n");
WriteLiteral("></i>If this setting is enabled, Disco will query all servers within the director" +
"y rather than only servers within this site.\r\n " +
" </p>\r\n </div>\r\n");
WriteLiteral(" <script>\r\n $(f" +
"unction () {\r\n document.DiscoFunctions.Pr" +
"opertyChangeHelper($(\'#ADSearchAllForestServers\'), null, \'");
"opertyChangeHelper($(\'#ADSearchAllServers\'), null, \'");
#line 284 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
Write(Url.Action(MVC.API.System.UpdateActiveDirectorySearchAllForestServers()));
Write(Url.Action(MVC.API.System.UpdateActiveDirectorySearchAllServers()));
#line default
#line hidden
WriteLiteral("\', \'SearchAllForestServers\');\r\n });\r\n " +
" </script>\r\n");
WriteLiteral("\', \'SearchAllServers\');\r\n });\r\n " +
" </script>\r\n");
#line 287 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
@@ -1081,7 +1081,7 @@ WriteLiteral(" ");
#line 293 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
Write(Html.CheckBoxFor(m => m.ADSearchAllForestServers, new { disabled = "disabled" }));
Write(Html.CheckBoxFor(m => m.ADSearchAllServers, new { disabled = "disabled" }));
#line default
@@ -1090,7 +1090,7 @@ WriteLiteral(" ");
#line 293 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
Write(Html.LabelFor(m => m.ADSearchAllForestServers));
Write(Html.LabelFor(m => m.ADSearchAllServers));
#line default
@@ -1107,9 +1107,9 @@ WriteLiteral(">\r\n <i");
WriteLiteral(" class=\"fa fa-info-circle\"");
WriteLiteral("></i>If this setting is enabled, Disco will query all servers within the forest r" +
"ather than only servers within this site.\r\n </p>\r" +
"\n </div>\r\n </div>\r\n");
WriteLiteral("></i>If this setting is enabled, Disco will query all servers within the director" +
"y rather than only servers within this site.\r\n </" +
"p>\r\n </div>\r\n </div>\r\n");
#line 300 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
@@ -1121,7 +1121,7 @@ WriteLiteral("></i>If this setting is enabled, Disco will query all servers with
WriteLiteral(" <div>\r\n <hr />\r\n " +
" <span>All Servers:</span>\r\n <ul");
WriteLiteral(" id=\"Config_System_AD_ForestServers\"");
WriteLiteral(" id=\"Config_System_AD_AllServers\"");
WriteLiteral(" class=\"none\"");
@@ -1137,9 +1137,9 @@ WriteLiteral(">\r\n");
#line 305 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
var domainIndex = Model.ADDomains.ToDictionary(d => d.Name, StringComparer.OrdinalIgnoreCase);
foreach (var server in Model.ADForestServers.OrderBy(s => s))
var siteServers = Model.ADServers.Where(s => s.IsSiteServer).ToDictionary(s => s.Name, StringComparer.OrdinalIgnoreCase);
foreach (var server in Model.ADAllServers.OrderBy(s => s))
{
var isSiteServer = Model.ADServers.Any(s => s.IsSiteServer && s.Name.Equals(server, StringComparison.OrdinalIgnoreCase));
var serverDescription = server;
if (server.Contains('.'))
{
@@ -1167,7 +1167,7 @@ WriteLiteral("</code>");
#line 320 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
if (isSiteServer)
if (siteServers.ContainsKey(server))
{
#line default
@@ -1201,7 +1201,7 @@ WriteLiteral(@"
<script>
$(function () {
var toManyServers = 5;
var ul = $('#Config_System_AD_ForestServers');
var ul = $('#Config_System_AD_AllServers');
var ulLi = ul.find('li');
if (ulLi.length > toManyServers) {
var liMore = $('<li>').append(
@@ -1572,35 +1572,35 @@ WriteLiteral("\', null, function (data) {\r\n
" }).fancytree(\'getTree\');\r\n\r\n tre" +
"e.$container.css(\'position\', \'relative\');\r\n\r\n " +
" // Set Buttons\r\n $dialog.dialog(\'opt" +
"ion\', \'buttons\', {\r\n \'Search Entire F" +
"orest\': function () {\r\n var $this" +
" = $(this);\r\n $this.css(\'overflow" +
"\', \'hidden\');\r\n $this.dialog(\"dis" +
"able\");\r\n $this.dialog(\"option\", " +
"\"buttons\", null);\r\n\r\n var $form =" +
" $dialog.find(\'form\');\r\n $form.su" +
"bmit();\r\n },\r\n " +
" \'Save\': function () {\r\n " +
" var $this = $(this);\r\n " +
" $this.css(\'overflow\', \'hidden\');\r\n " +
" $this.dialog(\"disable\");\r\n $t" +
"his.dialog(\"option\", \"buttons\", null);\r\n\r\n " +
" var nodes = tree.getSelectedNodes();\r\n " +
" var $form = $dialog.find(\'form\');\r\n " +
" $.each(nodes, function (i, node) {\r\n " +
" $(\'<input>\').attr({ \'type\': \'hidden\', \'name\': \'Contai" +
"ners\', \'value\': node.key }).appendTo($form);\r\n " +
" });\r\n $form.submit(" +
");\r\n }\r\n " +
" });\r\n\r\n // Select & Expand\r\n " +
" selectDistinguishedNames();\r\n\r\n " +
" tree.options.fx = { height: \"toggle\", duration: 200" +
" };\r\n });\r\n\r\n " +
"}\r\n\r\n selectDistinguishedNames();\r\n\r\n " +
" $dialog.dialog(\'open\');\r\n\r\n r" +
"eturn false;\r\n }\r\n\r\n $(\'#C" +
"onfig_System_AD_SearchScope_Update\').click(update);\r\n });" +
"\r\n </script>\r\n");
"ion\', \'buttons\', {\r\n \'Search Entire D" +
"irectory\': function () {\r\n var $t" +
"his = $(this);\r\n $this.css(\'overf" +
"low\', \'hidden\');\r\n $this.dialog(\"" +
"disable\");\r\n $this.dialog(\"option" +
"\", \"buttons\", null);\r\n\r\n var $for" +
"m = $dialog.find(\'form\');\r\n $form" +
".submit();\r\n },\r\n " +
" \'Save\': function () {\r\n " +
" var $this = $(this);\r\n " +
" $this.css(\'overflow\', \'hidden\');\r\n " +
" $this.dialog(\"disable\");\r\n " +
" $this.dialog(\"option\", \"buttons\", null);\r\n\r\n " +
" var nodes = tree.getSelectedNodes();\r\n " +
" var $form = $dialog.find(\'form\');\r\n " +
" $.each(nodes, function (i, node) {\r\n " +
" $(\'<input>\').attr({ \'type\': \'hidden\', \'name\': \'Con" +
"tainers\', \'value\': node.key }).appendTo($form);\r\n " +
" });\r\n $form.subm" +
"it();\r\n }\r\n " +
" });\r\n\r\n // Select & Expand\r" +
"\n selectDistinguishedNames();\r\n\r\n " +
" tree.options.fx = { height: \"toggle\", duration: " +
"200 };\r\n });\r\n\r\n " +
" }\r\n\r\n selectDistinguishedNames();\r\n\r\n " +
" $dialog.dialog(\'open\');\r\n\r\n " +
" return false;\r\n }\r\n\r\n $(" +
"\'#Config_System_AD_SearchScope_Update\').click(update);\r\n " +
"});\r\n </script>\r\n");
#line 532 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"