File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed
src/Umbraco.Cms.Api.Management Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,8 @@ public static partial class UmbracoBuilderExtensions
11
11
internal static void AddCollectionBuilders ( this IUmbracoBuilder builder )
12
12
{
13
13
builder . SignProviders ( )
14
- . Append < HasScheduleSignProvider > ( ) ;
14
+ . Append < HasScheduleSignProvider > ( )
15
+ . Append < IsProtectedSignProvider > ( ) ;
15
16
}
16
17
17
18
/// <summary>
Original file line number Diff line number Diff line change
1
+ using Umbraco . Cms . Api . Management . ViewModels . Tree ;
2
+ using Umbraco . Cms . Core . Models . Entities ;
3
+
4
+ namespace Umbraco . Cms . Api . Management . Services . Signs ;
5
+
6
+ internal class IsProtectedSignProvider : ISignProvider
7
+ {
8
+ private const string Alias = ISignProvider . Prefix + "IsProtected" ;
9
+
10
+ /// <inheritdoc/>>
11
+ public bool CanProvideTreeSigns < TItem > ( ) => typeof ( TItem ) == typeof ( DocumentTreeItemResponseModel ) ;
12
+
13
+ /// <inheritdoc/>>
14
+ public Task PopulateTreeSignsAsync < TItem > ( TItem [ ] treeItemViewModels , IEnumerable < IEntitySlim > entities )
15
+ where TItem : EntityTreeItemResponseModel , new ( )
16
+ {
17
+ foreach ( TItem item in treeItemViewModels )
18
+ {
19
+ if ( item is DocumentTreeItemResponseModel { IsProtected : true } )
20
+ {
21
+ item . AddSign ( Alias ) ;
22
+ }
23
+ }
24
+
25
+ return Task . CompletedTask ;
26
+ }
27
+ }
You can’t perform that action at this time.
0 commit comments