* Filter out disallowed content types from the delivery api content index * Added . * Allow children of disallowed content types in the index --------- Co-authored-by: Elitsa <elm@umbraco.dk>
20 lines
910 B
C#
20 lines
910 B
C#
using Umbraco.Cms.Core.Configuration.Models;
|
|
using Umbraco.Cms.Core.Models.PublishedContent;
|
|
|
|
namespace Umbraco.Extensions;
|
|
|
|
public static class DeliveryApiSettingsExtensions
|
|
{
|
|
public static bool IsAllowedContentType(this DeliveryApiSettings settings, IPublishedContent content)
|
|
=> settings.IsAllowedContentType(content.ContentType.Alias);
|
|
|
|
public static bool IsDisallowedContentType(this DeliveryApiSettings settings, IPublishedContent content)
|
|
=> settings.IsDisallowedContentType(content.ContentType.Alias);
|
|
|
|
public static bool IsAllowedContentType(this DeliveryApiSettings settings, string contentTypeAlias)
|
|
=> settings.IsDisallowedContentType(contentTypeAlias) is false;
|
|
|
|
public static bool IsDisallowedContentType(this DeliveryApiSettings settings, string contentTypeAlias)
|
|
=> settings.DisallowedContentTypeAliases.InvariantContains(contentTypeAlias);
|
|
}
|