feature: computer name template testing
This commit is contained in:
@@ -0,0 +1,4 @@
|
|||||||
|
[*.cs]
|
||||||
|
|
||||||
|
# VSSpell001: Spell Check
|
||||||
|
dotnet_diagnostic.VSSpell001.severity = suggestion
|
||||||
@@ -107,6 +107,7 @@
|
|||||||
<Compile Include="MvcExtensions\File\FileExtensions.cs" />
|
<Compile Include="MvcExtensions\File\FileExtensions.cs" />
|
||||||
<Compile Include="MvcExtensions\JsonNet\JsonDotNetValueProviderFactory.cs" />
|
<Compile Include="MvcExtensions\JsonNet\JsonDotNetValueProviderFactory.cs" />
|
||||||
<Compile Include="MvcExtensions\JsonNet\JsonNetResult.cs" />
|
<Compile Include="MvcExtensions\JsonNet\JsonNetResult.cs" />
|
||||||
|
<Compile Include="MvcExtensions\JsonStatusCodeResult.cs" />
|
||||||
<Compile Include="MvcExtensions\PartialCompiled\PartialCompiledHtmlExtensions.cs" />
|
<Compile Include="MvcExtensions\PartialCompiled\PartialCompiledHtmlExtensions.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="MvcExtensions\XmlResult.cs" />
|
<Compile Include="MvcExtensions\XmlResult.cs" />
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
using Disco.Web.Extensions.MvcExtensions;
|
||||||
|
using System.Web.Mvc;
|
||||||
|
|
||||||
|
namespace Disco.Web.Extensions.MvcExtensions
|
||||||
|
{
|
||||||
|
public class JsonStatusCodeResult : JsonResult
|
||||||
|
{
|
||||||
|
public int StatusCode { get; set; }
|
||||||
|
|
||||||
|
public override void ExecuteResult(ControllerContext context)
|
||||||
|
{
|
||||||
|
context.HttpContext.Response.TrySkipIisCustomErrors = true;
|
||||||
|
context.HttpContext.Response.StatusCode = StatusCode;
|
||||||
|
base.ExecuteResult(context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Disco.Web
|
||||||
|
{
|
||||||
|
public static class JsonStatusCodeResultExtensions
|
||||||
|
{
|
||||||
|
public static JsonStatusCodeResult JsonStatusCode(this Controller controller, int statusCode, object data)
|
||||||
|
{
|
||||||
|
return new JsonStatusCodeResult { StatusCode = statusCode, Data = data };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,16 +2,20 @@
|
|||||||
using Disco.Services;
|
using Disco.Services;
|
||||||
using Disco.Services.Authorization;
|
using Disco.Services.Authorization;
|
||||||
using Disco.Services.Devices.ManagedGroups;
|
using Disco.Services.Devices.ManagedGroups;
|
||||||
|
using Disco.Services.Expressions;
|
||||||
using Disco.Services.Interop.ActiveDirectory;
|
using Disco.Services.Interop.ActiveDirectory;
|
||||||
using Disco.Services.Plugins;
|
using Disco.Services.Plugins;
|
||||||
using Disco.Services.Plugins.Features.CertificateAuthorityProvider;
|
using Disco.Services.Plugins.Features.CertificateAuthorityProvider;
|
||||||
using Disco.Services.Plugins.Features.CertificateProvider;
|
using Disco.Services.Plugins.Features.CertificateProvider;
|
||||||
using Disco.Services.Plugins.Features.WirelessProfileProvider;
|
using Disco.Services.Plugins.Features.WirelessProfileProvider;
|
||||||
using Disco.Services.Tasks;
|
using Disco.Services.Tasks;
|
||||||
|
using Disco.Services.Users;
|
||||||
using Disco.Services.Web;
|
using Disco.Services.Web;
|
||||||
|
using Disco.Web.Areas.API.Models.DeviceModel;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
|
|
||||||
namespace Disco.Web.Areas.API.Controllers
|
namespace Disco.Web.Areas.API.Controllers
|
||||||
@@ -27,7 +31,6 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
const string pWirelessProfileProviders = "wirelessprofileproviders";
|
const string pWirelessProfileProviders = "wirelessprofileproviders";
|
||||||
const string pOrganisationalUnit = "organisationalunit";
|
const string pOrganisationalUnit = "organisationalunit";
|
||||||
const string pDefaultOrganisationAddress = "defaultorganisationaddress";
|
const string pDefaultOrganisationAddress = "defaultorganisationaddress";
|
||||||
const string pComputerNameTemplate = "computernametemplate";
|
|
||||||
const string pEnforceComputerNameConvention = "enforcecomputernameconvention";
|
const string pEnforceComputerNameConvention = "enforcecomputernameconvention";
|
||||||
const string pEnforceOrganisationalUnit = "enforceorganisationalunit";
|
const string pEnforceOrganisationalUnit = "enforceorganisationalunit";
|
||||||
const string pProvisionADAccount = "provisionadaccount";
|
const string pProvisionADAccount = "provisionadaccount";
|
||||||
@@ -37,7 +40,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
const string pAssignedUsersLinkedGroup = "assigneduserslinkedgroup";
|
const string pAssignedUsersLinkedGroup = "assigneduserslinkedgroup";
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
||||||
public virtual ActionResult Update(int id, string key, string value = null, Nullable<bool> redirect = null)
|
public virtual ActionResult Update(int id, string key, string value = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
Authorization.Require(Claims.Config.DeviceProfile.Configure);
|
Authorization.Require(Claims.Config.DeviceProfile.Configure);
|
||||||
|
|
||||||
@@ -79,10 +82,6 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
case pDefaultOrganisationAddress:
|
case pDefaultOrganisationAddress:
|
||||||
UpdateDefaultOrganisationAddress(deviceProfile, value);
|
UpdateDefaultOrganisationAddress(deviceProfile, value);
|
||||||
break;
|
break;
|
||||||
case pComputerNameTemplate:
|
|
||||||
Authorization.Require(Claims.Config.DeviceProfile.ConfigureComputerNameTemplate);
|
|
||||||
UpdateComputerNameTemplate(deviceProfile, value);
|
|
||||||
break;
|
|
||||||
case pEnforceComputerNameConvention:
|
case pEnforceComputerNameConvention:
|
||||||
UpdateEnforceComputerNameConvention(deviceProfile, value);
|
UpdateEnforceComputerNameConvention(deviceProfile, value);
|
||||||
break;
|
break;
|
||||||
@@ -129,91 +128,209 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
#region Update Shortcut Methods
|
#region Update Shortcut Methods
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
||||||
public virtual ActionResult UpdateDescription(int id, string Description = null, Nullable<bool> redirect = null)
|
public virtual ActionResult UpdateDescription(int id, string Description = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pDescription, Description, redirect);
|
return Update(id, pDescription, Description, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
||||||
public virtual ActionResult UpdateName(int id, string ProfileName = null, Nullable<bool> redirect = null)
|
public virtual ActionResult UpdateName(int id, string ProfileName = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pName, ProfileName, redirect);
|
return Update(id, pName, ProfileName, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
||||||
public virtual ActionResult UpdateShortName(int id, string ShortName = null, Nullable<bool> redirect = null)
|
public virtual ActionResult UpdateShortName(int id, string ShortName = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pShortName, ShortName, redirect);
|
return Update(id, pShortName, ShortName, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
||||||
public virtual ActionResult UpdateDistributionType(int id, string DistributionType = null, Nullable<bool> redirect = null)
|
public virtual ActionResult UpdateDistributionType(int id, string DistributionType = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pDistributionType, DistributionType, redirect);
|
return Update(id, pDistributionType, DistributionType, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
||||||
public virtual ActionResult UpdateCertificateProviders(int id, string CertificateProviders = null, Nullable<bool> redirect = null)
|
public virtual ActionResult UpdateCertificateProviders(int id, string CertificateProviders = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pCertificateProviders, CertificateProviders, redirect);
|
return Update(id, pCertificateProviders, CertificateProviders, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
||||||
public virtual ActionResult UpdateCertificateAuthorityProviders(int id, string CertificateAuthorityProviders = null, Nullable<bool> redirect = null)
|
public virtual ActionResult UpdateCertificateAuthorityProviders(int id, string CertificateAuthorityProviders = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pCertificateAuthorityProviders, CertificateAuthorityProviders, redirect);
|
return Update(id, pCertificateAuthorityProviders, CertificateAuthorityProviders, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
||||||
public virtual ActionResult UpdateWirelessProfileProviders(int id, string WirelessProfileProviders = null, Nullable<bool> redirect = null)
|
public virtual ActionResult UpdateWirelessProfileProviders(int id, string WirelessProfileProviders = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pWirelessProfileProviders, WirelessProfileProviders, redirect);
|
return Update(id, pWirelessProfileProviders, WirelessProfileProviders, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
||||||
public virtual ActionResult UpdateOrganisationalUnit(int id, string OrganisationalUnit = null, Nullable<bool> redirect = null)
|
public virtual ActionResult UpdateOrganisationalUnit(int id, string OrganisationalUnit = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pOrganisationalUnit, OrganisationalUnit, redirect);
|
return Update(id, pOrganisationalUnit, OrganisationalUnit, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
||||||
public virtual ActionResult UpdateDefaultOrganisationAddress(int id, string DefaultOrganisationAddress = null, Nullable<bool> redirect = null)
|
public virtual ActionResult UpdateDefaultOrganisationAddress(int id, string DefaultOrganisationAddress = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pDefaultOrganisationAddress, DefaultOrganisationAddress, redirect);
|
return Update(id, pDefaultOrganisationAddress, DefaultOrganisationAddress, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorizeAll(Claims.Config.DeviceProfile.Configure, Claims.Config.DeviceProfile.ConfigureComputerNameTemplate)]
|
[DiscoAuthorizeAll(Claims.Config.DeviceProfile.Configure, Claims.Config.DeviceProfile.ConfigureComputerNameTemplate)]
|
||||||
public virtual ActionResult UpdateComputerNameTemplate(int id, string ComputerNameTemplate = null, Nullable<bool> redirect = null)
|
[ValidateAntiForgeryToken]
|
||||||
|
public virtual ActionResult UpdateComputerNameTemplate(int id, string ComputerNameTemplate = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pComputerNameTemplate, ComputerNameTemplate, redirect);
|
var deviceProfile = Database.DeviceProfiles.Find(id);
|
||||||
|
|
||||||
|
if (deviceProfile == null)
|
||||||
|
throw new ArgumentException("Invalid Device Profile Id", nameof(id));
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(ComputerNameTemplate))
|
||||||
|
throw new Exception("ComputerNameTemplate is Required");
|
||||||
|
|
||||||
|
var expression = new EvaluateExpressionPart(ComputerNameTemplate);
|
||||||
|
if (expression.ParseError)
|
||||||
|
{
|
||||||
|
return this.JsonStatusCode(400, expression.ParseErrorMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
deviceProfile.ComputerNameTemplate = ComputerNameTemplate;
|
||||||
|
|
||||||
|
Database.SaveChanges();
|
||||||
|
|
||||||
|
deviceProfile.ComputerNameInvalidateCache();
|
||||||
|
|
||||||
|
if (redirect.GetValueOrDefault(false))
|
||||||
|
return RedirectToAction(MVC.Config.DeviceProfile.Index(deviceProfile.Id));
|
||||||
|
else
|
||||||
|
return Json("OK");
|
||||||
|
}
|
||||||
|
|
||||||
|
[DiscoAuthorizeAll(Claims.Config.DeviceProfile.Configure, Claims.Config.DeviceProfile.ConfigureComputerNameTemplate)]
|
||||||
|
[ValidateAntiForgeryToken]
|
||||||
|
public virtual ActionResult TestComputerNameTemplate(int id, string ComputerNameTemplate = null, string UserSpecifiedDeviceSerialNumber = null)
|
||||||
|
{
|
||||||
|
Database.Configuration.LazyLoadingEnabled = true;
|
||||||
|
var deviceProfile = Database.DeviceProfiles.Find(id);
|
||||||
|
|
||||||
|
if (deviceProfile == null)
|
||||||
|
throw new ArgumentException("Invalid Device Profile Id", nameof(id));
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(ComputerNameTemplate))
|
||||||
|
throw new Exception("ComputerNameTemplate is Required");
|
||||||
|
|
||||||
|
var expression = Expression.TokenizeSingleDynamic(null, ComputerNameTemplate, 0);
|
||||||
|
if (expression.First().ParseError)
|
||||||
|
{
|
||||||
|
return this.JsonStatusCode(400, expression.First().ParseErrorMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = new TestComputerNameTemplateModel()
|
||||||
|
{
|
||||||
|
DeviceProfileId = deviceProfile.Id,
|
||||||
|
ComputerNameTemplate = ComputerNameTemplate,
|
||||||
|
};
|
||||||
|
|
||||||
|
TestComputerNameTemplateModel.TestComputerNameTemplateResultModel evaluateDevice(Disco.Models.Repository.Device device)
|
||||||
|
{
|
||||||
|
var evaluatorVariables = Expression.StandardVariables(null, Database, UserService.CurrentUser, DateTime.Now, null, device);
|
||||||
|
var deviceResult = new TestComputerNameTemplateModel.TestComputerNameTemplateResultModel()
|
||||||
|
{
|
||||||
|
DeviceSerialNumber = device.SerialNumber,
|
||||||
|
DeviceComputerName = device.ComputerName,
|
||||||
|
};
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var rendered = expression.EvaluateFirst<string>(device, evaluatorVariables);
|
||||||
|
deviceResult.Url = Url.Action(MVC.Device.Show(device.SerialNumber));
|
||||||
|
deviceResult.RenderedComputerName = rendered;
|
||||||
|
deviceResult.Success = true;
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(rendered))
|
||||||
|
{
|
||||||
|
deviceResult.Success = false;
|
||||||
|
deviceResult.ErrorMessage = "Rendered computer name is null or blank";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (rendered.Length > 15)
|
||||||
|
{
|
||||||
|
deviceResult.Success = false;
|
||||||
|
deviceResult.ErrorMessage = "Must be no more than 15 characters";
|
||||||
|
}
|
||||||
|
var invalidCharacters = Regex.Matches(rendered, @"[^a-z0-9\-]", RegexOptions.IgnoreCase);
|
||||||
|
if (invalidCharacters.Count > 0)
|
||||||
|
{
|
||||||
|
deviceResult.Success = false;
|
||||||
|
deviceResult.ErrorMessage = $"Invalid characters: {string.Join(" ", invalidCharacters.Cast<Match>().Select(m => m.Value.Replace(" ", "{space}")).Distinct())}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
deviceResult.Success = false;
|
||||||
|
deviceResult.ErrorMessage = $"{ex.Message} [{ex.GetType().Name}]";
|
||||||
|
}
|
||||||
|
return deviceResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(UserSpecifiedDeviceSerialNumber))
|
||||||
|
{
|
||||||
|
var device = Database.Devices.FirstOrDefault(d => d.SerialNumber == UserSpecifiedDeviceSerialNumber);
|
||||||
|
if (device == null)
|
||||||
|
return this.JsonStatusCode(400, "Invalid user-specified device serial number");
|
||||||
|
result.UserSpecifiedResult = evaluateDevice(device);
|
||||||
|
}
|
||||||
|
|
||||||
|
result.RandomDeviceResults = Database.Devices
|
||||||
|
.Where(d => d.DeviceProfileId == deviceProfile.Id && d.SerialNumber != UserSpecifiedDeviceSerialNumber)
|
||||||
|
.OrderBy(d => Guid.NewGuid())
|
||||||
|
.Take(6)
|
||||||
|
.ToList()
|
||||||
|
.Select(d => evaluateDevice(d))
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
if (result.UserSpecifiedResult == null && result.RandomDeviceResults.Count > 0)
|
||||||
|
{
|
||||||
|
result.UserSpecifiedResult = result.RandomDeviceResults.First();
|
||||||
|
result.RandomDeviceResults.RemoveAt(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Json(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
||||||
public virtual ActionResult UpdateEnforceComputerNameConvention(int id, string EnforceComputerNameConvention = null, Nullable<bool> redirect = null)
|
public virtual ActionResult UpdateEnforceComputerNameConvention(int id, string EnforceComputerNameConvention = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pEnforceComputerNameConvention, EnforceComputerNameConvention, redirect);
|
return Update(id, pEnforceComputerNameConvention, EnforceComputerNameConvention, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
||||||
public virtual ActionResult UpdateEnforceOrganisationalUnit(int id, string EnforceOrganisationalUnit = null, Nullable<bool> redirect = null)
|
public virtual ActionResult UpdateEnforceOrganisationalUnit(int id, string EnforceOrganisationalUnit = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pEnforceOrganisationalUnit, EnforceOrganisationalUnit, redirect);
|
return Update(id, pEnforceOrganisationalUnit, EnforceOrganisationalUnit, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
||||||
public virtual ActionResult UpdateProvisionADAccount(int id, string ProvisionADAccount = null, Nullable<bool> redirect = null)
|
public virtual ActionResult UpdateProvisionADAccount(int id, string ProvisionADAccount = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pProvisionADAccount, ProvisionADAccount, redirect);
|
return Update(id, pProvisionADAccount, ProvisionADAccount, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
||||||
public virtual ActionResult UpdateAssignedUserLocalAdmin(int id, string AssignedUserLocalAdmin = null, Nullable<bool> redirect = null)
|
public virtual ActionResult UpdateAssignedUserLocalAdmin(int id, string AssignedUserLocalAdmin = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pAssignedUserLocalAdmin, AssignedUserLocalAdmin, redirect);
|
return Update(id, pAssignedUserLocalAdmin, AssignedUserLocalAdmin, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
||||||
public virtual ActionResult UpdateAllowUntrustedReimageJobEnrolment(int id, string AllowUntrustedReimageJobEnrolment = null, Nullable<bool> redirect = null)
|
public virtual ActionResult UpdateAllowUntrustedReimageJobEnrolment(int id, string AllowUntrustedReimageJobEnrolment = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pAllowUntrustedReimageJobEnrolment, AllowUntrustedReimageJobEnrolment, redirect);
|
return Update(id, pAllowUntrustedReimageJobEnrolment, AllowUntrustedReimageJobEnrolment, redirect);
|
||||||
}
|
}
|
||||||
@@ -444,20 +561,6 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateComputerNameTemplate(DeviceProfile deviceProfile, string ComputerNameTemplate)
|
|
||||||
{
|
|
||||||
Authorization.Require(Claims.Config.DeviceProfile.ConfigureComputerNameTemplate);
|
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(ComputerNameTemplate))
|
|
||||||
throw new Exception("ComputerNameTemplate is Required");
|
|
||||||
|
|
||||||
deviceProfile.ComputerNameTemplate = ComputerNameTemplate;
|
|
||||||
|
|
||||||
Database.SaveChanges();
|
|
||||||
|
|
||||||
deviceProfile.ComputerNameInvalidateCache();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdateDefaultOrganisationAddress(DeviceProfile deviceProfile, string DefaultOrganisationAddress)
|
private void UpdateDefaultOrganisationAddress(DeviceProfile deviceProfile, string DefaultOrganisationAddress)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(DefaultOrganisationAddress))
|
if (string.IsNullOrEmpty(DefaultOrganisationAddress))
|
||||||
@@ -593,7 +696,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
#region Actions
|
#region Actions
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceProfile.Delete)]
|
[DiscoAuthorize(Claims.Config.DeviceProfile.Delete)]
|
||||||
public virtual ActionResult Delete(int id, Nullable<bool> redirect = false)
|
public virtual ActionResult Delete(int id, bool? redirect = false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -623,7 +726,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
#region Defaults
|
#region Defaults
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceProfile.ConfigureDefaults)]
|
[DiscoAuthorize(Claims.Config.DeviceProfile.ConfigureDefaults)]
|
||||||
public virtual ActionResult Default(int id, Nullable<bool> redirect = null)
|
public virtual ActionResult Default(int id, bool? redirect = null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -649,7 +752,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceProfile.ConfigureDefaults)]
|
[DiscoAuthorize(Claims.Config.DeviceProfile.ConfigureDefaults)]
|
||||||
public virtual ActionResult DefaultAddDeviceOffline(int id, Nullable<bool> redirect = false)
|
public virtual ActionResult DefaultAddDeviceOffline(int id, bool? redirect = false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -69,5 +69,20 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
|
|
||||||
return Json(results, JsonRequestBehavior.AllowGet);
|
return Json(results, JsonRequestBehavior.AllowGet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[DiscoAuthorize(Claims.Device.Search)]
|
||||||
|
public virtual ActionResult Devices(string Term, int Limit = 15)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(Term))
|
||||||
|
throw new ArgumentNullException("Term", "The search query term is required");
|
||||||
|
if (Term.Length < 2)
|
||||||
|
throw new ArgumentException("The search query term must be at least two characters", "Term");
|
||||||
|
if (Limit < 1)
|
||||||
|
throw new ArgumentException("The search query limit cannot be less than 1", "Limit");
|
||||||
|
|
||||||
|
var results = Search.SearchDevices(Database, Term, Limit);
|
||||||
|
|
||||||
|
return Json(results, JsonRequestBehavior.AllowGet);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Disco.Web.Areas.API.Models.DeviceModel
|
||||||
|
{
|
||||||
|
public class TestComputerNameTemplateModel
|
||||||
|
{
|
||||||
|
public int DeviceProfileId { get; set; }
|
||||||
|
public string ComputerNameTemplate { get; set; }
|
||||||
|
public TestComputerNameTemplateResultModel UserSpecifiedResult { get; set; }
|
||||||
|
public List<TestComputerNameTemplateResultModel> RandomDeviceResults { get; set; }
|
||||||
|
|
||||||
|
public class TestComputerNameTemplateResultModel
|
||||||
|
{
|
||||||
|
public string DeviceSerialNumber { get; set; }
|
||||||
|
public bool Success { get; set; }
|
||||||
|
public string ErrorMessage { get; set; }
|
||||||
|
public string DeviceComputerName { get; set; }
|
||||||
|
public string RenderedComputerName { get; set; }
|
||||||
|
public string Url { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -295,36 +295,6 @@
|
|||||||
Template Expression:
|
Template Expression:
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
@if (canConfig && canConfigExpression)
|
|
||||||
{
|
|
||||||
@Html.EditorFor(model => model.DeviceProfile.ComputerNameTemplate)
|
|
||||||
@AjaxHelpers.AjaxSave()
|
|
||||||
@AjaxHelpers.AjaxLoader()
|
|
||||||
<a id="expressionBrowserAnchor" href="@(Url.Action(MVC.Config.DocumentTemplate.ExpressionBrowser()))"> </a>
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(function () {
|
|
||||||
var field = $('#DeviceProfile_ComputerNameTemplate');
|
|
||||||
var fieldOriginalWidth, fieldOriginalHeight;
|
|
||||||
|
|
||||||
document.DiscoFunctions.PropertyChangeHelper(
|
|
||||||
field,
|
|
||||||
'None',
|
|
||||||
'@Url.Action(MVC.API.DeviceProfile.UpdateComputerNameTemplate(Model.DeviceProfile.Id))',
|
|
||||||
'ComputerNameTemplate'
|
|
||||||
);
|
|
||||||
|
|
||||||
field.focus(function () {
|
|
||||||
fieldOriginalWidth = field.width();
|
|
||||||
fieldOriginalHeight = field.height();
|
|
||||||
field.css('overflow', 'visible').animate({ width: field.parent().width() - 52, height: 75 }, 200);
|
|
||||||
}).blur(function () {
|
|
||||||
field.css('overflow', 'hidden').animate({ width: fieldOriginalWidth, height: fieldOriginalHeight }, 200);
|
|
||||||
}).attr('placeholder', 'None').attr('spellcheck', 'false');
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<div id="displayComputerNameTemplate" class="code">
|
<div id="displayComputerNameTemplate" class="code">
|
||||||
@if (string.IsNullOrWhiteSpace(Model.DeviceProfile.ComputerNameTemplate))
|
@if (string.IsNullOrWhiteSpace(Model.DeviceProfile.ComputerNameTemplate))
|
||||||
{
|
{
|
||||||
@@ -335,6 +305,217 @@
|
|||||||
@Model.DeviceProfile.ComputerNameTemplate
|
@Model.DeviceProfile.ComputerNameTemplate
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
@if (canConfig && canConfigExpression)
|
||||||
|
{
|
||||||
|
<a id="changeComputerNameTemplate" href="#" class="button small">Change</a>@AjaxHelpers.AjaxLoader()
|
||||||
|
<div id="dialogComputerNameTemplate" title="Computer Name Template" class="dialog">
|
||||||
|
@using (Html.BeginForm(MVC.API.DeviceProfile.UpdateComputerNameTemplate(Model.DeviceProfile.Id, null, false)))
|
||||||
|
{
|
||||||
|
@Html.AntiForgeryToken()
|
||||||
|
@Html.TextArea("ComputerNameTemplate", Model.DeviceProfile.ComputerNameTemplate, new { spellcheck = "false", required = "required" })
|
||||||
|
}
|
||||||
|
<div class="hidden info-box error code whitespace-pre-wrap">
|
||||||
|
</div>
|
||||||
|
<div class="test hidden">
|
||||||
|
@using (Html.BeginForm(MVC.API.DeviceProfile.TestComputerNameTemplate(Model.DeviceProfile.Id)))
|
||||||
|
{
|
||||||
|
@Html.AntiForgeryToken();
|
||||||
|
<table class="genericData">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Serial Number</th>
|
||||||
|
<th>Current</th>
|
||||||
|
<th>Result</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<input id="ComputerNameTemplateTestSearch" name="UserSpecifiedDeviceSerialNumber" type="text" placeholder="Device Serial Number" spellcheck="false" />
|
||||||
|
</td>
|
||||||
|
<td> </td>
|
||||||
|
<td> </td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<button id="ComputerNameTemplateTest" class="button small" type="button">Test Template</button>@AjaxHelpers.AjaxLoader()
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(() => {
|
||||||
|
let $dialog = null;
|
||||||
|
let $textarea = null;
|
||||||
|
let currentValue = null;
|
||||||
|
|
||||||
|
$('#changeComputerNameTemplate').click(e => {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
if (!$dialog) {
|
||||||
|
$textarea = $('#ComputerNameTemplate');
|
||||||
|
currentValue = $textarea.val();
|
||||||
|
$dialog = $('#dialogComputerNameTemplate').dialog({
|
||||||
|
autoOpen: false,
|
||||||
|
buttons: null,
|
||||||
|
draggable: false,
|
||||||
|
modal: true,
|
||||||
|
resizable: false,
|
||||||
|
width: 700,
|
||||||
|
buttons: {
|
||||||
|
"Cancel": () => {
|
||||||
|
$textarea.val(currentValue);
|
||||||
|
$dialog.find('.error').addClass('hidden');
|
||||||
|
$dialog.dialog("close");
|
||||||
|
},
|
||||||
|
"Expression Browser": () => {
|
||||||
|
window.open('@(Url.Action(MVC.Config.DocumentTemplate.ExpressionBrowser()))', '_blank');
|
||||||
|
},
|
||||||
|
"Save": () => {
|
||||||
|
const $form = $textarea.closest('form');
|
||||||
|
$(this).find('.error').addClass('hidden');
|
||||||
|
|
||||||
|
if ($form[0].reportValidity()) {
|
||||||
|
const body = new FormData($form[0]);
|
||||||
|
const url = $form.attr('action');
|
||||||
|
|
||||||
|
const $ajaxLoading = $('#changeComputerNameTemplate').nextAll('.ajaxLoading').first();
|
||||||
|
$ajaxLoading.show();
|
||||||
|
$dialog.dialog('close');
|
||||||
|
|
||||||
|
fetch(url, {
|
||||||
|
method: 'POST',
|
||||||
|
body: body
|
||||||
|
}).then(response => {
|
||||||
|
if (response.ok) {
|
||||||
|
currentValue = $textarea.val();
|
||||||
|
const $display = $('#displayComputerNameTemplate');
|
||||||
|
if (currentValue) {
|
||||||
|
$display.text(currentValue);
|
||||||
|
} else {
|
||||||
|
$display.html('<span class="smallMessage"><None Specified></span>');
|
||||||
|
}
|
||||||
|
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
|
||||||
|
} else if (response.status == 400) {
|
||||||
|
response.json().then(data => {
|
||||||
|
$ajaxLoading.hide();
|
||||||
|
$dialog.dialog('open');
|
||||||
|
$dialog.find('.error').text(data).removeClass('hidden');
|
||||||
|
console.error(data);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
alert('Unable to save computer name template');
|
||||||
|
$ajaxLoading.hide();
|
||||||
|
$dialog.dialog('open');
|
||||||
|
$dialog.find('.error').text('Unable to save computer name template: ' + error).removeClass('hidden');
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const $buttonTest = $dialog.find('#ComputerNameTemplateTest');
|
||||||
|
$buttonTest.click(e => {
|
||||||
|
e.preventDefault();
|
||||||
|
const $test = $dialog.find('.test');
|
||||||
|
|
||||||
|
const $ajaxLoading = $(e.currentTarget).nextAll('.ajaxLoading').first();
|
||||||
|
$ajaxLoading.show();
|
||||||
|
|
||||||
|
const $form = $test.find('form');
|
||||||
|
const url = $form.attr('action');
|
||||||
|
const body = new FormData($form[0]);
|
||||||
|
body.append('ComputerNameTemplate', $textarea.val());
|
||||||
|
|
||||||
|
fetch(url, {
|
||||||
|
method: 'POST',
|
||||||
|
body: body
|
||||||
|
}).then(response => {
|
||||||
|
if (response.ok) {
|
||||||
|
response.json().then(data => {
|
||||||
|
const $table = $test.find('table tbody');
|
||||||
|
if (data.UserSpecifiedResult) {
|
||||||
|
const result = data.UserSpecifiedResult;
|
||||||
|
const row = $table.find('tr').first();
|
||||||
|
row.find('input').val(result.DeviceSerialNumber);
|
||||||
|
const columns = row.find('td');
|
||||||
|
columns.eq(1).html('');
|
||||||
|
$('<span class="code">').text(result.DeviceComputerName)
|
||||||
|
.appendTo(columns.eq(1))
|
||||||
|
columns.eq(2).html('');
|
||||||
|
$('<span class="code">').text(result.RenderedComputerName)
|
||||||
|
.appendTo(columns.eq(2))
|
||||||
|
if (!result.Success) {
|
||||||
|
$('<div class="info-box error code whitespace-pre-wrap">').text(result.ErrorMessage).appendTo(columns[2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (data.RandomDeviceResults) {
|
||||||
|
$table.find('tr').slice(1).remove();
|
||||||
|
for (var i = 0; i < data.RandomDeviceResults.length; i++) {
|
||||||
|
const result = data.RandomDeviceResults[i];
|
||||||
|
const row = $('<tr><td></td><td></td><td></td></tr>');
|
||||||
|
const columns = row.find('td');
|
||||||
|
$('<a>').attr({
|
||||||
|
href: result.Url,
|
||||||
|
target: '_blank'
|
||||||
|
}).text(result.DeviceSerialNumber)
|
||||||
|
.appendTo(columns.eq(0));
|
||||||
|
$('<span class="code">').text(result.DeviceComputerName)
|
||||||
|
.appendTo(columns.eq(1))
|
||||||
|
$('<span class="code">').text(result.RenderedComputerName)
|
||||||
|
.appendTo(columns.eq(2))
|
||||||
|
if (!result.Success) {
|
||||||
|
$('<div class="info-box error code whitespace-pre-wrap">').text(result.ErrorMessage).appendTo(columns.eq(2));
|
||||||
|
}
|
||||||
|
row.appendTo($table);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$test.removeClass('hidden');
|
||||||
|
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
|
||||||
|
});
|
||||||
|
} else if (response.status == 400) {
|
||||||
|
response.json().then(data => {
|
||||||
|
$ajaxLoading.hide();
|
||||||
|
$test.addClass('hidden');
|
||||||
|
$dialog.find('.error').text(data).removeClass('hidden');
|
||||||
|
console.error(data);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
$ajaxLoading.hide();
|
||||||
|
$test.addClass('hidden');
|
||||||
|
$dialog.find('.error').text('Unable to test computer name template: ' + error).removeClass('hidden');
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
|
|
||||||
|
return false;
|
||||||
|
})
|
||||||
|
const $testSearchText = $dialog.find('#ComputerNameTemplateTestSearch');
|
||||||
|
$testSearchText.autocomplete({
|
||||||
|
source: '@(Url.Action(MVC.API.Search.Devices()))',
|
||||||
|
minLength: 2,
|
||||||
|
focus: function (e, ui) {
|
||||||
|
$testSearchText.val(ui.item.Id);
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
select: function (e, ui) {
|
||||||
|
$testSearchText.val(ui.item.Id).blur();
|
||||||
|
$buttonTest.click();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}).data('ui-autocomplete')._renderItem = function (ul, item) {
|
||||||
|
return $('<li>')
|
||||||
|
.data('item.autocomplete', item)
|
||||||
|
.append($('<a>').text(item.Description))
|
||||||
|
.appendTo(ul);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
$dialog.dialog('open');
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
}
|
}
|
||||||
<div style="margin-top: 8px;">
|
<div style="margin-top: 8px;">
|
||||||
@if (canConfig)
|
@if (canConfig)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -281,28 +281,18 @@ table.deviceProfileTable th.type {
|
|||||||
table.deviceProfileTable th.deviceCount {
|
table.deviceProfileTable th.deviceCount {
|
||||||
width: 120px;
|
width: 120px;
|
||||||
}
|
}
|
||||||
#configurationDeviceProfileShow #DeviceProfile_ComputerNameTemplate {
|
|
||||||
height: 16px;
|
|
||||||
min-height: 16px;
|
|
||||||
width: calc(100% - 32px);
|
|
||||||
overflow: hidden;
|
|
||||||
font-family: Consolas, "Courier New", monospace;
|
|
||||||
}
|
|
||||||
#configurationDeviceProfileShow #expressionBrowserAnchor {
|
|
||||||
display: inline-block;
|
|
||||||
height: 16px;
|
|
||||||
width: 16px;
|
|
||||||
margin-left: 2px;
|
|
||||||
cursor: pointer;
|
|
||||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACKUlEQVQ4jaWTTU4UURDHf/W6gXFgJlHZKFvEe3gBvYhewXgGTXRpOILhGESGgEuNjB9N/BgCTJjufvXhonsQ176kkqpFVf2q6v8kIvifV77b2wsAU6MsCop/LCEpISIkEUAoioSZYWZczOeUp6en1ZPHT+4FQXgQERDBMrZlHACOpIKcM23bMN3fr0pEcDfub21x9/YdIhwR6QoJWFY8wF2JAHfH3fh8MoUISoGugxnPnj1lZ2eHg/cHTL9MMTdy09K0LVkVy8rsbMZkMukpoRQRRBIAZ2czNjbWWV1bZXY2I6WCpq5pmgY1ZXoypaoqAEQSsSQQ6Tb67es3Xr9+Q103PHy4w+Fkgpoxn1/y8eMn6rq+3v4yp0TkOvpeVaytreHuHB4egggXFxdUVUVZrrKxXmJuLBYLut15PwIwGo1IqTuTSGJlJfj1+xdXV1eMx2PCnTZn3B1VRZY6kJ5gc3MTEenO1Cy4nF9SpILxaIya4maUqrgqdU8QEd0IArgbOStFmVFVNCuqirtjalgYboa5A3KDIAJEGA7XiQiauiZnZTgcXhdwM7RXX1ZlsbgCEUTkL8GD7W3UjMGtAUUqMDMiosf3niqTVbk1GLDUT5nV5Oj4A293d1G1647m3qvOb/hGBLRty9HxB8xM5OWrV49+/vj5wuk07x4CEZ2clxcWUuqclFIgiSIJo9Houdz8zufn56siMgBKoACkNwdcRDIRzWg8bpY5fwBYR4lbku/2TAAAAABJRU5ErkJggg==) /*Images/Actions/expressionBrowser.png*/;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
#configurationDeviceProfileShow #displayComputerNameTemplate {
|
#configurationDeviceProfileShow #displayComputerNameTemplate {
|
||||||
margin: 0 0 6px 0;
|
margin: 0 0 6px 0;
|
||||||
}
|
}
|
||||||
#configurationDeviceProfileShow #displayOrganisationalUnit {
|
#configurationDeviceProfileShow #displayOrganisationalUnit {
|
||||||
margin: 0 0 6px 0;
|
margin: 0 0 6px 0;
|
||||||
}
|
}
|
||||||
|
#dialogComputerNameTemplate #ComputerNameTemplate {
|
||||||
|
box-sizing: border-box;
|
||||||
|
height: 48px;
|
||||||
|
width: 100%;
|
||||||
|
font-family: Consolas, "Courier New", monospace;
|
||||||
|
}
|
||||||
.organisationalUnitTree span.fancytree-node {
|
.organisationalUnitTree span.fancytree-node {
|
||||||
padding: 1px;
|
padding: 1px;
|
||||||
border: none;
|
border: none;
|
||||||
|
|||||||
@@ -232,20 +232,6 @@ table.deviceProfileTable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#configurationDeviceProfileShow {
|
#configurationDeviceProfileShow {
|
||||||
#DeviceProfile_ComputerNameTemplate {
|
|
||||||
height: 16px;
|
|
||||||
min-height: 16px;
|
|
||||||
width: calc(~"100% - 32px");
|
|
||||||
overflow: hidden;
|
|
||||||
font-family: @FontFamilyMono;
|
|
||||||
}
|
|
||||||
|
|
||||||
#expressionBrowserAnchor {
|
|
||||||
.icon16;
|
|
||||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACKUlEQVQ4jaWTTU4UURDHf/W6gXFgJlHZKFvEe3gBvYhewXgGTXRpOILhGESGgEuNjB9N/BgCTJjufvXhonsQ176kkqpFVf2q6v8kIvifV77b2wsAU6MsCop/LCEpISIkEUAoioSZYWZczOeUp6en1ZPHT+4FQXgQERDBMrZlHACOpIKcM23bMN3fr0pEcDfub21x9/YdIhwR6QoJWFY8wF2JAHfH3fh8MoUISoGugxnPnj1lZ2eHg/cHTL9MMTdy09K0LVkVy8rsbMZkMukpoRQRRBIAZ2czNjbWWV1bZXY2I6WCpq5pmgY1ZXoypaoqAEQSsSQQ6Tb67es3Xr9+Q103PHy4w+Fkgpoxn1/y8eMn6rq+3v4yp0TkOvpeVaytreHuHB4egggXFxdUVUVZrrKxXmJuLBYLut15PwIwGo1IqTuTSGJlJfj1+xdXV1eMx2PCnTZn3B1VRZY6kJ5gc3MTEenO1Cy4nF9SpILxaIya4maUqrgqdU8QEd0IArgbOStFmVFVNCuqirtjalgYboa5A3KDIAJEGA7XiQiauiZnZTgcXhdwM7RXX1ZlsbgCEUTkL8GD7W3UjMGtAUUqMDMiosf3niqTVbk1GLDUT5nV5Oj4A293d1G1647m3qvOb/hGBLRty9HxB8xM5OWrV49+/vj5wuk07x4CEZ2clxcWUuqclFIgiSIJo9Houdz8zufn56siMgBKoACkNwdcRDIRzWg8bpY5fwBYR4lbku/2TAAAAABJRU5ErkJggg==) /*Images/Actions/expressionBrowser.png*/;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
#displayComputerNameTemplate {
|
#displayComputerNameTemplate {
|
||||||
margin: 0 0 6px 0;
|
margin: 0 0 6px 0;
|
||||||
}
|
}
|
||||||
@@ -255,6 +241,15 @@ table.deviceProfileTable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#dialogComputerNameTemplate {
|
||||||
|
#ComputerNameTemplate {
|
||||||
|
box-sizing: border-box;
|
||||||
|
height: 48px;
|
||||||
|
width: 100%;
|
||||||
|
font-family: @FontFamilyMono;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.organisationalUnitTree {
|
.organisationalUnitTree {
|
||||||
span.fancytree-node {
|
span.fancytree-node {
|
||||||
padding: 1px;
|
padding: 1px;
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -214,6 +214,7 @@
|
|||||||
<Compile Include="Areas\API\Controllers\JobQueueJobController.cs" />
|
<Compile Include="Areas\API\Controllers\JobQueueJobController.cs" />
|
||||||
<Compile Include="Areas\API\Controllers\PluginController.cs" />
|
<Compile Include="Areas\API\Controllers\PluginController.cs" />
|
||||||
<Compile Include="Areas\API\Controllers\SearchController.cs" />
|
<Compile Include="Areas\API\Controllers\SearchController.cs" />
|
||||||
|
<Compile Include="Areas\API\Models\DeviceModel\TestComputerNameTemplateModel.cs" />
|
||||||
<Compile Include="Areas\API\Models\DocumentTemplate\AddOnImportUserFlagRuleModel.cs" />
|
<Compile Include="Areas\API\Models\DocumentTemplate\AddOnImportUserFlagRuleModel.cs" />
|
||||||
<Compile Include="Areas\API\Models\DocumentTemplate\BulkGenerateUserModel.cs" />
|
<Compile Include="Areas\API\Models\DocumentTemplate\BulkGenerateUserModel.cs" />
|
||||||
<Compile Include="Areas\API\Models\DocumentTemplate\DocumentHandlersModel.cs" />
|
<Compile Include="Areas\API\Models\DocumentTemplate\DocumentHandlersModel.cs" />
|
||||||
|
|||||||
@@ -127,6 +127,12 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
[NonAction]
|
[NonAction]
|
||||||
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
|
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
|
||||||
|
public virtual System.Web.Mvc.ActionResult TestComputerNameTemplate()
|
||||||
|
{
|
||||||
|
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.TestComputerNameTemplate);
|
||||||
|
}
|
||||||
|
[NonAction]
|
||||||
|
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
|
||||||
public virtual System.Web.Mvc.ActionResult UpdateEnforceComputerNameConvention()
|
public virtual System.Web.Mvc.ActionResult UpdateEnforceComputerNameConvention()
|
||||||
{
|
{
|
||||||
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateEnforceComputerNameConvention);
|
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateEnforceComputerNameConvention);
|
||||||
@@ -212,6 +218,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
public readonly string UpdateOrganisationalUnit = "UpdateOrganisationalUnit";
|
public readonly string UpdateOrganisationalUnit = "UpdateOrganisationalUnit";
|
||||||
public readonly string UpdateDefaultOrganisationAddress = "UpdateDefaultOrganisationAddress";
|
public readonly string UpdateDefaultOrganisationAddress = "UpdateDefaultOrganisationAddress";
|
||||||
public readonly string UpdateComputerNameTemplate = "UpdateComputerNameTemplate";
|
public readonly string UpdateComputerNameTemplate = "UpdateComputerNameTemplate";
|
||||||
|
public readonly string TestComputerNameTemplate = "TestComputerNameTemplate";
|
||||||
public readonly string UpdateEnforceComputerNameConvention = "UpdateEnforceComputerNameConvention";
|
public readonly string UpdateEnforceComputerNameConvention = "UpdateEnforceComputerNameConvention";
|
||||||
public readonly string UpdateEnforceOrganisationalUnit = "UpdateEnforceOrganisationalUnit";
|
public readonly string UpdateEnforceOrganisationalUnit = "UpdateEnforceOrganisationalUnit";
|
||||||
public readonly string UpdateProvisionADAccount = "UpdateProvisionADAccount";
|
public readonly string UpdateProvisionADAccount = "UpdateProvisionADAccount";
|
||||||
@@ -238,6 +245,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
public const string UpdateOrganisationalUnit = "UpdateOrganisationalUnit";
|
public const string UpdateOrganisationalUnit = "UpdateOrganisationalUnit";
|
||||||
public const string UpdateDefaultOrganisationAddress = "UpdateDefaultOrganisationAddress";
|
public const string UpdateDefaultOrganisationAddress = "UpdateDefaultOrganisationAddress";
|
||||||
public const string UpdateComputerNameTemplate = "UpdateComputerNameTemplate";
|
public const string UpdateComputerNameTemplate = "UpdateComputerNameTemplate";
|
||||||
|
public const string TestComputerNameTemplate = "TestComputerNameTemplate";
|
||||||
public const string UpdateEnforceComputerNameConvention = "UpdateEnforceComputerNameConvention";
|
public const string UpdateEnforceComputerNameConvention = "UpdateEnforceComputerNameConvention";
|
||||||
public const string UpdateEnforceOrganisationalUnit = "UpdateEnforceOrganisationalUnit";
|
public const string UpdateEnforceOrganisationalUnit = "UpdateEnforceOrganisationalUnit";
|
||||||
public const string UpdateProvisionADAccount = "UpdateProvisionADAccount";
|
public const string UpdateProvisionADAccount = "UpdateProvisionADAccount";
|
||||||
@@ -362,6 +370,16 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
public readonly string ComputerNameTemplate = "ComputerNameTemplate";
|
public readonly string ComputerNameTemplate = "ComputerNameTemplate";
|
||||||
public readonly string redirect = "redirect";
|
public readonly string redirect = "redirect";
|
||||||
}
|
}
|
||||||
|
static readonly ActionParamsClass_TestComputerNameTemplate s_params_TestComputerNameTemplate = new ActionParamsClass_TestComputerNameTemplate();
|
||||||
|
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
|
||||||
|
public ActionParamsClass_TestComputerNameTemplate TestComputerNameTemplateParams { get { return s_params_TestComputerNameTemplate; } }
|
||||||
|
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
|
||||||
|
public class ActionParamsClass_TestComputerNameTemplate
|
||||||
|
{
|
||||||
|
public readonly string id = "id";
|
||||||
|
public readonly string ComputerNameTemplate = "ComputerNameTemplate";
|
||||||
|
public readonly string UserSpecifiedDeviceSerialNumber = "UserSpecifiedDeviceSerialNumber";
|
||||||
|
}
|
||||||
static readonly ActionParamsClass_UpdateEnforceComputerNameConvention s_params_UpdateEnforceComputerNameConvention = new ActionParamsClass_UpdateEnforceComputerNameConvention();
|
static readonly ActionParamsClass_UpdateEnforceComputerNameConvention s_params_UpdateEnforceComputerNameConvention = new ActionParamsClass_UpdateEnforceComputerNameConvention();
|
||||||
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
|
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
|
||||||
public ActionParamsClass_UpdateEnforceComputerNameConvention UpdateEnforceComputerNameConventionParams { get { return s_params_UpdateEnforceComputerNameConvention; } }
|
public ActionParamsClass_UpdateEnforceComputerNameConvention UpdateEnforceComputerNameConventionParams { get { return s_params_UpdateEnforceComputerNameConvention; } }
|
||||||
@@ -633,6 +651,20 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
return callInfo;
|
return callInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[NonAction]
|
||||||
|
partial void TestComputerNameTemplateOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id, string ComputerNameTemplate, string UserSpecifiedDeviceSerialNumber);
|
||||||
|
|
||||||
|
[NonAction]
|
||||||
|
public override System.Web.Mvc.ActionResult TestComputerNameTemplate(int id, string ComputerNameTemplate, string UserSpecifiedDeviceSerialNumber)
|
||||||
|
{
|
||||||
|
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.TestComputerNameTemplate);
|
||||||
|
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
|
||||||
|
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "ComputerNameTemplate", ComputerNameTemplate);
|
||||||
|
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "UserSpecifiedDeviceSerialNumber", UserSpecifiedDeviceSerialNumber);
|
||||||
|
TestComputerNameTemplateOverride(callInfo, id, ComputerNameTemplate, UserSpecifiedDeviceSerialNumber);
|
||||||
|
return callInfo;
|
||||||
|
}
|
||||||
|
|
||||||
[NonAction]
|
[NonAction]
|
||||||
partial void UpdateEnforceComputerNameConventionOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id, string EnforceComputerNameConvention, bool? redirect);
|
partial void UpdateEnforceComputerNameConventionOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id, string EnforceComputerNameConvention, bool? redirect);
|
||||||
|
|
||||||
|
|||||||
@@ -71,6 +71,12 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
{
|
{
|
||||||
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UsersUpstream);
|
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UsersUpstream);
|
||||||
}
|
}
|
||||||
|
[NonAction]
|
||||||
|
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
|
||||||
|
public virtual System.Web.Mvc.ActionResult Devices()
|
||||||
|
{
|
||||||
|
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Devices);
|
||||||
|
}
|
||||||
|
|
||||||
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
|
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
|
||||||
public SearchController Actions { get { return MVC.API.Search; } }
|
public SearchController Actions { get { return MVC.API.Search; } }
|
||||||
@@ -89,6 +95,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
{
|
{
|
||||||
public readonly string QuickQuery = "QuickQuery";
|
public readonly string QuickQuery = "QuickQuery";
|
||||||
public readonly string UsersUpstream = "UsersUpstream";
|
public readonly string UsersUpstream = "UsersUpstream";
|
||||||
|
public readonly string Devices = "Devices";
|
||||||
}
|
}
|
||||||
|
|
||||||
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
|
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
|
||||||
@@ -96,6 +103,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
{
|
{
|
||||||
public const string QuickQuery = "QuickQuery";
|
public const string QuickQuery = "QuickQuery";
|
||||||
public const string UsersUpstream = "UsersUpstream";
|
public const string UsersUpstream = "UsersUpstream";
|
||||||
|
public const string Devices = "Devices";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -117,6 +125,15 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
public readonly string Term = "Term";
|
public readonly string Term = "Term";
|
||||||
public readonly string Limit = "Limit";
|
public readonly string Limit = "Limit";
|
||||||
}
|
}
|
||||||
|
static readonly ActionParamsClass_Devices s_params_Devices = new ActionParamsClass_Devices();
|
||||||
|
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
|
||||||
|
public ActionParamsClass_Devices DevicesParams { get { return s_params_Devices; } }
|
||||||
|
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
|
||||||
|
public class ActionParamsClass_Devices
|
||||||
|
{
|
||||||
|
public readonly string Term = "Term";
|
||||||
|
public readonly string Limit = "Limit";
|
||||||
|
}
|
||||||
static readonly ViewsClass s_views = new ViewsClass();
|
static readonly ViewsClass s_views = new ViewsClass();
|
||||||
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
|
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
|
||||||
public ViewsClass Views { get { return s_views; } }
|
public ViewsClass Views { get { return s_views; } }
|
||||||
@@ -162,6 +179,19 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
return callInfo;
|
return callInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[NonAction]
|
||||||
|
partial void DevicesOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, string Term, int Limit);
|
||||||
|
|
||||||
|
[NonAction]
|
||||||
|
public override System.Web.Mvc.ActionResult Devices(string Term, int Limit)
|
||||||
|
{
|
||||||
|
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Devices);
|
||||||
|
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "Term", Term);
|
||||||
|
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "Limit", Limit);
|
||||||
|
DevicesOverride(callInfo, Term, Limit);
|
||||||
|
return callInfo;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -592,6 +592,7 @@ namespace Links
|
|||||||
public const string UrlPath = "~/ClientSource/Style/FontAwesome";
|
public const string UrlPath = "~/ClientSource/Style/FontAwesome";
|
||||||
public static string Url() { return T4MVCHelpers.ProcessVirtualPath(UrlPath); }
|
public static string Url() { return T4MVCHelpers.ProcessVirtualPath(UrlPath); }
|
||||||
public static string Url(string fileName) { return T4MVCHelpers.ProcessVirtualPath(UrlPath + "/" + fileName); }
|
public static string Url(string fileName) { return T4MVCHelpers.ProcessVirtualPath(UrlPath + "/" + fileName); }
|
||||||
|
public static readonly string animated_less = Url("animated.less");
|
||||||
public static readonly string bordered_pulled_less = Url("bordered-pulled.less");
|
public static readonly string bordered_pulled_less = Url("bordered-pulled.less");
|
||||||
public static readonly string core_less = Url("core.less");
|
public static readonly string core_less = Url("core.less");
|
||||||
public static readonly string fixed_width_less = Url("fixed-width.less");
|
public static readonly string fixed_width_less = Url("fixed-width.less");
|
||||||
@@ -600,6 +601,7 @@ namespace Links
|
|||||||
public static readonly string fontawesome_webfont_svg = Url("fontawesome-webfont.svg");
|
public static readonly string fontawesome_webfont_svg = Url("fontawesome-webfont.svg");
|
||||||
public static readonly string fontawesome_webfont_ttf = Url("fontawesome-webfont.ttf");
|
public static readonly string fontawesome_webfont_ttf = Url("fontawesome-webfont.ttf");
|
||||||
public static readonly string fontawesome_webfont_woff = Url("fontawesome-webfont.woff");
|
public static readonly string fontawesome_webfont_woff = Url("fontawesome-webfont.woff");
|
||||||
|
public static readonly string fontawesome_webfont_woff2 = Url("fontawesome-webfont.woff2");
|
||||||
public static readonly string FontAwesome_otf = Url("FontAwesome.otf");
|
public static readonly string FontAwesome_otf = Url("FontAwesome.otf");
|
||||||
public static readonly string icons_less = Url("icons.less");
|
public static readonly string icons_less = Url("icons.less");
|
||||||
public static readonly string larger_less = Url("larger.less");
|
public static readonly string larger_less = Url("larger.less");
|
||||||
@@ -607,7 +609,7 @@ namespace Links
|
|||||||
public static readonly string mixins_less = Url("mixins.less");
|
public static readonly string mixins_less = Url("mixins.less");
|
||||||
public static readonly string path_less = Url("path.less");
|
public static readonly string path_less = Url("path.less");
|
||||||
public static readonly string rotated_flipped_less = Url("rotated-flipped.less");
|
public static readonly string rotated_flipped_less = Url("rotated-flipped.less");
|
||||||
public static readonly string spinning_less = Url("spinning.less");
|
public static readonly string screen_reader_less = Url("screen-reader.less");
|
||||||
public static readonly string stacked_less = Url("stacked.less");
|
public static readonly string stacked_less = Url("stacked.less");
|
||||||
public static readonly string variables_less = Url("variables.less");
|
public static readonly string variables_less = Url("variables.less");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 16
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 16.0.30711.63
|
VisualStudioVersion = 17.8.34309.116
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Disco.ClientBootstrapper", "Disco.ClientBootstrapper\Disco.ClientBootstrapper.csproj", "{15BD9561-A3C7-4608-9F7E-F1A1CFB60055}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Disco.ClientBootstrapper", "Disco.ClientBootstrapper\Disco.ClientBootstrapper.csproj", "{15BD9561-A3C7-4608-9F7E-F1A1CFB60055}"
|
||||||
EndProject
|
EndProject
|
||||||
@@ -21,6 +21,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Disco.Client", "Disco.Clien
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Disco.Services.Plugins.ManifestGenerator", "Disco.Services.Plugins.ManifestGenerator\Disco.Services.Plugins.ManifestGenerator.csproj", "{35E90902-D5A6-4C14-BA6B-2DF976E4B96A}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Disco.Services.Plugins.ManifestGenerator", "Disco.Services.Plugins.ManifestGenerator\Disco.Services.Plugins.ManifestGenerator.csproj", "{35E90902-D5A6-4C14-BA6B-2DF976E4B96A}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{578564D7-D269-4219-8791-977D56DE9A34}"
|
||||||
|
ProjectSection(SolutionItems) = preProject
|
||||||
|
.editorconfig = .editorconfig
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@@ -132,16 +137,4 @@ Global
|
|||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {1CCC4DCB-653B-464B-B05D-285032B28DC4}
|
SolutionGuid = {1CCC4DCB-653B-464B-B05D-285032B28DC4}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(AutomaticVersions) = postSolution
|
|
||||||
UpdateAssemblyVersion = True
|
|
||||||
UpdateAssemblyFileVersion = True
|
|
||||||
UpdateAssemblyInfoVersion = False
|
|
||||||
ShouldCreateLogs = True
|
|
||||||
AdvancedSettingsExpanded = True
|
|
||||||
AssemblyVersionSettings = None.None.DateStamp.TimeStamp
|
|
||||||
AssemblyFileVersionSettings = None.None.DateStamp.TimeStamp
|
|
||||||
UpdatePackageVersion = False
|
|
||||||
AssemblyInfoVersionType = SettingsVersion
|
|
||||||
InheritWinAppVersionFrom = None
|
|
||||||
EndGlobalSection
|
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|||||||
Reference in New Issue
Block a user