Feature #42: Active Directory Interop Upgrade

AD Interop moved to Disco.Services; Supports multi-domain environments,
sites, and searching restricted with OUs.
This commit is contained in:
Gary Sharp
2014-04-10 17:58:04 +10:00
parent b841c6b2c0
commit db73cc1a12
218 changed files with 6383 additions and 2535 deletions
@@ -2,6 +2,7 @@
using Disco.Models.UI.Config.AuthorizationRole;
using Disco.Services.Authorization;
using Disco.Services.Authorization.Roles;
using Disco.Services.Interop.ActiveDirectory;
using Disco.Services.Plugins.Features.UIExtension;
using Disco.Services.Users;
using Disco.Services.Web;
@@ -27,7 +28,7 @@ namespace Disco.Web.Areas.Config.Controllers
var token = RoleToken.FromAuthorizationRole(ar);
var subjects = token.SubjectIds == null ? new List<Models.AuthorizationRole.ShowModel.SubjectDescriptor>() :
token.SubjectIds.Select(subjectId => Disco.BI.Interop.ActiveDirectory.ActiveDirectory.GetObject(subjectId))
token.SubjectIds.Select(subjectId => ActiveDirectory.RetrieveObject(subjectId))
.Where(item => item != null)
.Select(item => Models.AuthorizationRole.ShowModel.SubjectDescriptor.FromActiveDirectoryObject(item))
.OrderBy(item => item.Name).ToList();
@@ -2,6 +2,7 @@
using Disco.Models.Repository;
using Disco.Models.UI.Config.DeviceProfile;
using Disco.Services.Authorization;
using Disco.Services.Interop.ActiveDirectory;
using Disco.Services.Plugins;
using Disco.Services.Plugins.Features.CertificateProvider;
using Disco.Services.Plugins.Features.UIExtension;
@@ -75,7 +76,8 @@ namespace Disco.Web.Areas.Config.Controllers
{
ComputerNameTemplate = DeviceProfile.DefaultComputerNameTemplate,
ProvisionADAccount = true,
DistributionType = DeviceProfile.DistributionTypes.OneToMany
DistributionType = DeviceProfile.DistributionTypes.OneToMany,
OrganisationalUnit = ActiveDirectory.PrimaryDomain.GetDefaultComputerContainer()
}
};
@@ -2,6 +2,7 @@
using Disco.Models.Services.Jobs.JobQueues;
using Disco.Models.UI.Config.JobQueue;
using Disco.Services.Authorization;
using Disco.Services.Interop.ActiveDirectory;
using Disco.Services.Jobs.JobQueues;
using Disco.Services.Plugins.Features.UIExtension;
using Disco.Services.Web;
@@ -28,7 +29,7 @@ namespace Disco.Web.Areas.Config.Controllers
var token = JobQueueToken.FromJobQueue(jq);
var subjects = token.SubjectIds == null ? new List<Models.JobQueue.ShowModel.SubjectDescriptor>() :
token.SubjectIds.Select(subjectId => Disco.BI.Interop.ActiveDirectory.ActiveDirectory.GetObject(subjectId))
token.SubjectIds.Select(subjectId => ActiveDirectory.RetrieveObject(subjectId))
.Where(item => item != null)
.Select(item => Models.JobQueue.ShowModel.SubjectDescriptor.FromActiveDirectoryObject(item))
.OrderBy(item => item.Name).ToList();
@@ -12,20 +12,5 @@ namespace Disco.Web.Areas.Config.Controllers
var m = Models.SystemConfig.IndexModel.FromConfiguration(Database.DiscoConfiguration);
return View(m);
}
[DiscoAuthorizeAll(Claims.Config.System.Show, Claims.Config.System.ConfigureProxy), HttpPost]
public virtual ActionResult Index(Models.SystemConfig.IndexModel config)
{
if (ModelState.IsValid)
{
config.ToConfiguration(Database);
return RedirectToAction(MVC.Config.Config.Index());
}
else
{
return View();
}
}
}
}
@@ -40,7 +40,7 @@ namespace Disco.Web.Areas.Config.Models.AuthorizationRole
{
var item = new SubjectDescriptor()
{
Id = ADObject.SamAccountName,
Id = ADObject.NetBiosId,
Name = ADObject.Name
};
@@ -8,6 +8,9 @@ using System.Data.SqlClient;
using Disco.Data.Repository;
using Disco.Models.BI.Interop.Community;
using Disco.Services.Tasks;
using Disco.Models.Interop.ActiveDirectory;
using System.DirectoryServices.ActiveDirectory;
using Disco.Services.Interop.ActiveDirectory;
namespace Disco.Web.Areas.Config.Models.SystemConfig
{
@@ -72,6 +75,20 @@ namespace Disco.Web.Areas.Config.Models.SystemConfig
}
#endregion
#region Active Directory
[Display(Name="Search Entire Forest")]
public bool ADSearchEntireForest { get; set; }
public ActiveDirectoryDomain ADPrimaryDomain { get; set; }
public List<ActiveDirectoryDomain> ADAdditionalDomains { get; set; }
public ActiveDirectorySite ADSite { get; set; }
public List<Tuple<DirectoryServer, bool>> ADSiteServers { get; set; }
public List<Tuple<string, ActiveDirectoryDomain, string>> ADSearchContainers { get; set; }
public List<string> ADForestServers { get; set; }
#endregion
#region Proxy
public string ProxyAddress { get; set; }
public int ProxyPort { get; set; }
@@ -87,7 +104,7 @@ namespace Disco.Web.Areas.Config.Models.SystemConfig
public static IndexModel FromConfiguration(SystemConfiguration config)
{
return new IndexModel()
var m = new IndexModel()
{
DiscoVersion = typeof(DiscoApplication).Assembly.GetName().Version,
DataStoreLocation = config.DataStoreLocation,
@@ -100,27 +117,33 @@ namespace Disco.Web.Areas.Config.Models.SystemConfig
UpdateNextScheduled = Disco.BI.Interop.Community.UpdateCheckTask.NextScheduled,
UpdateBetaDeployment = config.UpdateBetaDeployment
};
}
public void ToConfiguration(DiscoDataContext Database)
{
SystemConfiguration config = Database.DiscoConfiguration;
//config.DataStoreLocation = DataStoreLocation;
config.ProxyAddress = ProxyAddress;
config.ProxyPort = ProxyPort;
config.ProxyUsername = ProxyUsername;
config.ProxyPassword = ProxyPassword;
DiscoApplication.SetGlobalProxy(ProxyAddress, ProxyPort, ProxyUsername, ProxyPassword);
Database.SaveChanges();
// Try and check for updates if needed - After Proxy Changed
if (Database.DiscoConfiguration.UpdateLastCheck == null
|| Database.DiscoConfiguration.UpdateLastCheck.ResponseTimestamp < DateTime.Now.AddDays(-1))
// AD
m.ADPrimaryDomain = ActiveDirectory.PrimaryDomain;
m.ADAdditionalDomains = ActiveDirectory.Domains.Where(d => d != m.ADPrimaryDomain).ToList();
m.ADSite = ActiveDirectory.Site;
m.ADSiteServers = m.ADSite.Servers.Cast<DirectoryServer>().Select(s => Tuple.Create(s, s.Reachable())).ToList();
var configSearchContainers = config.ActiveDirectory.SearchContainers;
m.ADSearchContainers = configSearchContainers == null ? null : configSearchContainers.Select(c =>
{
Disco.BI.Interop.Community.UpdateCheckTask.ScheduleNow();
}
}
var d = ActiveDirectory.GetDomainByDistinguishedName(c);
return Tuple.Create(c, d, d.GetFriendlyOrganisationalUnitName(c));
}).ToList();
var loadForestServersTask = ActiveDirectory.LoadForestServersAsync();
if (loadForestServersTask.Wait(TimeSpan.FromSeconds(3)))
{
m.ADForestServers = loadForestServersTask.Result;
var configValue = config.ActiveDirectory.SearchEntireForest ?? true;
m.ADSearchEntireForest = configValue && m.ADForestServers.Count <= ActiveDirectory.MaxForestServerSearch;
}
else
{
m.ADForestServers = null;
m.ADSearchEntireForest = config.ActiveDirectory.SearchEntireForest ?? true;
}
return m;
}
}
}
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -29,6 +29,7 @@ namespace Disco.Web.Areas.Config.Views.AuthorizationRole
using Disco;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -29,6 +29,7 @@ namespace Disco.Web.Areas.Config.Views.AuthorizationRole
using Disco;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -35,6 +35,7 @@ namespace Disco.Web.Areas.Config.Views.AuthorizationRole
#line default
#line hidden
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -29,6 +29,7 @@ namespace Disco.Web.Areas.Config.Views.Config
using Disco;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -29,6 +29,7 @@ namespace Disco.Web.Areas.Config.Views.DeviceBatch
using Disco;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -29,6 +29,7 @@ namespace Disco.Web.Areas.Config.Views.DeviceBatch
using Disco;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -29,6 +29,7 @@ namespace Disco.Web.Areas.Config.Views.DeviceBatch
using Disco;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -29,6 +29,7 @@ namespace Disco.Web.Areas.Config.Views.DeviceBatch
using Disco;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -29,6 +29,7 @@ namespace Disco.Web.Areas.Config.Views.DeviceModel
using Disco;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -29,6 +29,7 @@ namespace Disco.Web.Areas.Config.Views.DeviceModel
using Disco;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -29,6 +29,7 @@ namespace Disco.Web.Areas.Config.Views.DeviceModel
using Disco;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -29,6 +29,7 @@ namespace Disco.Web.Areas.Config.Views.DeviceModel
using Disco;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
@@ -35,6 +35,7 @@
@Html.HiddenFor(model => model.DeviceProfile.ComputerNameTemplate)
@Html.HiddenFor(model => model.DeviceProfile.ProvisionADAccount)
@Html.HiddenFor(model => model.DeviceProfile.DistributionType)
@Html.HiddenFor(model => model.DeviceProfile.OrganisationalUnit)
<p class="actions">
<input type="submit" class="button" value="Create" />
</p>
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -29,6 +29,7 @@ namespace Disco.Web.Areas.Config.Views.DeviceProfile
using Disco;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
@@ -174,6 +175,17 @@ WriteLiteral(" ");
Write(Html.HiddenFor(model => model.DeviceProfile.DistributionType));
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral(" ");
#line 38 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
Write(Html.HiddenFor(model => model.DeviceProfile.OrganisationalUnit));
#line default
#line hidden
WriteLiteral("\r\n <p");
@@ -198,7 +210,7 @@ WriteLiteral(">\r\n $(function () {\r\n $(\'#Name\').focus().s
"\r\n </script>\r\n");
#line 47 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
#line 48 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
}
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -29,6 +29,7 @@ namespace Disco.Web.Areas.Config.Views.DeviceProfile
using Disco;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -29,6 +29,7 @@ namespace Disco.Web.Areas.Config.Views.DeviceProfile
using Disco;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
@@ -10,8 +10,8 @@
if (canConfig)
{
Html.BundleDeferred("~/Style/jQueryUI/dynatree");
Html.BundleDeferred("~/ClientScripts/Modules/jQueryUI-DynaTree");
Html.BundleDeferred("~/Style/Fancytree");
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-Fancytree");
}
}
<div id="configurationDeviceProfileShow" class="form" style="width: 640px">
@@ -322,7 +322,8 @@
</td>
</tr>
<tr>
<th>Computer Name<br />Template Expression:
<th>Computer Name<br />
Template Expression:
</th>
<td>@if (canConfig && canConfigExpression)
{
@@ -517,125 +518,135 @@
</td>
</tr>
<tr>
<th>Default Organisational Unit:
<th>Organisational Unit:
</th>
<td>@if (canConfig)
{
@Html.HiddenFor(model => model.DeviceProfile.OrganisationalUnit)
<div id="displayOrganisationalUnit" class="code">
<div id="DeviceProfile_OrganisationalUnit" class="code" data-value="@Model.DeviceProfile.OrganisationalUnit">
@if (string.IsNullOrEmpty(Model.DeviceProfile.OrganisationalUnit))
{
<span>{Default Computers Container}</span>
}
else
{
var domain = Disco.Services.Interop.ActiveDirectory.ActiveDirectory.GetDomainByDistinguishedName(Model.DeviceProfile.OrganisationalUnit);
<span>
@Disco.Services.Interop.ActiveDirectory.ActiveDirectoryExtensions.GetFriendlyOrganisationalUnitName(domain, Model.DeviceProfile.OrganisationalUnit)
</span>
}
</div>
<a id="changeOrganisationalUnit" href="#" class="button small">Change</a>@AjaxHelpers.AjaxLoader()
<div id="dialogOrganisationalUnit" title="Default Organisational Unit">
<div id="treeOrganisationalUnit">
<div id="dialogOrganisationalUnit" title="Organisational Unit" class="dialog">
<div id="treeOrganisationalUnit" class="organisationalUnitTree">
</div>
</div>
<script type="text/javascript">
$(function () {
var ouValue = $('#DeviceProfile_OrganisationalUnit');
var ouDisplay = $('#displayOrganisationalUnit');
var ouTree = $('#treeOrganisationalUnit');
var ouChangeLink = $('#changeOrganisationalUnit');
var ouTreeLoaded = false;
var ouFriendlyName = function (ou) {
return ou.replace(/ou=/gi, '').split(',').reverse().join(' > ');
};
var updateDisplayOrganisationalUnit = function () {
var value = ouValue.val();
if (value) {
ouDisplay.text(ouFriendlyName(value));
} else {
ouDisplay.text('{Default Computers Container}');
}
};
var ouSetUrl = '@Url.Action(MVC.API.DeviceProfile.UpdateOrganisationalUnit(Model.DeviceProfile.Id, null, true))';
var ouValue = $('#DeviceProfile_OrganisationalUnit').attr('data-value');
var $ouTree = null;
var ouTree = null;
var $dialog = null;
var ouSet = function (ou) {
$ajaxLoading = ouChangeLink.next('.ajaxLoading').show();
var data = { OrganisationalUnit: ou };
$.getJSON('@Url.Action(MVC.API.DeviceProfile.UpdateOrganisationalUnit(Model.DeviceProfile.Id, null))', data, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change Organisational Unit:\n' + response);
$ajaxLoading.hide();
} else {
ouValue.val(ou);
updateDisplayOrganisationalUnit();
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
});
var url = ouSetUrl + '&' + $.param({ OrganisationalUnit: ou })
window.location.href = url;
}
var ouUpdateTree = function () {
var dynaTree = ouTree.dynatree("getTree");
var value = ouValue.val();
if (value) {
dynaTree.activateKey(value);
} else {
var activeNode = dynaTree.getActiveNode();
if (activeNode)
activeNode.deactivate();
var expandNodeTree = function (node) {
var parent = node.parent;
if (parent) {
expandNodeTree(parent);
parent.setExpanded(true, { noAnimation: true, noEvents: false });
}
}
var expandAndFocusNode = function (nodeKey) {
if (ouTree) {
var ouNode = ouTree.getNodeByKey(ouValue);
if (ouNode) {
expandNodeTree(ouNode);
ouNode.setFocus(true);
ouNode.setActive(true);
var ouDialog = $('#dialogOrganisationalUnit').dialog({
autoOpen: false,
buttons: {
'Use Default Container': function () {
ouSet('');
$(this).dialog("close");
},
'Save': function () {
var node = ouTree.dynatree("getTree").getActiveNode();
if (node) {
ouSet(node.data.key);
$(this).dialog("close");
} else {
alert('Select an Organisational Unit to Save')
}
var li = ouNode.li;
var liOffset = li.offsetParent;
if (li.offsetTop + li.offsetHeight > liOffset.offsetHeight)
$(liOffset).animate({ 'scrollTop': li.offsetTop - liOffset.offsetHeight + li.offsetHeight + 4 }, 'fast');
}
},
draggable: false,
modal: true,
resizable: false,
width: 400,
height: 400
});
var ouChange = function () {
if (!ouTreeLoaded) {
$.getJSON('@(Url.Action(MVC.API.DeviceProfile.OrganisationalUnits()))', null, function (data) {
var dynatreeDataTransformer = function (element) {
var child = {
title: element.Name,
key: element.Path,
isFolder: true
}
if (element.Children) {
child.children = [];
for (var i = 0; i < element.Children.length; i++) {
child.children.push(dynatreeDataTransformer(element.Children[i]));
}
}
return child;
};
var dynatreeData = [];
for (var i = 0; i < data.length; i++) {
dynatreeData.push(dynatreeDataTransformer(data[i]));
}
ouTree.dynatree({
children: dynatreeData,
onActivate: function (node) {
//alert('node selected: ' + node.data.key);
}
});
ouTreeLoaded = true;
ouUpdateTree();
});
} else {
ouUpdateTree();
}
}
ouDialog.dialog('open');
var ouChange = function () {
if (!$dialog) {
$dialog = $('#dialogOrganisationalUnit').dialog({
autoOpen: false,
buttons: null,
draggable: false,
modal: true,
resizable: false,
width: 500,
height: 500
});
$ouTree = $('#treeOrganisationalUnit');
$dialog.css('overflow', 'visible');
$ouTree.css('height', '100%');
$.getJSON('@(Url.Action(MVC.API.System.DomainOrganisationalUnits()))', null, function (data) {
// Make 'Domains' unselectable
$.each(data, function (i, node) {
node.unselectable = true;
});
ouTree = $ouTree.fancytree({
source: data,
checkbox: false,
selectMode: 1,
keyboard: false,
fx: null
}).fancytree('getTree');
ouTree.$container.css('position', 'relative');
// Set Buttons
$dialog.dialog('option', 'buttons', {
'Use Default Container': function () {
var $this = $(this);
$this.css('overflow', 'hidden');
$this.dialog("disable");
$this.dialog("option", "buttons", null);
ouSet('');
},
'Save': function () {
var node = ouTree.getActiveNode();
if (node && node.key.substr(0, 3).toLowerCase() == 'ou=') {
var $this = $(this);
$this.css('overflow', 'hidden');
$this.dialog("disable");
$this.dialog("option", "buttons", null);
ouSet(node.key);
} else {
alert('Select an Organisational Unit to Save')
}
}
});
// Expand
expandAndFocusNode(ouValue);
ouTree.options.fx = { height: "toggle", duration: 200 };
});
}
$dialog.dialog('open');
if (ouTree) {
// Expand
expandAndFocusNode(ouValue);
}
return false;
};
ouChangeLink.click(ouChange);
updateDisplayOrganisationalUnit();
$('#changeOrganisationalUnit').click(ouChange);
});
</script>
}
@@ -648,8 +659,10 @@
}
else
{
var domain = Disco.Services.Interop.ActiveDirectory.ActiveDirectory.GetDomainByDistinguishedName(Model.DeviceProfile.OrganisationalUnit);
<span>
@string.Join(" > ", Model.DeviceProfile.OrganisationalUnit.Split(',').Select(s => s.Substring(3)).Reverse())
@Disco.Services.Interop.ActiveDirectory.ActiveDirectoryExtensions.GetFriendlyOrganisationalUnitName(domain, Model.DeviceProfile.OrganisationalUnit)
</span>
}
</div>
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34014
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -29,6 +29,7 @@ namespace Disco.Web.Areas.Config.Views.DeviceProfile
using Disco;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
@@ -56,8 +57,8 @@ namespace Disco.Web.Areas.Config.Views.DeviceProfile
if (canConfig)
{
Html.BundleDeferred("~/Style/jQueryUI/dynatree");
Html.BundleDeferred("~/ClientScripts/Modules/jQueryUI-DynaTree");
Html.BundleDeferred("~/Style/Fancytree");
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-Fancytree");
}
@@ -897,10 +898,10 @@ WriteLiteral(">&lt;None Allocated&gt;</span>\r\n");
#line default
#line hidden
WriteLiteral(" </td>\r\n </tr>\r\n <tr>\r\n <th>Computer Name<br " +
"/>Template Expression:\r\n </th>\r\n <td>");
"/>\r\n Template Expression:\r\n </th>\r\n <td>");
#line 327 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 328 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
if (canConfig && canConfigExpression)
{
@@ -908,42 +909,42 @@ WriteLiteral(" </td>\r\n </tr>\r\n <tr>\r\n
#line default
#line hidden
#line 329 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 330 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(Html.TextBoxFor(model => model.DeviceProfile.ComputerNameTemplate));
#line default
#line hidden
#line 329 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 330 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line default
#line hidden
#line 330 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 331 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(AjaxHelpers.AjaxSave());
#line default
#line hidden
#line 330 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 331 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line default
#line hidden
#line 331 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 332 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
#line 331 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 332 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
@@ -953,14 +954,14 @@ WriteLiteral(" <a");
WriteLiteral(" id=\"expressionBrowserAnchor\"");
WriteAttribute("href", Tuple.Create(" href=\"", 16261), Tuple.Create("\"", 16330)
WriteAttribute("href", Tuple.Create(" href=\"", 16270), Tuple.Create("\"", 16339)
#line 332 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
, Tuple.Create(Tuple.Create("", 16268), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.Config.DocumentTemplate.ExpressionBrowser())
#line 333 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
, Tuple.Create(Tuple.Create("", 16277), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.Config.DocumentTemplate.ExpressionBrowser())
#line default
#line hidden
, 16268), false)
, 16277), false)
);
WriteLiteral(">&nbsp;</a>\r\n");
@@ -991,7 +992,7 @@ WriteLiteral(@">
url: '");
#line 352 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 353 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(Url.Action(MVC.API.DeviceProfile.UpdateComputerNameTemplate(Model.DeviceProfile.Id)));
@@ -1019,7 +1020,7 @@ WriteLiteral(@"',
");
#line 371 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 372 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
}
else
{
@@ -1036,13 +1037,13 @@ WriteLiteral(" class=\"code\"");
WriteLiteral(">\r\n");
#line 375 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 376 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line default
#line hidden
#line 375 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 376 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
if (string.IsNullOrWhiteSpace(Model.DeviceProfile.ComputerNameTemplate))
{
@@ -1056,7 +1057,7 @@ WriteLiteral(" class=\"smallMessage\"");
WriteLiteral(">&lt;None Specified&gt;</span>\r\n");
#line 378 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 379 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
}
else
{
@@ -1065,14 +1066,14 @@ WriteLiteral(">&lt;None Specified&gt;</span>\r\n");
#line default
#line hidden
#line 381 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 382 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(Model.DeviceProfile.ComputerNameTemplate);
#line default
#line hidden
#line 381 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 382 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
}
@@ -1082,7 +1083,7 @@ WriteLiteral(">&lt;None Specified&gt;</span>\r\n");
WriteLiteral(" </div>\r\n");
#line 384 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 385 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
}
@@ -1095,13 +1096,13 @@ WriteLiteral(" style=\"margin-top: 8px;\"");
WriteLiteral(">\r\n");
#line 386 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 387 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line default
#line hidden
#line 386 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 387 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
if (canConfig)
{
@@ -1117,7 +1118,7 @@ WriteLiteral(" type=\"checkbox\"");
WriteLiteral(" ");
#line 388 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 389 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(Model.DeviceProfile.EnforceComputerNameConvention ? new MvcHtmlString("checked=\"checked\" ") : new MvcHtmlString(string.Empty));
@@ -1138,7 +1139,7 @@ WriteLiteral(@">
$.getJSON('");
#line 395 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 396 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(Url.Action(MVC.API.DeviceProfile.UpdateEnforceComputerNameConvention(Model.DeviceProfile.Id)));
@@ -1158,7 +1159,7 @@ WriteLiteral(@"', data, function (response, result) {
");
#line 406 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 407 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
}
else
{
@@ -1175,7 +1176,7 @@ WriteLiteral(" type=\"checkbox\"");
WriteLiteral(" ");
#line 409 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 410 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(Model.DeviceProfile.EnforceComputerNameConvention ? new MvcHtmlString("checked=\"checked\" ") : new MvcHtmlString(string.Empty));
@@ -1184,7 +1185,7 @@ WriteLiteral(" ");
WriteLiteral(" disabled=\"disabled\" />\r\n");
#line 410 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 411 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
}
@@ -1200,7 +1201,7 @@ WriteLiteral(">\r\n Enforce Naming Convention\r\n
WriteLiteral(" ");
#line 414 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 415 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(AjaxHelpers.AjaxLoader());
@@ -1218,13 +1219,13 @@ WriteLiteral(">\r\n Note: Computer names are only changed whe
" <div>\r\n");
#line 425 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 426 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line default
#line hidden
#line 425 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 426 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
if (canConfig)
{
@@ -1240,7 +1241,7 @@ WriteLiteral(" type=\"checkbox\"");
WriteLiteral(" ");
#line 427 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 428 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(Model.DeviceProfile.ProvisionADAccount ? new MvcHtmlString("checked=\"checked\" ") : new MvcHtmlString(string.Empty));
@@ -1261,7 +1262,7 @@ WriteLiteral(@">
$.getJSON('");
#line 434 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 435 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(Url.Action(MVC.API.DeviceProfile.UpdateProvisionADAccount(Model.DeviceProfile.Id)));
@@ -1281,7 +1282,7 @@ WriteLiteral(@"', data, function (response, result) {
");
#line 445 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 446 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
}
else
{
@@ -1298,7 +1299,7 @@ WriteLiteral(" type=\"checkbox\"");
WriteLiteral(" ");
#line 448 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 449 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(Model.DeviceProfile.ProvisionADAccount ? new MvcHtmlString("checked=\"checked\" ") : new MvcHtmlString(string.Empty));
@@ -1307,7 +1308,7 @@ WriteLiteral(" ");
WriteLiteral(" disabled=\"disabled\" />\r\n");
#line 449 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 450 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
}
@@ -1323,7 +1324,7 @@ WriteLiteral(">\r\n Provision Active Directory Account\r\
WriteLiteral(" ");
#line 453 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 454 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(AjaxHelpers.AjaxLoader());
@@ -1336,13 +1337,13 @@ WriteLiteral(" style=\"margin-top: 8px;\"");
WriteLiteral(">\r\n");
#line 456 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 457 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line default
#line hidden
#line 456 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 457 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
if (canConfig)
{
@@ -1358,7 +1359,7 @@ WriteLiteral(" type=\"checkbox\"");
WriteLiteral(" ");
#line 458 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 459 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(Model.DeviceProfile.AssignedUserLocalAdmin ? new MvcHtmlString("checked=\"checked\" ") : new MvcHtmlString(string.Empty));
@@ -1379,7 +1380,7 @@ WriteLiteral(@">
$.getJSON('");
#line 465 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 466 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(Url.Action(MVC.API.DeviceProfile.UpdateAssignedUserLocalAdmin(Model.DeviceProfile.Id)));
@@ -1399,7 +1400,7 @@ WriteLiteral(@"', data, function (response, result) {
");
#line 476 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 477 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
}
else
{
@@ -1416,7 +1417,7 @@ WriteLiteral(" type=\"checkbox\"");
WriteLiteral(" ");
#line 479 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 480 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(Model.DeviceProfile.AssignedUserLocalAdmin ? new MvcHtmlString("checked=\"checked\" ") : new MvcHtmlString(string.Empty));
@@ -1425,7 +1426,7 @@ WriteLiteral(" ");
WriteLiteral(" disabled=\"disabled\" />\r\n");
#line 480 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 481 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
}
@@ -1441,7 +1442,7 @@ WriteLiteral(">\r\n Assigned User is Local Administrator\
WriteLiteral(" ");
#line 484 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 485 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(AjaxHelpers.AjaxLoader());
@@ -1454,13 +1455,13 @@ WriteLiteral(" style=\"margin-top: 8px;\"");
WriteLiteral(">\r\n");
#line 487 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 488 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line default
#line hidden
#line 487 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 488 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
if (canConfig)
{
@@ -1476,7 +1477,7 @@ WriteLiteral(" type=\"checkbox\"");
WriteLiteral(" ");
#line 489 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 490 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(Model.DeviceProfile.AllowUntrustedReimageJobEnrolment ? new MvcHtmlString("checked=\"checked\" ") : null);
@@ -1497,7 +1498,7 @@ WriteLiteral(@">
$.getJSON('");
#line 496 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 497 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(Url.Action(MVC.API.DeviceProfile.UpdateAllowUntrustedReimageJobEnrolment(Model.DeviceProfile.Id)));
@@ -1517,7 +1518,7 @@ WriteLiteral(@"', data, function (response, result) {
");
#line 507 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 508 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
}
else
{
@@ -1534,7 +1535,7 @@ WriteLiteral(" type=\"checkbox\"");
WriteLiteral(" ");
#line 510 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 511 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(Model.DeviceProfile.AllowUntrustedReimageJobEnrolment ? new MvcHtmlString("checked=\"checked\" ") : new MvcHtmlString(string.Empty));
@@ -1543,7 +1544,7 @@ WriteLiteral(" ");
WriteLiteral(" disabled=\"disabled\" />\r\n");
#line 511 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 512 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
}
@@ -1562,44 +1563,90 @@ WriteLiteral(">\'Software - Reimage\'</span> Job is Open\r\n
WriteLiteral(" ");
#line 515 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 516 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
WriteLiteral("\r\n </div>\r\n </td>\r\n </tr>\r\n <tr>\r\n " +
" <th>Default Organisational Unit:\r\n </th>\r\n <td>");
" <th>Organisational Unit:\r\n </th>\r\n <td>");
#line 522 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 523 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
if (canConfig)
{
#line default
#line hidden
#line 524 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(Html.HiddenFor(model => model.DeviceProfile.OrganisationalUnit));
#line default
#line hidden
#line 524 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" id=\"displayOrganisationalUnit\"");
WriteLiteral(" id=\"DeviceProfile_OrganisationalUnit\"");
WriteLiteral(" class=\"code\"");
WriteLiteral(">\r\n </div>\r\n");
WriteLiteral(" data-value=\"");
#line 525 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(Model.DeviceProfile.OrganisationalUnit);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(">\r\n");
#line 526 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line default
#line hidden
#line 526 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
if (string.IsNullOrEmpty(Model.DeviceProfile.OrganisationalUnit))
{
#line default
#line hidden
WriteLiteral(" <span>{Default Computers Container}</span>\r\n");
#line 529 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
}
else
{
var domain = Disco.Services.Interop.ActiveDirectory.ActiveDirectory.GetDomainByDistinguishedName(Model.DeviceProfile.OrganisationalUnit);
#line default
#line hidden
WriteLiteral(" <span>\r\n");
WriteLiteral(" ");
#line 535 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(Disco.Services.Interop.ActiveDirectory.ActiveDirectoryExtensions.GetFriendlyOrganisationalUnitName(domain, Model.DeviceProfile.OrganisationalUnit));
#line default
#line hidden
WriteLiteral("\r\n </span>\r\n");
#line 537 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
}
#line default
#line hidden
WriteLiteral(" </div>\r\n");
WriteLiteral(" <a");
@@ -1612,20 +1659,20 @@ WriteLiteral(" class=\"button small\"");
WriteLiteral(">Change</a>");
#line 527 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 539 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line default
#line hidden
#line 527 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 539 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
#line 527 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 539 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
@@ -1635,117 +1682,113 @@ WriteLiteral(" <div");
WriteLiteral(" id=\"dialogOrganisationalUnit\"");
WriteLiteral(" title=\"Default Organisational Unit\"");
WriteLiteral(" title=\"Organisational Unit\"");
WriteLiteral(" class=\"dialog\"");
WriteLiteral(">\r\n <div");
WriteLiteral(" id=\"treeOrganisationalUnit\"");
WriteLiteral(" class=\"organisationalUnitTree\"");
WriteLiteral(">\r\n </div>\r\n </div>\r\n");
WriteLiteral(" <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(@">
$(function () {
var ouValue = $('#DeviceProfile_OrganisationalUnit');
var ouDisplay = $('#displayOrganisationalUnit');
var ouTree = $('#treeOrganisationalUnit');
var ouChangeLink = $('#changeOrganisationalUnit');
var ouTreeLoaded = false;
var ouFriendlyName = function (ou) {
return ou.replace(/ou=/gi, '').split(',').reverse().join(' > ');
};
var updateDisplayOrganisationalUnit = function () {
var value = ouValue.val();
if (value) {
ouDisplay.text(ouFriendlyName(value));
} else {
ouDisplay.text('{Default Computers Container}');
}
};
var ouSet = function (ou) {
$ajaxLoading = ouChangeLink.next('.ajaxLoading').show();
var data = { OrganisationalUnit: ou };
$.getJSON('");
WriteLiteral(">\r\n $(function () {\r\n var ouSetUrl = \'");
#line 553 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(Url.Action(MVC.API.DeviceProfile.UpdateOrganisationalUnit(Model.DeviceProfile.Id, null)));
#line 546 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(Url.Action(MVC.API.DeviceProfile.UpdateOrganisationalUnit(Model.DeviceProfile.Id, null, true)));
#line default
#line hidden
WriteLiteral("\', data, function (response, result) {\r\n if (resul" +
"t != \'success\' || response != \'OK\') {\r\n alert" +
"(\'Unable to change Organisational Unit:\\n\' + response);\r\n " +
" $ajaxLoading.hide();\r\n } else {\r\n " +
" ouValue.val(ou);\r\n " +
" updateDisplayOrganisationalUnit();\r\n $" +
"ajaxLoading.hide().next(\'.ajaxOk\').show().delay(\'fast\').fadeOut(\'slow\');\r\n " +
" }\r\n });\r\n " +
" }\r\n var ouUpdateTree = function () {\r\n " +
" var dynaTree = ouTree.dynatree(\"getTree\");\r\n " +
" var value = ouValue.val();\r\n if (value) {\r\n " +
" dynaTree.activateKey(value);\r\n " +
" } else {\r\n var activeNode = dynaTree.getAc" +
"tiveNode();\r\n if (activeNode)\r\n " +
" activeNode.deactivate();\r\n }\r\n " +
" }\r\n\r\n var ouDialog = $(\'#dialogOrganis" +
"ationalUnit\').dialog({\r\n autoOpen: false,\r\n " +
" buttons: {\r\n \'Use Default Conta" +
"iner\': function () {\r\n ouSet(\'\');\r\n " +
" $(this).dialog(\"close\");\r\n " +
" },\r\n \'Save\': function () {\r\n " +
" var node = ouTree.dynatree(\"getTree\").getActiveNode();\r\n " +
" if (node) {\r\n " +
" ouSet(node.data.key);\r\n $(this).dialo" +
"g(\"close\");\r\n } else {\r\n " +
" alert(\'Select an Organisational Unit to Save\')\r\n " +
" }\r\n }\r\n " +
" },\r\n draggable: false,\r\n " +
" modal: true,\r\n resizable: false,\r\n " +
" width: 400,\r\n height: 400\r\n " +
" });\r\n\r\n var ouChange = function () {\r\n " +
" if (!ouTreeLoaded) {\r\n $." +
"getJSON(\'");
WriteLiteral("\';\r\n var ouValue = $(\'#DeviceProfile_OrganisationalUnit\')." +
"attr(\'data-value\');\r\n var $ouTree = null;\r\n " +
" var ouTree = null;\r\n var $dialog = null;\r\n " +
" var ouSet = function (ou) {\r\n var " +
"url = ouSetUrl + \'&\' + $.param({ OrganisationalUnit: ou })\r\n " +
" window.location.href = url;\r\n }\r\n " +
" var expandNodeTree = function (node) {\r\n var " +
"parent = node.parent;\r\n if (parent) {\r\n " +
" expandNodeTree(parent);\r\n paren" +
"t.setExpanded(true, { noAnimation: true, noEvents: false });\r\n " +
" }\r\n }\r\n var expandAndFoc" +
"usNode = function (nodeKey) {\r\n if (ouTree) {\r\n " +
" var ouNode = ouTree.getNodeByKey(ouValue);\r\n " +
" if (ouNode) {\r\n expandN" +
"odeTree(ouNode);\r\n ouNode.setFocus(true);\r\n " +
" ouNode.setActive(true);\r\n\r\n " +
" var li = ouNode.li;\r\n var li" +
"Offset = li.offsetParent;\r\n if (li.offsetTop " +
"+ li.offsetHeight > liOffset.offsetHeight)\r\n " +
" $(liOffset).animate({ \'scrollTop\': li.offsetTop - liOffset.offsetHeight + li" +
".offsetHeight + 4 }, \'fast\');\r\n }\r\n " +
" }\r\n }\r\n var ouChange" +
" = function () {\r\n if (!$dialog) {\r\n\r\n " +
" $dialog = $(\'#dialogOrganisationalUnit\').dialog({\r\n " +
" autoOpen: false,\r\n bu" +
"ttons: null,\r\n draggable: false,\r\n " +
" modal: true,\r\n resiz" +
"able: false,\r\n width: 500,\r\n " +
" height: 500\r\n });\r\n " +
" $ouTree = $(\'#treeOrganisationalUnit\');\r\n " +
" $dialog.css(\'overflow\', \'visible\');\r\n " +
" $ouTree.css(\'height\', \'100%\');\r\n\r\n $.getJSON(\'" +
"");
#line 602 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(Url.Action(MVC.API.DeviceProfile.OrganisationalUnits()));
#line 593 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(Url.Action(MVC.API.System.DomainOrganisationalUnits()));
#line default
#line hidden
WriteLiteral("\', null, function (data) {\r\n var dynatreeDataTrans" +
"former = function (element) {\r\n var child = {" +
"\r\n title: element.Name,\r\n " +
" key: element.Path,\r\n " +
" isFolder: true\r\n }\r\n " +
" if (element.Children) {\r\n " +
"child.children = [];\r\n for (var i = 0; i " +
"< element.Children.length; i++) {\r\n c" +
"hild.children.push(dynatreeDataTransformer(element.Children[i]));\r\n " +
" }\r\n }\r\n " +
" return child;\r\n };\r\n " +
" var dynatreeData = [];\r\n " +
" for (var i = 0; i < data.length; i++) {\r\n " +
" dynatreeData.push(dynatreeDataTransformer(data[i]));\r\n " +
" }\r\n\r\n ouTree.dynatree({\r\n " +
" children: dynatreeData,\r\n " +
"onActivate: function (node) {\r\n //alert(\'" +
"node selected: \' + node.data.key);\r\n }\r\n " +
" });\r\n ouTreeLoaded = t" +
"rue;\r\n ouUpdateTree();\r\n " +
" });\r\n } else {\r\n ouUpdateTr" +
"ee();\r\n }\r\n ouDialog.dialog(\'o" +
"pen\');\r\n };\r\n\r\n ouChangeLink.click" +
"(ouChange);\r\n updateDisplayOrganisationalUnit();\r\n " +
" });\r\n </script>\r\n");
WriteLiteral("\', null, function (data) {\r\n\r\n // Make \'Domain" +
"s\' unselectable\r\n $.each(data, function (i, n" +
"ode) {\r\n node.unselectable = true;\r\n " +
" });\r\n\r\n ouTree" +
" = $ouTree.fancytree({\r\n source: data,\r\n " +
" checkbox: false,\r\n " +
" selectMode: 1,\r\n keyboar" +
"d: false,\r\n fx: null\r\n " +
" }).fancytree(\'getTree\');\r\n\r\n " +
" ouTree.$container.css(\'position\', \'relative\');\r\n\r\n " +
" // Set Buttons\r\n $dialog.dialog(\'optio" +
"n\', \'buttons\', {\r\n \'Use Default Container" +
"\': 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 " +
" ouSet(\'\');\r\n " +
" },\r\n \'Save\': function () {\r" +
"\n var node = ouTree.getActiveNode();\r" +
"\n if (node && node.key.substr(0, 3).t" +
"oLowerCase() == \'ou=\') {\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 ouSet(node" +
".key);\r\n } else {\r\n " +
" alert(\'Select an Organisational Unit to Save\')\r\n " +
" }\r\n " +
" }\r\n });\r\n\r\n " +
" // Expand\r\n expandAndFocusNode(ouValue" +
");\r\n\r\n ouTree.options.fx = { height: \"toggle\"" +
", duration: 200 };\r\n });\r\n " +
" }\r\n $dialog.dialog(\'open\');\r\n\r\n " +
" if (ouTree) {\r\n // Expand\r\n " +
" expandAndFocusNode(ouValue);\r\n }" +
"\r\n\r\n return false;\r\n };\r\n\r\n " +
" $(\'#changeOrganisationalUnit\').click(ouChange);\r\n " +
" });\r\n </script>\r\n");
#line 641 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 652 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
}
else
{
@@ -1762,13 +1805,13 @@ WriteLiteral(" class=\"code\"");
WriteLiteral(">\r\n");
#line 645 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 656 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line default
#line hidden
#line 645 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 656 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
if (string.IsNullOrEmpty(Model.DeviceProfile.OrganisationalUnit))
{
@@ -1778,10 +1821,12 @@ WriteLiteral(">\r\n");
WriteLiteral(" <span>{Default Computers Container}</span>\r\n");
#line 648 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 659 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
}
else
{
var domain = Disco.Services.Interop.ActiveDirectory.ActiveDirectory.GetDomainByDistinguishedName(Model.DeviceProfile.OrganisationalUnit);
#line default
@@ -1791,8 +1836,8 @@ WriteLiteral(" <span>\r\n");
WriteLiteral(" ");
#line 652 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(string.Join(" > ", Model.DeviceProfile.OrganisationalUnit.Split(',').Select(s => s.Substring(3)).Reverse()));
#line 665 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(Disco.Services.Interop.ActiveDirectory.ActiveDirectoryExtensions.GetFriendlyOrganisationalUnitName(domain, Model.DeviceProfile.OrganisationalUnit));
#line default
@@ -1800,7 +1845,7 @@ WriteLiteral(" ");
WriteLiteral("\r\n </span>\r\n");
#line 654 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 667 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
}
@@ -1809,7 +1854,7 @@ WriteLiteral("\r\n </span>\r\n");
WriteLiteral(" </div>\r\n");
#line 656 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 669 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
}
@@ -1822,13 +1867,13 @@ WriteLiteral(" style=\"margin-top: 8px;\"");
WriteLiteral(">\r\n");
#line 658 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 671 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line default
#line hidden
#line 658 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 671 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
if (canConfig)
{
@@ -1844,7 +1889,7 @@ WriteLiteral(" type=\"checkbox\"");
WriteLiteral(" ");
#line 660 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 673 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(Model.DeviceProfile.EnforceOrganisationalUnit ? new MvcHtmlString("checked=\"checked\" ") : new MvcHtmlString(string.Empty));
@@ -1865,7 +1910,7 @@ WriteLiteral(@">
$.getJSON('");
#line 667 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 680 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(Url.Action(MVC.API.DeviceProfile.UpdateEnforceOrganisationalUnit(Model.DeviceProfile.Id)));
@@ -1885,7 +1930,7 @@ WriteLiteral(@"', data, function (response, result) {
");
#line 678 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 691 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
}
else
{
@@ -1902,7 +1947,7 @@ WriteLiteral(" type=\"checkbox\"");
WriteLiteral(" ");
#line 681 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 694 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(Model.DeviceProfile.EnforceOrganisationalUnit ? new MvcHtmlString("checked=\"checked\" ") : new MvcHtmlString(string.Empty));
@@ -1911,7 +1956,7 @@ WriteLiteral(" ");
WriteLiteral(" disabled=\"disabled\" />\r\n");
#line 682 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 695 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
}
@@ -1927,7 +1972,7 @@ WriteLiteral(">\r\n Enforce Organisational Unit\r\n
WriteLiteral(" ");
#line 686 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 699 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(AjaxHelpers.AjaxLoader());
@@ -1937,7 +1982,7 @@ WriteLiteral("\r\n </div>\r\n </td>\r\n </tr>\r
"\n");
#line 692 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 705 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
if (canDelete)
{
@@ -1992,7 +2037,7 @@ WriteLiteral(@">
");
#line 728 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 741 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
}
@@ -2005,13 +2050,13 @@ WriteLiteral(" class=\"actionBar\"");
WriteLiteral(">\r\n");
#line 730 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 743 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line default
#line hidden
#line 730 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 743 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
if (canDelete)
{
@@ -2019,14 +2064,14 @@ WriteLiteral(">\r\n");
#line default
#line hidden
#line 732 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 745 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(Html.ActionLinkButton("Delete", MVC.API.DeviceProfile.Delete(Model.DeviceProfile.Id, true), "buttonDelete"));
#line default
#line hidden
#line 732 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 745 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
}
@@ -2036,7 +2081,7 @@ WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 734 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 747 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
if (Authorization.Has(Claims.Device.Actions.Export))
{
@@ -2044,14 +2089,14 @@ WriteLiteral(" ");
#line default
#line hidden
#line 736 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 749 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(Html.ActionLinkButton("Export Devices", MVC.API.DeviceProfile.ExportDevices(Model.DeviceProfile.Id)));
#line default
#line hidden
#line 736 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 749 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
}
@@ -2061,7 +2106,7 @@ WriteLiteral(" ");
WriteLiteral(" ");
#line 738 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 751 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
if (Authorization.Has(Claims.Device.Search))
{
@@ -2069,14 +2114,14 @@ WriteLiteral(" ");
#line default
#line hidden
#line 740 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 753 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(Html.ActionLinkButton("View Devices", MVC.Search.Query(Model.DeviceProfile.Id.ToString(), "DeviceProfile")));
#line default
#line hidden
#line 740 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
#line 753 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
}
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -29,6 +29,7 @@ namespace Disco.Web.Areas.Config.Views.DeviceProfile
using Disco;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -29,6 +29,7 @@ namespace Disco.Web.Areas.Config.Views.DeviceProfile
using Disco;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -29,6 +29,7 @@ namespace Disco.Web.Areas.Config.Views.DocumentTemplate
using Disco;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -29,6 +29,7 @@ namespace Disco.Web.Areas.Config.Views.DocumentTemplate
using Disco;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -29,6 +29,7 @@ namespace Disco.Web.Areas.Config.Views.DocumentTemplate
using Disco;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -29,6 +29,7 @@ namespace Disco.Web.Areas.Config.Views.DocumentTemplate
using Disco;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -29,6 +29,7 @@ namespace Disco.Web.Areas.Config.Views.DocumentTemplate
using Disco;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -29,6 +29,7 @@ namespace Disco.Web.Areas.Config.Views.DocumentTemplate
using Disco;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -29,6 +29,7 @@ namespace Disco.Web.Areas.Config.Views.Enrolment
using Disco;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -29,6 +29,7 @@ namespace Disco.Web.Areas.Config.Views.Enrolment
using Disco;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -29,6 +29,7 @@ namespace Disco.Web.Areas.Config.Views.Expressions
using Disco;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -29,6 +29,7 @@ namespace Disco.Web.Areas.Config.Views.JobQueue
using Disco;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -29,6 +29,7 @@ namespace Disco.Web.Areas.Config.Views.JobQueue
using Disco;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -29,6 +29,7 @@ namespace Disco.Web.Areas.Config.Views.Logging
using Disco;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
#line 2 "..\..\Areas\Config\Views\Logging\Index.cshtml"
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -29,6 +29,7 @@ namespace Disco.Web.Areas.Config.Views.Logging
using Disco;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -29,6 +29,7 @@ namespace Disco.Web.Areas.Config.Views.Organisation
using Disco;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -29,6 +29,7 @@ namespace Disco.Web.Areas.Config.Views.Plugins
using Disco;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
#line 2 "..\..\Areas\Config\Views\Plugins\Index.cshtml"
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -29,6 +29,7 @@ namespace Disco.Web.Areas.Config.Views.Plugins
using Disco;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
#line 2 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -29,6 +29,7 @@ namespace Disco.Web.Areas.Config.Views.Plugins
using Disco;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -29,6 +29,7 @@ namespace Disco.Web.Areas.Config.Views.Shared
using Disco;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
@@ -3,8 +3,16 @@
Authorization.Require(Claims.Config.System.Show);
var canConfigProxy = Authorization.Has(Claims.Config.System.ConfigureProxy);
var canConfigAD = Authorization.Has(Claims.Config.System.ConfigureActiveDirectory);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "System");
if (canConfigAD)
{
Html.BundleDeferred("~/Style/Fancytree");
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-Fancytree");
Html.BundleDeferred("~/ClientScripts/Modules/Disco-PropertyChangeHelpers");
}
}
<div class="form" style="width: 450px">
<table>
@@ -133,9 +141,296 @@
</tr>
</table>
</div>
<div class="form" style="width: 450px; margin-top: 15px;">
<h2>Active Directory</h2>
<table>
<tr>
<th style="width: 135px">Primary Domain:
</th>
<td>
<code><strong>@Model.ADPrimaryDomain.DnsName</strong> <span>[@Model.ADPrimaryDomain.NetBiosName]</span></code>
</td>
</tr>
<tr>
<th style="width: 135px">Additional Domains:
</th>
<td>
@if (Model.ADAdditionalDomains.Count > 0)
{
var adDomainFirst = Model.ADAdditionalDomains.First();
<code>@adDomainFirst.DnsName <span>[@adDomainFirst.NetBiosName]</span></code>
foreach (var adDomain in Model.ADAdditionalDomains.Skip(1))
{
<hr />
<div>
<code>@adDomain.DnsName <span>[@adDomain.NetBiosName]</span></code>
</div>
}
}
else
{
<span class="smallMessage">&lt;None&gt;</span>
}
</td>
</tr>
<tr>
<th style="width: 135px">Site:
</th>
<td>
<code><strong>@Model.ADSite.Name</strong></code>
<hr />
<div>
@if (Model.ADSiteServers.Count > 0)
{
<span>Servers:</span>
<ul class="none">
@foreach (var siteServer in Model.ADSiteServers)
{
var server = siteServer.Item1;
var reachable = siteServer.Item2;
<li>
<i class="fa @(reachable ? "fa-check success" : "fa-exclamation warning") fa-fw fa-lg" title="@(reachable ? "Reachable" : "Unavailable")"></i>&nbsp;<code>@(server.Name)</code>
</li>
}
</ul>
}
else
{
<div class="error">
<i class="fa fa-exclamation-circle fa-lg"></i>&nbsp;<span>None Found</span>
</div>
}
</div>
</td>
</tr>
<tr>
<th style="width: 135px">Forest:
</th>
<td>
@if (Model.ADForestServers == null)
{
<div>
@Html.CheckBoxFor(m => m.ADSearchEntireForest, new { disabled = "disabled" }) @Html.LabelFor(m => m.ADSearchEntireForest)
</div>
<div style="padding: 0.7em 0.7em;" class="ui-state-highlight ui-corner-all">
<i class="fa fa-info-circle information"></i>&nbsp;Forest servers are being retrieved, try refreshing this page in a moment.
</div>
}
else
{
if (canConfigAD)
{
var canSearchEntireForest = (Model.ADForestServers.Count <= Disco.Services.Interop.ActiveDirectory.ActiveDirectory.MaxForestServerSearch);
<div>
@if (!canSearchEntireForest)
{
@Html.CheckBoxFor(m => m.ADSearchEntireForest, new { disabled = "disabled" }) @Html.LabelFor(m => m.ADSearchEntireForest)
<div style="padding: 0.7em 0.7em;" class="ui-state-highlight ui-corner-all">
<i class="fa fa-exclamation-circle warning"></i>&nbsp;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.
</div>
}
else
{
@Html.CheckBoxFor(m => m.ADSearchEntireForest) @Html.LabelFor(m => m.ADSearchEntireForest) @AjaxHelpers.AjaxLoader()
<div class="smallMessage">
If this setting is enabled, Disco will search all servers within the forest rather than only servers within this site.
</div>
<script>
$(function () {
document.DiscoFunctions.PropertyChangeHelper($('#ADSearchEntireForest'), null, '@(Url.Action(MVC.API.System.UpdateActiveDirectorySearchEntireForest()))', 'SearchEntireForest');
});
</script>
}
</div>
}
else
{
<div>
@Html.CheckBoxFor(m => m.ADSearchEntireForest, new { disabled = "disabled" }) @Html.LabelFor(m => m.ADSearchEntireForest)
<div class="smallMessage">
If this setting is enabled, Disco will search all servers within the forest rather than only servers within this site.
</div>
</div>
}
<div>
<hr />
<span>Servers:</span>
<ul id="Config_System_AD_ForestServers">
@foreach (var server in Model.ADForestServers.OrderBy(s => s))
{
<li><code>@server</code> @(Model.ADSiteServers.Count(ss => ss.Item1.Name.Equals(server, StringComparison.InvariantCultureIgnoreCase)) > 0 ? "[Site Server]" : null)</li>
}
</ul>
<script>
$(function () {
var toManyServers = 5;
var ul = $('#Config_System_AD_ForestServers');
var ulLi = ul.find('li');
if (ulLi.length > toManyServers) {
var liMore = $('<li>').append(
$('<a>').attr('href', '#')
.text('Show All Servers (' + (ulLi.length - toManyServers) + ' more)')
.click(function () {
$(this).closest('li').remove();
ul.find('li').show();
return false;
}))
.insertAfter(ulLi[(toManyServers - 1)]);
ulLi.each(function (i) {
if (i > (toManyServers - 1))
$(this).hide();
});
}
});
</script>
</div>
}
</td>
</tr>
<tr>
<th style="width: 135px">Search Scope:
</th>
<td>
@if (Model.ADSearchContainers != null && Model.ADSearchContainers.Count > 0)
{
<div>Searching is restricted to the following Organisational&nbsp;Unit containers</div>
<ul id="Config_System_AD_SearchScope_DistinguishedNames">
@foreach (var adContainer in Model.ADSearchContainers)
{
<li data-distinguishedname="@adContainer.Item1"><code>@adContainer.Item3</code></li>
}
</ul>
}
else
{
<div>No restrictions are in effect.</div>
<div class="smallMessage">When searching, the entire domain will be queried. This is suitable for most single-domain deployments.</div>
}
@if (canConfigAD)
{
<div>
<hr />
<a id="Config_System_AD_SearchScope_Update" href="#" class="button small">Update</a>
</div>
<div id="Config_System_AD_SearchScope_Dialog" class="dialog" title="Search Scope">
<div id="Config_System_AD_SearchScope_Tree" class="organisationalUnitTree">
</div>
@using (Html.BeginForm(MVC.API.System.UpdateActiveDirectorySearchScope(null, redirect: true)))
{
}
</div>
<script>
$(function () {
var $dialog, $tree, tree, distinguishedNames;
function expandNodeTree(node) {
var parent = node.parent;
if (parent) {
expandNodeTree(parent);
if (!parent.isExpanded())
parent.setExpanded(true, { noAnimation: true, noEvents: false });
}
}
function selectDistinguishedNames() {
if (!distinguishedNames) {
distinguishedNames = $('#Config_System_AD_SearchScope_DistinguishedNames')
.find('li')
.map(function () { return $(this).attr('data-distinguishedname'); }).get();
}
if (tree) {
tree.visit(function (node) {
if ($.inArray(node.key, distinguishedNames) >= 0) {
node.setSelected(true);
expandNodeTree(node);
} else if (node.isSelected()) {
node.setSelected(false);
}
});
}
}
function update() {
if (!$dialog) {
$dialog = $('#Config_System_AD_SearchScope_Dialog').dialog({
autoOpen: false,
buttons: null,
draggable: false,
modal: true,
resizable: false,
width: 500,
height: 500
});
$tree = $('#Config_System_AD_SearchScope_Tree');
$dialog.css('overflow', 'visible');
$tree.css('height', '100%');
$.getJSON('@(Url.Action(MVC.API.System.DomainOrganisationalUnits()))', null, function (data) {
tree = $tree.fancytree({
source: data,
checkbox: true,
selectMode: 2,
keyboard: false,
fx: null
}).fancytree('getTree');
tree.$container.css('position', 'relative');
// Set Buttons
$dialog.dialog('option', 'buttons', {
'Search Entire Forest': function () {
var $this = $(this);
$this.css('overflow', 'hidden');
$this.dialog("disable");
$this.dialog("option", "buttons", null);
var $form = $dialog.find('form');
$form.submit();
},
'Save': function () {
var $this = $(this);
$this.css('overflow', 'hidden');
$this.dialog("disable");
$this.dialog("option", "buttons", null);
var nodes = tree.getSelectedNodes();
var $form = $dialog.find('form');
$.each(nodes, function (i, node) {
$('<input>').attr({ 'type': 'hidden', 'name': 'Containers', 'value': node.key }).appendTo($form);
});
$form.submit();
}
});
// Select & Expand
selectDistinguishedNames();
tree.options.fx = { height: "toggle", duration: 200 };
});
}
selectDistinguishedNames();
$dialog.dialog('open');
return false;
}
$('#Config_System_AD_SearchScope_Update').click(update);
});
</script>
}
</td>
</tr>
</table>
</div>
@if (canConfigProxy)
{
using (Html.BeginForm())
using (Html.BeginForm(MVC.API.System.UpdateProxySettings()))
{
<div class="form" style="width: 450px; margin-top: 15px;">
<h2>Proxy Settings</h2>
File diff suppressed because it is too large Load Diff
+5
View File
@@ -33,6 +33,11 @@
</appSettings>
<system.web>
<compilation>
<assemblies>
<add assembly="System.DirectoryServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</assemblies>
</compilation>
<httpHandlers>
<add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/>
</httpHandlers>
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -29,6 +29,7 @@ namespace Disco.Web.Areas.Config.Views
using Disco;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;