Content picker search with start node configured not taking user start nodes into account (#19871)

* Content picker search with start node configured not taking user start nodes into account (#19800)

* Fix users being able to see nodes they don't have access to when using the picker search

* Readability and naming improvements

* Additional fixes

* Adjust tests

* Additional fixes

* Small improvement

* Replaced the root ids with constants

* Update src/Umbraco.Web.BackOffice/Trees/MemberTreeController.cs

Co-authored-by: Andy Butland <abutland73@gmail.com>

---------

Co-authored-by: Andy Butland <abutland73@gmail.com>
# Conflicts:
#	src/Umbraco.Examine.Lucene/BackOfficeExamineSearcher.cs
#	src/Umbraco.Web.BackOffice/Trees/ContentTreeController.cs
#	src/Umbraco.Web.BackOffice/Trees/MediaTreeController.cs
#	src/Umbraco.Web.BackOffice/Trees/MemberTreeController.cs
#	tests/Umbraco.Tests.Integration/Umbraco.Examine.Lucene/UmbracoExamine/BackOfficeExamineSearcherTests.cs

* Add new constructor without unused and obsolete parameters

* Use non obsolete constructor in tests

* Add `dataTypeId` as parameter in document and media search endpoints to get `ignoreUserStartNodes` value

* Update backend API generated typed client

* Updated picker search to pass in data type unique

* Move data type retrieval to UmbPickerContext

* Adjust the controller constructors to make it non breaking

* Adjust controller methods to make non-breaking.

---------

Co-authored-by: Andy Butland <abutland73@gmail.com>
This commit is contained in:
Laura Neto
2025-08-11 15:15:24 +02:00
committed by GitHub
parent 2289493384
commit 417576b275
17 changed files with 362 additions and 97 deletions

View File

@@ -71,16 +71,17 @@ internal sealed class BackOfficeExamineSearcherTests : ExamineBaseTest
builder.Services.AddHostedService<QueuedHostedService>();
}
private IEnumerable<ISearchResult> BackOfficeExamineSearch(string query, int pageSize = 20, int pageIndex = 0) =>
private IEnumerable<ISearchResult> BackOfficeExamineSearch(string query, int pageSize = 20, int pageIndex = 0, bool ignoreUserStartNodes = false) =>
BackOfficeExamineSearcher.Search(
query,
UmbracoEntityTypes.Document,
pageSize,
pageIndex,
out _,
null,
null,
ignoreUserStartNodes: true);
totalFound: out _,
contentTypeAliases: null,
trashed: null,
searchFrom: null,
ignoreUserStartNodes: ignoreUserStartNodes);
private async Task SetupUserIdentity(string userId)
{