Allow remote maintenance via web.config setting

This commit is contained in:
Gary Sharp
2018-04-19 17:11:19 +10:00
parent 3c197e7b2f
commit cb033c0b70
5 changed files with 12 additions and 4 deletions
@@ -5,6 +5,7 @@ using Disco.Services.Users;
using Disco.Web.Areas.API.Models.Shared; using Disco.Web.Areas.API.Models.Shared;
using Disco.Web.Models.InitialConfig; using Disco.Web.Models.InitialConfig;
using System; using System;
using System.Configuration;
using System.Data.SqlClient; using System.Data.SqlClient;
using System.IO; using System.IO;
using System.IO.Compression; using System.IO.Compression;
@@ -64,7 +65,7 @@ namespace Disco.Web.Controllers
protected override void OnActionExecuting(ActionExecutingContext filterContext) protected override void OnActionExecuting(ActionExecutingContext filterContext)
{ {
if (!Request.IsLocal && !ServerIsCoreSKU.Value) if (!Request.IsLocal && !ServerIsCoreSKU.Value && !("true".Equals(ConfigurationManager.AppSettings["DiscoAllowRemoteMaintenance"], StringComparison.OrdinalIgnoreCase)))
{ {
filterContext.Result = new ContentResult() { filterContext.Result = new ContentResult() {
Content = "Initial Configuration of Disco ICT is only allowed via a localhost connection", Content = "Initial Configuration of Disco ICT is only allowed via a localhost connection",
+3 -1
View File
@@ -1,4 +1,6 @@
using Disco.Services.Plugins; using Disco.Services.Plugins;
using System;
using System.Configuration;
using System.Web.Mvc; using System.Web.Mvc;
namespace Disco.Web.Controllers namespace Disco.Web.Controllers
@@ -8,7 +10,7 @@ namespace Disco.Web.Controllers
{ {
protected override void OnActionExecuting(ActionExecutingContext filterContext) protected override void OnActionExecuting(ActionExecutingContext filterContext)
{ {
if (!Request.IsLocal && !InitialConfigController.ServerIsCoreSKU.Value) if (!Request.IsLocal && !InitialConfigController.ServerIsCoreSKU.Value && !("true".Equals(ConfigurationManager.AppSettings["DiscoIgnoreVersionUpdate"], StringComparison.OrdinalIgnoreCase)))
{ {
filterContext.Result = new ContentResult() filterContext.Result = new ContentResult()
{ {
+1
View File
@@ -17,6 +17,7 @@
<connectionStrings xdt:Transform="Remove" /> <connectionStrings xdt:Transform="Remove" />
<appSettings> <appSettings>
<add key="DiscoIgnoreVersionUpdate" xdt:Transform="Remove" xdt:Locator="Match(key)" /> <add key="DiscoIgnoreVersionUpdate" xdt:Transform="Remove" xdt:Locator="Match(key)" />
<add key="DiscoAllowRemoteMaintenance" xdt:Transform="Remove" xdt:Locator="Match(key)" />
</appSettings> </appSettings>
<system.web> <system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" /> <compilation xdt:Transform="RemoveAttributes(debug)" />
+1
View File
@@ -11,6 +11,7 @@
<add key="ClientValidationEnabled" value="true" /> <add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" /> <add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="DiscoIgnoreVersionUpdate" value="true" /> <add key="DiscoIgnoreVersionUpdate" value="true" />
<add key="DiscoAllowRemoteMaintenance" value="true" />
<add key="Microsoft.VisualStudio.Enterprise.AspNetHelper.VsInstrLocation" value="C:\Program Files (x86)\Microsoft Visual Studio 11.0\Team Tools\Performance Tools\x64\vsinstr.exe" /> <add key="Microsoft.VisualStudio.Enterprise.AspNetHelper.VsInstrLocation" value="C:\Program Files (x86)\Microsoft Visual Studio 11.0\Team Tools\Performance Tools\x64\vsinstr.exe" />
</appSettings> </appSettings>
<connectionStrings> <connectionStrings>
+5 -2
View File
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14 # Visual Studio 15
VisualStudioVersion = 14.0.25420.1 VisualStudioVersion = 15.0.27004.2010
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
@@ -129,6 +129,9 @@ Global
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {1CCC4DCB-653B-464B-B05D-285032B28DC4}
EndGlobalSection
GlobalSection(AutomaticVersions) = postSolution GlobalSection(AutomaticVersions) = postSolution
UpdateAssemblyVersion = False UpdateAssemblyVersion = False
UpdateAssemblyFileVersion = False UpdateAssemblyFileVersion = False