Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
using Asp.Versioning;
using Asp.Versioning;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Umbraco.Cms.Api.Management.Services.FileSystem;
using Umbraco.Cms.Api.Management.ViewModels.Tree;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Core.IO;
using Umbraco.Cms.Core.Services;

namespace Umbraco.Cms.Api.Management.Controllers.PartialView.Tree;

[ApiVersion("1.0")]
public class AncestorsPartialViewTreeController : PartialViewTreeControllerBase
{
private readonly IPartialViewTreeService _partialViewTreeService;

// TODO Remove the static service provider, and replace with base when the other constructors are obsoleted.
[ActivatorUtilitiesConstructor]
public AncestorsPartialViewTreeController(IPartialViewTreeService partialViewTreeService)
: this(partialViewTreeService, StaticServiceProvider.Instance.GetRequiredService<FileSystems>())
=> _partialViewTreeService = partialViewTreeService;
: base(partialViewTreeService)
{
}

[ActivatorUtilitiesConstructor]
[Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 19")]
[Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")]
public AncestorsPartialViewTreeController(IPartialViewTreeService partialViewTreeService, FileSystems fileSystems)
: base(partialViewTreeService, fileSystems) =>
_partialViewTreeService = partialViewTreeService;
: base(partialViewTreeService, fileSystems)
{
}

[Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 19")]
[Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")]
public AncestorsPartialViewTreeController(FileSystems fileSystems)
: this(StaticServiceProvider.Instance.GetRequiredService<IPartialViewTreeService>(), fileSystems)
: base(fileSystems)
{
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,33 @@
using Asp.Versioning;
using Asp.Versioning;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Umbraco.Cms.Core.IO;
using Umbraco.Cms.Api.Common.ViewModels.Pagination;
using Umbraco.Cms.Api.Management.Services.FileSystem;
using Umbraco.Cms.Api.Management.ViewModels.Tree;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Core.IO;

namespace Umbraco.Cms.Api.Management.Controllers.PartialView.Tree;

[ApiVersion("1.0")]
public class ChildrenPartialViewTreeController : PartialViewTreeControllerBase
{
private readonly IPartialViewTreeService _partialViewTreeService;

// TODO Remove the static service provider, and replace with base when the other constructors are obsoleted.
[ActivatorUtilitiesConstructor]
public ChildrenPartialViewTreeController(IPartialViewTreeService partialViewTreeService)
: this(partialViewTreeService, StaticServiceProvider.Instance.GetRequiredService<FileSystems>())
=> _partialViewTreeService = partialViewTreeService;
: base(partialViewTreeService)
{
}

[ActivatorUtilitiesConstructor]
[Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 19")]
[Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")]
public ChildrenPartialViewTreeController(IPartialViewTreeService partialViewTreeService, FileSystems fileSystems)
: base(partialViewTreeService, fileSystems) =>
_partialViewTreeService = partialViewTreeService;
: base(partialViewTreeService, fileSystems)
{
}

[Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 19")]
[Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")]
public ChildrenPartialViewTreeController(FileSystems fileSystems)
: this(StaticServiceProvider.Instance.GetRequiredService<IPartialViewTreeService>(), fileSystems)
: base(fileSystems)
{
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Umbraco.Cms.Api.Management.Controllers.Tree;
using Umbraco.Cms.Api.Management.Routing;
using Umbraco.Cms.Api.Management.Services.FileSystem;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Core.IO;
using Umbraco.Cms.Web.Common.Authorization;

Expand All @@ -16,30 +14,28 @@ namespace Umbraco.Cms.Api.Management.Controllers.PartialView.Tree;
[Authorize(Policy = AuthorizationPolicies.TreeAccessPartialViews)]
public class PartialViewTreeControllerBase : FileSystemTreeControllerBase
{
private readonly IPartialViewTreeService _partialViewTreeService;

// TODO Remove the static service provider, and replace with base when the other constructors are obsoleted.
public PartialViewTreeControllerBase(IPartialViewTreeService partialViewTreeService)
: this(partialViewTreeService, StaticServiceProvider.Instance.GetRequiredService<FileSystems>()) =>
_partialViewTreeService = partialViewTreeService;
: base(partialViewTreeService)
{
FileSystem = null!;
}

// FileSystem is required therefore, we can't remove it without some wizadry. When obsoletion is due, remove this.
[ActivatorUtilitiesConstructor]
[Obsolete("Scheduled for removal in Umbraco 18.")]
// FileSystem is required therefore, we can't remove it without some wizardry. When obsoletion is due, remove this.
[Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")]
public PartialViewTreeControllerBase(IPartialViewTreeService partialViewTreeService, FileSystems fileSystems)
: base(partialViewTreeService)
{
_partialViewTreeService = partialViewTreeService;
FileSystem = fileSystems.PartialViewsFileSystem ??
throw new ArgumentException("Missing scripts file system", nameof(fileSystems));
}

[Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 18.")]
[Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")]
public PartialViewTreeControllerBase(FileSystems fileSystems)
: this(StaticServiceProvider.Instance.GetRequiredService<IPartialViewTreeService>())
: base()
=> FileSystem = fileSystems.PartialViewsFileSystem ??
throw new ArgumentException("Missing scripts file system", nameof(fileSystems));

[Obsolete("Included in the service class. Scheduled to be removed in Umbraco 18.")]
[Obsolete("Included in the service class. Scheduled to be removed in Umbraco 19.")]
protected override IFileSystem FileSystem { get; }
}
Original file line number Diff line number Diff line change
@@ -1,34 +1,33 @@
using Asp.Versioning;
using Asp.Versioning;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Umbraco.Cms.Core.IO;
using Umbraco.Cms.Api.Common.ViewModels.Pagination;
using Umbraco.Cms.Api.Management.Services.FileSystem;
using Umbraco.Cms.Api.Management.ViewModels.Tree;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Core.IO;

namespace Umbraco.Cms.Api.Management.Controllers.PartialView.Tree;

[ApiVersion("1.0")]
public class RootPartialViewTreeController : PartialViewTreeControllerBase
{
private readonly IPartialViewTreeService _partialViewTreeService;

// TODO Remove the static service provider, and replace with base when the other constructors are obsoleted.
[ActivatorUtilitiesConstructor]
public RootPartialViewTreeController(IPartialViewTreeService partialViewTreeService)
: this(partialViewTreeService, StaticServiceProvider.Instance.GetRequiredService<FileSystems>())
=> _partialViewTreeService = partialViewTreeService;
: base(partialViewTreeService)
{
}

[ActivatorUtilitiesConstructor]
[Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 19")]
[Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")]
public RootPartialViewTreeController(IPartialViewTreeService partialViewTreeService, FileSystems fileSystems)
: base(partialViewTreeService, fileSystems) =>
_partialViewTreeService = partialViewTreeService;
: base(partialViewTreeService, fileSystems)
{
}

[Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 19")]
[Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")]
public RootPartialViewTreeController(FileSystems fileSystems)
: this(StaticServiceProvider.Instance.GetRequiredService<IPartialViewTreeService>(), fileSystems)
: base(fileSystems)
{
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Umbraco.Cms.Api.Common.ViewModels.Pagination;
using Umbraco.Cms.Api.Management.Services.FileSystem;
using Umbraco.Cms.Api.Management.ViewModels.Tree;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Core.IO;

namespace Umbraco.Cms.Api.Management.Controllers.PartialView.Tree;

public class SiblingsPartialViewTreeController : PartialViewTreeControllerBase
{
private readonly IPartialViewTreeService _partialViewTreeService;

// TODO Remove the static service provider, and replace with base when the other constructors are obsoleted.
[ActivatorUtilitiesConstructor]
public SiblingsPartialViewTreeController(IPartialViewTreeService partialViewTreeService)
: this(partialViewTreeService, StaticServiceProvider.Instance.GetRequiredService<FileSystems>())
=> _partialViewTreeService = partialViewTreeService;
: base(partialViewTreeService)
{
}

[ActivatorUtilitiesConstructor]
[Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 19")]
[Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")]
public SiblingsPartialViewTreeController(IPartialViewTreeService partialViewTreeService, FileSystems fileSystems)
: base(partialViewTreeService, fileSystems) =>
_partialViewTreeService = partialViewTreeService;
: base(partialViewTreeService, fileSystems)
{
}

[Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 19")]
[Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")]
public SiblingsPartialViewTreeController(FileSystems fileSystems)
: this(StaticServiceProvider.Instance.GetRequiredService<IPartialViewTreeService>(), fileSystems)
: base(fileSystems)
{
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
using Asp.Versioning;
using Asp.Versioning;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Umbraco.Cms.Api.Management.Services.FileSystem;
using Umbraco.Cms.Api.Management.ViewModels.Tree;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Core.IO;

namespace Umbraco.Cms.Api.Management.Controllers.Script.Tree;

[ApiVersion("1.0")]
public class AncestorsScriptTreeController : ScriptTreeControllerBase
{
private readonly IScriptTreeService _scriptTreeService;

// TODO Remove the static service provider, and replace with base when the other constructors are obsoleted.
[ActivatorUtilitiesConstructor]
public AncestorsScriptTreeController(IScriptTreeService scriptTreeService)
: this(scriptTreeService, StaticServiceProvider.Instance.GetRequiredService<FileSystems>())
=> _scriptTreeService = scriptTreeService;
: base(scriptTreeService)
{
}

[ActivatorUtilitiesConstructor]
[Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 19")]
[Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")]
public AncestorsScriptTreeController(IScriptTreeService scriptTreeService, FileSystems fileSystems)
: base(scriptTreeService, fileSystems) =>
_scriptTreeService = scriptTreeService;
: base(scriptTreeService, fileSystems)
{
}

[Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 19")]
[Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")]
public AncestorsScriptTreeController(FileSystems fileSystems)
: this(StaticServiceProvider.Instance.GetRequiredService<IScriptTreeService>(), fileSystems)
: base(fileSystems)
{
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,33 @@
using Asp.Versioning;
using Asp.Versioning;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Umbraco.Cms.Core.IO;
using Umbraco.Cms.Api.Common.ViewModels.Pagination;
using Umbraco.Cms.Api.Management.Services.FileSystem;
using Umbraco.Cms.Api.Management.ViewModels.Tree;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Core.IO;

namespace Umbraco.Cms.Api.Management.Controllers.Script.Tree;

[ApiVersion("1.0")]
public class ChildrenScriptTreeController : ScriptTreeControllerBase
{
private readonly IScriptTreeService _scriptTreeService;

// TODO Remove the static service provider, and replace with base when the other constructors are obsoleted.
[ActivatorUtilitiesConstructor]
public ChildrenScriptTreeController(IScriptTreeService scriptTreeService)
: this(scriptTreeService, StaticServiceProvider.Instance.GetRequiredService<FileSystems>())
=> _scriptTreeService = scriptTreeService;
: base(scriptTreeService)
{
}

[ActivatorUtilitiesConstructor]
[Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 19")]
[Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")]
public ChildrenScriptTreeController(IScriptTreeService scriptTreeService, FileSystems fileSystems)
: base(scriptTreeService, fileSystems) =>
_scriptTreeService = scriptTreeService;
: base(scriptTreeService, fileSystems)
{
}

[Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 19")]
[Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")]
public ChildrenScriptTreeController(FileSystems fileSystems)
: this(StaticServiceProvider.Instance.GetRequiredService<IScriptTreeService>(), fileSystems)
: base(fileSystems)
{
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,33 @@
using Asp.Versioning;
using Asp.Versioning;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Umbraco.Cms.Core.IO;
using Umbraco.Cms.Api.Common.ViewModels.Pagination;
using Umbraco.Cms.Api.Management.Services.FileSystem;
using Umbraco.Cms.Api.Management.ViewModels.Tree;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Core.IO;

namespace Umbraco.Cms.Api.Management.Controllers.Script.Tree;

[ApiVersion("1.0")]
public class RootScriptTreeController : ScriptTreeControllerBase
{
private readonly IScriptTreeService _scriptTreeService;

// TODO Remove the static service provider, and replace with base when the other constructors are obsoleted.
[ActivatorUtilitiesConstructor]
public RootScriptTreeController(IScriptTreeService scriptTreeService)
: this(scriptTreeService, StaticServiceProvider.Instance.GetRequiredService<FileSystems>())
=> _scriptTreeService = scriptTreeService;
: base(scriptTreeService)
{
}

[ActivatorUtilitiesConstructor]
[Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 19")]
[Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")]
public RootScriptTreeController(IScriptTreeService scriptTreeService, FileSystems fileSystems)
: base(scriptTreeService, fileSystems) =>
_scriptTreeService = scriptTreeService;
: base(scriptTreeService, fileSystems)
{
}

[Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 19")]
[Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")]
public RootScriptTreeController(FileSystems fileSystems)
: this(StaticServiceProvider.Instance.GetRequiredService<IScriptTreeService>(), fileSystems)
: base(fileSystems)
{
}

Expand Down
Loading