@@ -1,31 +0,0 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Umbraco.Cms.Core.Configuration.Models;
|
||||
using Umbraco.Cms.Core.Security;
|
||||
using Umbraco.Cms.ManagementApi.ViewModels.RedirectManagement;
|
||||
using Umbraco.Extensions;
|
||||
|
||||
namespace Umbraco.Cms.ManagementApi.Controllers.RedirectManagement;
|
||||
|
||||
|
||||
public class GetEnabledController : RedirectManagementBaseController
|
||||
{
|
||||
private readonly IOptionsMonitor<WebRoutingSettings> _webRoutingSettings;
|
||||
private readonly IBackOfficeSecurityAccessor _backOfficeSecurityAccessor;
|
||||
|
||||
public GetEnabledController(
|
||||
IOptionsMonitor<WebRoutingSettings> webRoutingSettings,
|
||||
IBackOfficeSecurityAccessor backOfficeSecurityAccessor)
|
||||
{
|
||||
_webRoutingSettings = webRoutingSettings;
|
||||
_backOfficeSecurityAccessor = backOfficeSecurityAccessor;
|
||||
}
|
||||
|
||||
[HttpGet("status")]
|
||||
public Task<ActionResult<RedirectStatusViewModel>> GetStatus() =>
|
||||
Task.FromResult<ActionResult<RedirectStatusViewModel>>(new RedirectStatusViewModel
|
||||
{
|
||||
Enabled = _webRoutingSettings.CurrentValue.DisableRedirectUrlTracking is false,
|
||||
UserIsAdmin = _backOfficeSecurityAccessor.BackOfficeSecurity?.CurrentUser?.IsAdmin() ?? false
|
||||
});
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.New.Cms.Web.Common.Routing;
|
||||
|
||||
namespace Umbraco.Cms.ManagementApi.Controllers.RedirectManagement;
|
||||
|
||||
[ApiController]
|
||||
[VersionedApiBackOfficeRoute("redirect-management")]
|
||||
[ApiExplorerSettings(GroupName = "Redirect Management")]
|
||||
[ApiVersion("1.0")]
|
||||
public class RedirectManagementBaseController
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
namespace Umbraco.Cms.ManagementApi.ViewModels.RedirectManagement;
|
||||
|
||||
public class RedirectStatusViewModel
|
||||
{
|
||||
public bool Enabled { get; set; }
|
||||
|
||||
public bool UserIsAdmin { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user