Merge remote-tracking branch 'origin/netcore/netcore' into netcore/feature/boot-failed-exception
This commit is contained in:
@@ -3,6 +3,7 @@ using Umbraco.Core;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
using System.Reflection;
|
||||
using Umbraco.Web.Common.Install;
|
||||
using Umbraco.Core.Hosting;
|
||||
|
||||
namespace Umbraco.Extensions
|
||||
{
|
||||
@@ -13,7 +14,7 @@ namespace Umbraco.Extensions
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetBackOfficeUrl(this LinkGenerator linkGenerator)
|
||||
public static string GetBackOfficeUrl(this LinkGenerator linkGenerator, IHostingEnvironment hostingEnvironment)
|
||||
{
|
||||
|
||||
Type backOfficeControllerType;
|
||||
@@ -22,9 +23,9 @@ namespace Umbraco.Extensions
|
||||
backOfficeControllerType = Assembly.Load("Umbraco.Web.BackOffice")?.GetType("Umbraco.Web.BackOffice.Controllers.BackOfficeController");
|
||||
if (backOfficeControllerType == null) return "/"; // this would indicate that the installer is installed without the back office
|
||||
}
|
||||
catch (Exception)
|
||||
catch
|
||||
{
|
||||
return "/"; // this would indicate that the installer is installed without the back office
|
||||
return hostingEnvironment.ApplicationVirtualPath; // this would indicate that the installer is installed without the back office
|
||||
}
|
||||
|
||||
return linkGenerator.GetPathByAction("Default", ControllerExtensions.GetControllerName(backOfficeControllerType), new { area = Constants.Web.Mvc.BackOfficeApiArea });
|
||||
@@ -37,7 +38,7 @@ namespace Umbraco.Extensions
|
||||
/// <returns></returns>
|
||||
public static string GetInstallerUrl(this LinkGenerator linkGenerator)
|
||||
{
|
||||
return linkGenerator.GetPathByAction("Index", ControllerExtensions.GetControllerName<InstallController>(), new { area = Constants.Web.Mvc.InstallArea });
|
||||
return linkGenerator.GetPathByAction(nameof(InstallController.Index), ControllerExtensions.GetControllerName<InstallController>(), new { area = Constants.Web.Mvc.InstallArea });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Umbraco.Web.Common.Install
|
||||
endpoints.MapGet($"{installPathSegment}/{{controller?}}/{{action?}}", context =>
|
||||
{
|
||||
// redirect to umbraco
|
||||
context.Response.Redirect(_linkGenerator.GetBackOfficeUrl(), false);
|
||||
context.Response.Redirect(_linkGenerator.GetBackOfficeUrl(_hostingEnvironment), false);
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Umbraco.Composing;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models.Membership;
|
||||
using Umbraco.Web.Security;
|
||||
@@ -11,46 +12,46 @@ namespace Umbraco.Web.Common.Security
|
||||
|
||||
public class WebSecurity : IWebSecurity
|
||||
{
|
||||
public IUser CurrentUser => throw new NotImplementedException();
|
||||
public IUser CurrentUser => new User(Current.Configs.Global());
|
||||
|
||||
public ValidateRequestAttempt AuthorizeRequest(bool throwExceptions = false)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
return ValidateRequestAttempt.Success;
|
||||
}
|
||||
|
||||
public void ClearCurrentLogin()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
//throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Attempt<int> GetUserId()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
return Attempt.Succeed(-1);
|
||||
}
|
||||
|
||||
public bool IsAuthenticated()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
return true;
|
||||
}
|
||||
|
||||
public double PerformLogin(int userId)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
return 100;
|
||||
}
|
||||
|
||||
public bool UserHasSectionAccess(string section, IUser user)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool ValidateCurrentUser()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
return true;
|
||||
}
|
||||
|
||||
public ValidateRequestAttempt ValidateCurrentUser(bool throwExceptions, bool requiresApproval = true)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
return ValidateRequestAttempt.Success;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user