From 7c33afa3a95c173a3b3802c13a397e17a46509e0 Mon Sep 17 00:00:00 2001 From: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com> Date: Fri, 1 Mar 2024 14:18:22 +0100 Subject: [PATCH] enable start node calculation (#15813) --- .../Tree/DocumentTreeControllerBase.cs | 30 ++++++++----------- .../Media/Tree/MediaTreeControllerBase.cs | 30 ++++++++----------- 2 files changed, 24 insertions(+), 36 deletions(-) diff --git a/src/Umbraco.Cms.Api.Management/Controllers/Document/Tree/DocumentTreeControllerBase.cs b/src/Umbraco.Cms.Api.Management/Controllers/Document/Tree/DocumentTreeControllerBase.cs index 9aa4bd48aa..930cd66828 100644 --- a/src/Umbraco.Cms.Api.Management/Controllers/Document/Tree/DocumentTreeControllerBase.cs +++ b/src/Umbraco.Cms.Api.Management/Controllers/Document/Tree/DocumentTreeControllerBase.cs @@ -63,23 +63,17 @@ public abstract class DocumentTreeControllerBase : UserStartNodeTreeControllerBa return responseModel; } - // TODO: delete these (faking start node setup for unlimited editor) - protected override int[] GetUserStartNodeIds() => new[] { -1 }; + protected override int[] GetUserStartNodeIds() + => _backofficeSecurityAccessor + .BackOfficeSecurity? + .CurrentUser? + .CalculateContentStartNodeIds(EntityService, _appCaches) + ?? Array.Empty(); - protected override string[] GetUserStartNodePaths() => Array.Empty(); - - // TODO: use these implementations instead of the dummy ones above once we have backoffice auth in place - // protected override int[] GetUserStartNodeIds() - // => _backofficeSecurityAccessor - // .BackOfficeSecurity? - // .CurrentUser? - // .CalculateContentStartNodeIds(EntityService, _appCaches) - // ?? Array.Empty(); - // - // protected override string[] GetUserStartNodePaths() - // => _backofficeSecurityAccessor - // .BackOfficeSecurity? - // .CurrentUser? - // .GetContentStartNodePaths(EntityService, _appCaches) - // ?? Array.Empty(); + protected override string[] GetUserStartNodePaths() + => _backofficeSecurityAccessor + .BackOfficeSecurity? + .CurrentUser? + .GetContentStartNodePaths(EntityService, _appCaches) + ?? Array.Empty(); } diff --git a/src/Umbraco.Cms.Api.Management/Controllers/Media/Tree/MediaTreeControllerBase.cs b/src/Umbraco.Cms.Api.Management/Controllers/Media/Tree/MediaTreeControllerBase.cs index 3d1799468e..83e04ae971 100644 --- a/src/Umbraco.Cms.Api.Management/Controllers/Media/Tree/MediaTreeControllerBase.cs +++ b/src/Umbraco.Cms.Api.Management/Controllers/Media/Tree/MediaTreeControllerBase.cs @@ -59,23 +59,17 @@ public class MediaTreeControllerBase : UserStartNodeTreeControllerBase new[] { -1 }; + protected override int[] GetUserStartNodeIds() + => _backofficeSecurityAccessor + .BackOfficeSecurity? + .CurrentUser? + .CalculateMediaStartNodeIds(EntityService, _appCaches) + ?? Array.Empty(); - protected override string[] GetUserStartNodePaths() => Array.Empty(); - - // TODO: use these implementations instead of the dummy ones above once we have backoffice auth in place - // protected override int[] GetUserStartNodeIds() - // => _backofficeSecurityAccessor - // .BackOfficeSecurity? - // .CurrentUser? - // .CalculateMediaStartNodeIds(EntityService, _appCaches) - // ?? Array.Empty(); - // - // protected override string[] GetUserStartNodePaths() - // => _backofficeSecurityAccessor - // .BackOfficeSecurity? - // .CurrentUser? - // .GetMediaStartNodePaths(EntityService, _appCaches) - // ?? Array.Empty(); + protected override string[] GetUserStartNodePaths() + => _backofficeSecurityAccessor + .BackOfficeSecurity? + .CurrentUser? + .GetMediaStartNodePaths(EntityService, _appCaches) + ?? Array.Empty(); }