Skip to content

Commit f8ec2da

Browse files
committed
Merge branch 'main' into v17/dev
# Conflicts: # src/Umbraco.Web.UI.Client/package-lock.json # src/Umbraco.Web.UI.Client/package.json # version.json
2 parents e57f665 + 7c3f4f9 commit f8ec2da

File tree

188 files changed

+3678
-3130
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

188 files changed

+3678
-3130
lines changed

src/Umbraco.Cms.Api.Management/Controllers/Document/Item/SearchDocumentItemController.cs

Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
using Asp.Versioning;
22
using Microsoft.AspNetCore.Http;
33
using Microsoft.AspNetCore.Mvc;
4+
using Microsoft.Extensions.DependencyInjection;
45
using Umbraco.Cms.Api.Management.Factories;
56
using Umbraco.Cms.Api.Management.ViewModels.Document.Item;
7+
using Umbraco.Cms.Core.DependencyInjection;
68
using Umbraco.Cms.Core.Models;
79
using Umbraco.Cms.Core.Models.Entities;
810
using Umbraco.Cms.Core.Services;
11+
using Umbraco.Extensions;
912

1013
namespace Umbraco.Cms.Api.Management.Controllers.Document.Item;
1114

@@ -14,13 +17,52 @@ public class SearchDocumentItemController : DocumentItemControllerBase
1417
{
1518
private readonly IIndexedEntitySearchService _indexedEntitySearchService;
1619
private readonly IDocumentPresentationFactory _documentPresentationFactory;
20+
private readonly IDataTypeService _dataTypeService;
1721

18-
public SearchDocumentItemController(IIndexedEntitySearchService indexedEntitySearchService, IDocumentPresentationFactory documentPresentationFactory)
22+
[ActivatorUtilitiesConstructor]
23+
public SearchDocumentItemController(
24+
IIndexedEntitySearchService indexedEntitySearchService,
25+
IDocumentPresentationFactory documentPresentationFactory,
26+
IDataTypeService dataTypeService)
1927
{
2028
_indexedEntitySearchService = indexedEntitySearchService;
2129
_documentPresentationFactory = documentPresentationFactory;
30+
_dataTypeService = dataTypeService;
2231
}
2332

33+
[Obsolete("Use the non-obsolete constructor instead, will be removed in v18")]
34+
public SearchDocumentItemController(
35+
IIndexedEntitySearchService indexedEntitySearchService,
36+
IDocumentPresentationFactory documentPresentationFactory)
37+
: this(
38+
indexedEntitySearchService,
39+
documentPresentationFactory,
40+
StaticServiceProvider.Instance.GetRequiredService<IDataTypeService>())
41+
{
42+
}
43+
44+
[Obsolete("Please use the overload taking all parameters. Scheduled for removal in Umbraco 18.")]
45+
[ApiExplorerSettings(IgnoreApi = true)]
46+
public async Task<IActionResult> SearchWithTrashed(
47+
CancellationToken cancellationToken,
48+
string query,
49+
bool? trashed = null,
50+
string? culture = null,
51+
int skip = 0,
52+
int take = 100,
53+
Guid? parentId = null,
54+
[FromQuery] IEnumerable<Guid>? allowedDocumentTypes = null)
55+
=> await SearchWithTrashed(
56+
cancellationToken,
57+
query,
58+
trashed,
59+
culture,
60+
skip,
61+
take,
62+
parentId,
63+
allowedDocumentTypes,
64+
null);
65+
2466
[HttpGet("search")]
2567
[MapToApiVersion("1.0")]
2668
[ProducesResponseType(typeof(PagedModel<DocumentItemResponseModel>), StatusCodes.Status200OK)]
@@ -32,9 +74,21 @@ public async Task<IActionResult> SearchWithTrashed(
3274
int skip = 0,
3375
int take = 100,
3476
Guid? parentId = null,
35-
[FromQuery] IEnumerable<Guid>? allowedDocumentTypes = null)
77+
[FromQuery] IEnumerable<Guid>? allowedDocumentTypes = null,
78+
Guid? dataTypeId = null)
3679
{
37-
PagedModel<IEntitySlim> searchResult = await _indexedEntitySearchService.SearchAsync(UmbracoObjectTypes.Document, query, parentId, allowedDocumentTypes, trashed, culture, skip, take);
80+
var ignoreUserStartNodes = await IgnoreUserStartNodes(dataTypeId);
81+
PagedModel<IEntitySlim> searchResult = await _indexedEntitySearchService.SearchAsync(
82+
UmbracoObjectTypes.Document,
83+
query,
84+
parentId,
85+
allowedDocumentTypes,
86+
trashed,
87+
culture,
88+
skip,
89+
take,
90+
ignoreUserStartNodes);
91+
3892
var result = new PagedModel<DocumentItemResponseModel>
3993
{
4094
Items = searchResult.Items.OfType<IDocumentEntitySlim>().Select(_documentPresentationFactory.CreateItemResponseModel),
@@ -43,4 +97,7 @@ public async Task<IActionResult> SearchWithTrashed(
4397

4498
return Ok(result);
4599
}
100+
101+
private async Task<bool> IgnoreUserStartNodes(Guid? dataTypeKey) =>
102+
dataTypeKey is not null && await _dataTypeService.IsDataTypeIgnoringUserStartNodesAsync(dataTypeKey.Value);
46103
}

src/Umbraco.Cms.Api.Management/Controllers/Document/Tree/ChildrenDocumentTreeController.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@ public ChildrenDocumentTreeController(
3636
[HttpGet("children")]
3737
[MapToApiVersion("1.0")]
3838
[ProducesResponseType(typeof(PagedViewModel<DocumentTreeItemResponseModel>), StatusCodes.Status200OK)]
39-
public async Task<ActionResult<PagedViewModel<DocumentTreeItemResponseModel>>> Children(CancellationToken cancellationToken, Guid parentId, int skip = 0, int take = 100, Guid? dataTypeId = null)
39+
public async Task<ActionResult<PagedViewModel<DocumentTreeItemResponseModel>>> Children(
40+
CancellationToken cancellationToken,
41+
Guid parentId,
42+
int skip = 0,
43+
int take = 100,
44+
Guid? dataTypeId = null)
4045
{
4146
IgnoreUserStartNodesForDataType(dataTypeId);
4247
return await GetChildren(parentId, skip, take);

src/Umbraco.Cms.Api.Management/Controllers/Media/Item/SearchMediaItemController.cs

Lines changed: 59 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
using Asp.Versioning;
22
using Microsoft.AspNetCore.Http;
33
using Microsoft.AspNetCore.Mvc;
4+
using Microsoft.Extensions.DependencyInjection;
45
using Umbraco.Cms.Api.Management.Factories;
56
using Umbraco.Cms.Api.Management.ViewModels.Media.Item;
7+
using Umbraco.Cms.Core.DependencyInjection;
68
using Umbraco.Cms.Core.Models;
79
using Umbraco.Cms.Core.Models.Entities;
810
using Umbraco.Cms.Core.Services;
11+
using Umbraco.Extensions;
912

1013
namespace Umbraco.Cms.Api.Management.Controllers.Media.Item;
1114

@@ -14,13 +17,52 @@ public class SearchMediaItemController : MediaItemControllerBase
1417
{
1518
private readonly IIndexedEntitySearchService _indexedEntitySearchService;
1619
private readonly IMediaPresentationFactory _mediaPresentationFactory;
20+
private readonly IDataTypeService _dataTypeService;
1721

18-
public SearchMediaItemController(IIndexedEntitySearchService indexedEntitySearchService, IMediaPresentationFactory mediaPresentationFactory)
22+
[ActivatorUtilitiesConstructor]
23+
public SearchMediaItemController(
24+
IIndexedEntitySearchService indexedEntitySearchService,
25+
IMediaPresentationFactory mediaPresentationFactory,
26+
IDataTypeService dataTypeService)
1927
{
2028
_indexedEntitySearchService = indexedEntitySearchService;
2129
_mediaPresentationFactory = mediaPresentationFactory;
30+
_dataTypeService = dataTypeService;
2231
}
2332

33+
[Obsolete("Use the non-obsolete constructor instead, will be removed in Umbraco 18.")]
34+
public SearchMediaItemController(
35+
IIndexedEntitySearchService indexedEntitySearchService,
36+
IMediaPresentationFactory mediaPresentationFactory)
37+
: this(
38+
indexedEntitySearchService,
39+
mediaPresentationFactory,
40+
StaticServiceProvider.Instance.GetRequiredService<IDataTypeService>())
41+
{
42+
}
43+
44+
[Obsolete("Please use the overload taking all parameters. Scheduled for removal in Umbraco 18.")]
45+
[ApiExplorerSettings(IgnoreApi = true)]
46+
public async Task<IActionResult> SearchFromParentWithAllowedTypes(
47+
CancellationToken cancellationToken,
48+
string query,
49+
bool? trashed = null,
50+
string? culture = null,
51+
int skip = 0,
52+
int take = 100,
53+
Guid? parentId = null,
54+
[FromQuery] IEnumerable<Guid>? allowedMediaTypes = null)
55+
=> await SearchFromParentWithAllowedTypes(
56+
cancellationToken,
57+
query,
58+
trashed,
59+
culture,
60+
skip,
61+
take,
62+
parentId,
63+
allowedMediaTypes,
64+
null);
65+
2466
[HttpGet("search")]
2567
[MapToApiVersion("1.0")]
2668
[ProducesResponseType(typeof(PagedModel<MediaItemResponseModel>), StatusCodes.Status200OK)]
@@ -32,9 +74,20 @@ public async Task<IActionResult> SearchFromParentWithAllowedTypes(
3274
int skip = 0,
3375
int take = 100,
3476
Guid? parentId = null,
35-
[FromQuery]IEnumerable<Guid>? allowedMediaTypes = null)
77+
[FromQuery] IEnumerable<Guid>? allowedMediaTypes = null,
78+
Guid? dataTypeId = null)
3679
{
37-
PagedModel<IEntitySlim> searchResult = await _indexedEntitySearchService.SearchAsync(UmbracoObjectTypes.Media, query, parentId, allowedMediaTypes, trashed, culture, skip, take);
80+
var ignoreUserStartNodes = await IgnoreUserStartNodes(dataTypeId);
81+
PagedModel<IEntitySlim> searchResult = await _indexedEntitySearchService.SearchAsync(
82+
UmbracoObjectTypes.Media,
83+
query,
84+
parentId,
85+
allowedMediaTypes,
86+
trashed,
87+
culture,
88+
skip,
89+
take,
90+
ignoreUserStartNodes);
3891
var result = new PagedModel<MediaItemResponseModel>
3992
{
4093
Items = searchResult.Items.OfType<IMediaEntitySlim>().Select(_mediaPresentationFactory.CreateItemResponseModel),
@@ -43,4 +96,7 @@ public async Task<IActionResult> SearchFromParentWithAllowedTypes(
4396

4497
return Ok(result);
4598
}
99+
100+
private async Task<bool> IgnoreUserStartNodes(Guid? dataTypeKey) =>
101+
dataTypeKey is not null && await _dataTypeService.IsDataTypeIgnoringUserStartNodesAsync(dataTypeKey.Value);
46102
}

src/Umbraco.Cms.Api.Management/OpenApi.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10385,6 +10385,14 @@
1038510385
"format": "uuid"
1038610386
}
1038710387
}
10388+
},
10389+
{
10390+
"name": "dataTypeId",
10391+
"in": "query",
10392+
"schema": {
10393+
"type": "string",
10394+
"format": "uuid"
10395+
}
1038810396
}
1038910397
],
1039010398
"responses": {
@@ -16281,6 +16289,14 @@
1628116289
"format": "uuid"
1628216290
}
1628316291
}
16292+
},
16293+
{
16294+
"name": "dataTypeId",
16295+
"in": "query",
16296+
"schema": {
16297+
"type": "string",
16298+
"format": "uuid"
16299+
}
1628416300
}
1628516301
],
1628616302
"responses": {

src/Umbraco.Core/Configuration/Models/WebRoutingSettings.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public class WebRoutingSettings
2121
internal const bool StaticDisableFindContentByIdentifierPath = false;
2222
internal const bool StaticDisableRedirectUrlTracking = false;
2323
internal const string StaticUrlProviderMode = "Auto";
24+
internal const bool StaticUseStrictDomainMatching = false;
2425

2526
/// <summary>
2627
/// Gets or sets a value indicating whether to check if any routed endpoints match a front-end request before
@@ -60,8 +61,12 @@ public class WebRoutingSettings
6061
[DefaultValue(StaticValidateAlternativeTemplates)]
6162
public bool ValidateAlternativeTemplates { get; set; } = StaticValidateAlternativeTemplates;
6263

64+
/// <summary>
65+
/// Gets or sets a value indicating whether the content finder by a path of the content key (<see cref="Routing.ContentFinderByKeyPath" />) is disabled.
66+
/// </summary>
6367
[DefaultValue(StaticDisableFindContentByIdentifierPath)]
6468
public bool DisableFindContentByIdentifierPath { get; set; } = StaticDisableFindContentByIdentifierPath;
69+
6570
/// <summary>
6671
/// Gets or sets a value indicating whether redirect URL tracking is disabled.
6772
/// </summary>
@@ -78,4 +83,15 @@ public class WebRoutingSettings
7883
/// Gets or sets a value for the Umbraco application URL.
7984
/// </summary>
8085
public string UmbracoApplicationUrl { get; set; } = null!;
86+
87+
/// <summary>
88+
/// Gets or sets a value indicating whether strict domain matching is used when finding content to match the request.
89+
/// </summary>
90+
/// <remarks>
91+
/// <para>This setting is used within Umbraco's routing process based on content finders, specifically <see cref="Routing.ContentFinderByUrlNew" />.</para>
92+
/// <para>If set to the default value of <see langword="false"/>, requests that don't match a configured domain will be routed to the first root node.</para>
93+
/// <para>If set to <see langword="true"/>, requests that don't match a configured domain will not be routed.</para>
94+
/// </remarks>
95+
[DefaultValue(StaticUseStrictDomainMatching)]
96+
public bool UseStrictDomainMatching { get; set; } = StaticUseStrictDomainMatching;
8197
}

