Fix BackOfficeServerVariables
This commit is contained in:
@@ -210,7 +210,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
},
|
||||
{
|
||||
"iconApiBaseUrl", _linkGenerator.GetUmbracoApiServiceBaseUrl<IconController>(
|
||||
controller => controller.GetIcon("")!)
|
||||
controller => controller.GetIcon(string.Empty))
|
||||
},
|
||||
{
|
||||
"imagesApiBaseUrl", _linkGenerator.GetUmbracoApiServiceBaseUrl<ImagesController>(
|
||||
@@ -266,7 +266,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
},
|
||||
{
|
||||
"memberApiBaseUrl", _linkGenerator.GetUmbracoApiServiceBaseUrl<MemberController>(
|
||||
controller => controller.GetByKey(Guid.Empty)!)
|
||||
controller => controller.GetByKey(Guid.Empty))
|
||||
},
|
||||
{
|
||||
"packageApiBaseUrl", _linkGenerator.GetUmbracoApiServiceBaseUrl<PackageController>(
|
||||
@@ -274,7 +274,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
},
|
||||
{
|
||||
"relationApiBaseUrl", _linkGenerator.GetUmbracoApiServiceBaseUrl<RelationController>(
|
||||
controller => controller.GetById(0)!)
|
||||
controller => controller.GetById(0))
|
||||
},
|
||||
{
|
||||
"rteApiBaseUrl", _linkGenerator.GetUmbracoApiServiceBaseUrl<RichTextPreValueController>(
|
||||
@@ -358,7 +358,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
},
|
||||
{
|
||||
"languageApiBaseUrl", _linkGenerator.GetUmbracoApiServiceBaseUrl<LanguageController>(
|
||||
controller => controller.GetAllLanguages()!)
|
||||
controller => controller.GetAllLanguages())
|
||||
},
|
||||
{
|
||||
"relationTypeApiBaseUrl", _linkGenerator.GetUmbracoApiServiceBaseUrl<RelationTypeController>(
|
||||
@@ -378,7 +378,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
},
|
||||
{
|
||||
"imageUrlGeneratorApiBaseUrl", _linkGenerator.GetUmbracoApiServiceBaseUrl<ImageUrlGeneratorController>(
|
||||
controller => controller.GetCropUrl(string.Empty, null, null, null)!)
|
||||
controller => controller.GetCropUrl(string.Empty, null, null, null))
|
||||
},
|
||||
{
|
||||
"elementTypeApiBaseUrl", _linkGenerator.GetUmbracoApiServiceBaseUrl<ElementTypeController>(
|
||||
|
||||
@@ -80,8 +80,13 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
// TODO(V10) : change return type to Task<ActionResult<JObject>> and consider removing baseUrl as parameter
|
||||
//we have baseurl as a param to make previewing easier, so we can test with a dev domain from client side
|
||||
[ValidateAngularAntiForgeryToken]
|
||||
public async Task<JObject> GetRemoteDashboardContent(string section, string baseUrl = "https://dashboard.umbraco.com/")
|
||||
public async Task<JObject> GetRemoteDashboardContent(string section, string? baseUrl)
|
||||
{
|
||||
if (baseUrl is null)
|
||||
{
|
||||
baseUrl = "https://dashboard.umbraco.com/";
|
||||
}
|
||||
|
||||
var user = _backOfficeSecurityAccessor.BackOfficeSecurity?.CurrentUser;
|
||||
var allowedSections = string.Join(",", user?.AllowedSections ?? Array.Empty<string>());
|
||||
var language = user?.Language;
|
||||
@@ -141,8 +146,13 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
}
|
||||
|
||||
// TODO(V10) : consider removing baseUrl as parameter
|
||||
public async Task<IActionResult> GetRemoteDashboardCss(string section, string baseUrl = "https://dashboard.umbraco.org/")
|
||||
public async Task<IActionResult> GetRemoteDashboardCss(string section, string? baseUrl)
|
||||
{
|
||||
if (baseUrl is null)
|
||||
{
|
||||
baseUrl = "https://dashboard.umbraco.org/";
|
||||
}
|
||||
|
||||
if (!IsAllowedUrl(baseUrl))
|
||||
{
|
||||
_logger.LogError($"The following URL is not listed in the setting 'Umbraco:CMS:ContentDashboard:ContentDashboardUrlAllowlist' in configuration: {baseUrl}");
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace Umbraco.Extensions
|
||||
public static string? GetUmbracoApiService<T>(this LinkGenerator linkGenerator, string actionName, IDictionary<string, object?>? values)
|
||||
where T : UmbracoApiControllerBase => linkGenerator.GetUmbracoControllerUrl(actionName, typeof(T), values);
|
||||
|
||||
public static string? GetUmbracoApiServiceBaseUrl<T>(this LinkGenerator linkGenerator, Expression<Func<T, object>> methodSelector)
|
||||
public static string? GetUmbracoApiServiceBaseUrl<T>(this LinkGenerator linkGenerator, Expression<Func<T, object?>> methodSelector)
|
||||
where T : UmbracoApiControllerBase
|
||||
{
|
||||
var method = ExpressionHelper.GetMethodInfo(methodSelector);
|
||||
|
||||
Reference in New Issue
Block a user