src/Umbraco.Core/Models/CacheSettings.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,39 @@ public class CacheSettings
88
{
99
internal const int StaticDocumentBreadthFirstSeedCount = 100;
1010
internal const int StaticMediaBreadthFirstSeedCount = 100;
11+
internal const int StaticDocumentSeedBatchSize = 100;
12+
internal const int StaticMediaSeedBatchSize = 100;
1113

1214
/// <summary>
13-
/// Gets or sets a value for the collection of content type ids to always have in the cache.
15+
/// Gets or sets a value for the collection of content type ids to always have in the cache.
1416
/// </summary>
1517
public List<Guid> ContentTypeKeys { get; set; } =
1618
new();
1719

20+
/// <summary>
21+
/// Gets or sets a value for the document breadth first seed count.
22+
/// </summary>
1823
[DefaultValue(StaticDocumentBreadthFirstSeedCount)]
1924
public int DocumentBreadthFirstSeedCount { get; set; } = StaticDocumentBreadthFirstSeedCount;
2025

26+
/// <summary>
27+
/// Gets or sets a value for the media breadth first seed count.
28+
/// </summary>
2129
[DefaultValue(StaticMediaBreadthFirstSeedCount)]
2230
public int MediaBreadthFirstSeedCount { get; set; } = StaticDocumentBreadthFirstSeedCount;
2331

32+
/// <summary>
33+
/// Gets or sets a value for the document seed batch size.
34+
/// </summary>
35+
[DefaultValue(StaticDocumentSeedBatchSize)]
36+
public int DocumentSeedBatchSize { get; set; } = StaticDocumentSeedBatchSize;
37+
38+
/// <summary>
39+
/// Gets or sets a value for the media seed batch size.
40+
/// </summary>
41+
[DefaultValue(StaticMediaSeedBatchSize)]
42+
public int MediaSeedBatchSize { get; set; } = StaticMediaSeedBatchSize;
43+
2444
public CacheEntry Entry { get; set; } = new CacheEntry();
2545

2646
public class CacheEntry

0 commit comments

Comments
 (0)