Skip to content

Commit e2dc475

Browse files
authored
Merge pull request #9 from jcdcdev/dev/v14
14.0.1
2 parents ea8d767 + d7b2941 commit e2dc475

File tree

6 files changed

+20
-34
lines changed

6 files changed

+20
-34
lines changed

.github/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
[![Umbraco Marketplace](https://img.shields.io/badge/Umbraco-Marketplace-%233544B1?style=flat&logo=umbraco)](https://marketplace.umbraco.com/package/umbraco.community.dataprotection)
44
[![GitHub License](https://img.shields.io/github/license/jcdcdev/Umbraco.Community.DataProtection?color=8AB803&label=License&logo=github)](https://github.com/jcdcdev/Umbraco.Community.DataProtection/blob/main/LICENSE)
55
[![NuGet Downloads](https://img.shields.io/nuget/dt/Umbraco.Community.DataProtection?color=cc9900&label=Downloads&logo=nuget)](https://www.nuget.org/packages/Umbraco.Community.DataProtection/)
6+
[![Project Website](https://img.shields.io/badge/Project%20Website-jcdc.dev-jcdcdev?style=flat&color=3c4834&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0id2hpdGUiIGNsYXNzPSJiaSBiaS1wYy1kaXNwbGF5IiB2aWV3Qm94PSIwIDAgMTYgMTYiPgogIDxwYXRoIGQ9Ik04IDFhMSAxIDAgMCAxIDEtMWg2YTEgMSAwIDAgMSAxIDF2MTRhMSAxIDAgMCAxLTEgMUg5YTEgMSAwIDAgMS0xLTF6bTEgMTMuNWEuNS41IDAgMSAwIDEgMCAuNS41IDAgMCAwLTEgMG0yIDBhLjUuNSAwIDEgMCAxIDAgLjUuNSAwIDAgMC0xIDBNOS41IDFhLjUuNSAwIDAgMCAwIDFoNWEuNS41IDAgMCAwIDAtMXpNOSAzLjVhLjUuNSAwIDAgMCAuNS41aDVhLjUuNSAwIDAgMCAwLTFoLTVhLjUuNSAwIDAgMC0uNS41TTEuNSAyQTEuNSAxLjUgMCAwIDAgMCAzLjV2N0ExLjUgMS41IDAgMCAwIDEuNSAxMkg2djJoLS41YS41LjUgMCAwIDAgMCAxSDd2LTRIMS41YS41LjUgMCAwIDEtLjUtLjV2LTdhLjUuNSAwIDAgMSAuNS0uNUg3VjJ6Ii8+Cjwvc3ZnPg==)](https://jcdc.dev/umbraco-packages/data-protection)
67

78
Simple [ASP.NET Core Data Protection](https://learn.microsoft.com/en-us/aspnet/core/security/data-protection/introduction?view=aspnetcore-8.0) for Umbraco CMS.
89

docs/README_nuget.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
[![Umbraco Marketplace](https://img.shields.io/badge/Umbraco-Marketplace-%233544B1?style=flat&logo=umbraco)](https://marketplace.umbraco.com/package/umbraco.community.dataprotection)
55
[![GitHub License](https://img.shields.io/github/license/jcdcdev/Umbraco.Community.DataProtection?color=8AB803&label=License&logo=github)](https://github.com/jcdcdev/Umbraco.Community.DataProtection/blob/main/LICENSE)
66
[![NuGet Downloads](https://img.shields.io/nuget/dt/Umbraco.Community.DataProtection?color=cc9900&label=Downloads&logo=nuget)](https://www.nuget.org/packages/Umbraco.Community.DataProtection/)
7+
[![Project Website](https://img.shields.io/badge/Project%20Website-jcdc.dev-jcdcdev?style=flat&color=3c4834&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0id2hpdGUiIGNsYXNzPSJiaSBiaS1wYy1kaXNwbGF5IiB2aWV3Qm94PSIwIDAgMTYgMTYiPgogIDxwYXRoIGQ9Ik04IDFhMSAxIDAgMCAxIDEtMWg2YTEgMSAwIDAgMSAxIDF2MTRhMSAxIDAgMCAxLTEgMUg5YTEgMSAwIDAgMS0xLTF6bTEgMTMuNWEuNS41IDAgMSAwIDEgMCAuNS41IDAgMCAwLTEgMG0yIDBhLjUuNSAwIDEgMCAxIDAgLjUuNSAwIDAgMC0xIDBNOS41IDFhLjUuNSAwIDAgMCAwIDFoNWEuNS41IDAgMCAwIDAtMXpNOSAzLjVhLjUuNSAwIDAgMCAuNS41aDVhLjUuNSAwIDAgMCAwLTFoLTVhLjUuNSAwIDAgMC0uNS41TTEuNSAyQTEuNSAxLjUgMCAwIDAgMCAzLjV2N0ExLjUgMS41IDAgMCAwIDEuNSAxMkg2djJoLS41YS41LjUgMCAwIDAgMCAxSDd2LTRIMS41YS41LjUgMCAwIDEtLjUtLjV2LTdhLjUuNSAwIDAgMSAuNS0uNUg3VjJ6Ii8+Cjwvc3ZnPg==)](https://jcdc.dev/umbraco-packages/data-protection)
78

89
Simple [ASP.NET Core Data Protection](https://learn.microsoft.com/en-us/aspnet/core/security/data-protection/introduction?view=aspnetcore-8.0) for Umbraco CMS.
910

src/Umbraco.Community.DataProtection/Persistence/DataProtectionMigration.cs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,18 @@
1010

1111
namespace Umbraco.Community.DataProtection.Persistence;
1212

13-
public class DataProtectionMigration : PackageMigrationBase
14-
{
15-
public DataProtectionMigration(
16-
IPackagingService packagingService,
17-
IMediaService mediaService,
18-
MediaFileManager mediaFileManager,
19-
MediaUrlGeneratorCollection mediaUrlGenerators,
20-
IShortStringHelper shortStringHelper,
21-
IContentTypeBaseServiceProvider contentTypeBaseServiceProvider,
22-
IMigrationContext context,
23-
IOptions<PackageMigrationSettings> packageMigrationsSettings) : base(packagingService, mediaService, mediaFileManager, mediaUrlGenerators, shortStringHelper, contentTypeBaseServiceProvider,
13+
public class DataProtectionMigration(
14+
IPackagingService packagingService,
15+
IMediaService mediaService,
16+
MediaFileManager mediaFileManager,
17+
MediaUrlGeneratorCollection mediaUrlGenerators,
18+
IShortStringHelper shortStringHelper,
19+
IContentTypeBaseServiceProvider contentTypeBaseServiceProvider,
20+
IMigrationContext context,
21+
IOptions<PackageMigrationSettings> packageMigrationsSettings)
22+
: PackageMigrationBase(packagingService, mediaService, mediaFileManager, mediaUrlGenerators, shortStringHelper, contentTypeBaseServiceProvider,
2423
context, packageMigrationsSettings)
25-
{
26-
}
27-
24+
{
2825
protected override void Migrate()
2926
{
3027
if (!TableExists(Constants.Tables.DataProtectionKeys))

src/Umbraco.Community.DataProtection/Persistence/MigrationPlan.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,8 @@
22

33
namespace Umbraco.Community.DataProtection.Persistence;
44

5-
public class MigrationPlan : PackageMigrationPlan
5+
public class MigrationPlan() : PackageMigrationPlan(Constants.PackageId)
66
{
7-
public MigrationPlan() : base(Constants.PackageId)
8-
{
9-
}
10-
117
protected override void DefinePlan()
128
{
139
To<DataProtectionMigration>(nameof(DataProtectionMigration));

src/Umbraco.Community.DataProtection/Persistence/UmbracoXmlRepository.cs

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,13 @@
77

88
namespace Umbraco.Community.DataProtection.Persistence;
99

10-
public class UmbracoXmlRepository : IXmlRepository
10+
public class UmbracoXmlRepository(IScopeProvider scopeProvider, ILogger<UmbracoXmlRepository> logger) : IXmlRepository
1111
{
12-
private readonly ILogger<UmbracoXmlRepository> _logger;
13-
private readonly IScopeProvider _scopeProvider;
14-
15-
public UmbracoXmlRepository(IScopeProvider scopeProvider, ILogger<UmbracoXmlRepository> logger)
16-
{
17-
_scopeProvider = scopeProvider;
18-
_logger = logger;
19-
}
20-
2112
public IReadOnlyCollection<XElement> GetAllElements()
2213
{
2314
try
2415
{
25-
using var scope = _scopeProvider.CreateScope();
16+
using var scope = scopeProvider.CreateScope();
2617
var sql = scope.SqlContext.Sql().SelectAll().From<DataProtectionKey>();
2718
var results = scope.Database.Fetch<DataProtectionKey>(sql);
2819
var output = results.Select(x => XElement.Parse(x.Xml!)).WhereNotNull().ToList().AsReadOnly();
@@ -31,7 +22,7 @@ public IReadOnlyCollection<XElement> GetAllElements()
3122
}
3223
catch (Exception ex)
3324
{
34-
_logger.LogError(ex, "Error getting all elements");
25+
logger.LogError(ex, "Error getting all elements");
3526
return Array.Empty<XElement>();
3627
}
3728
}
@@ -40,7 +31,7 @@ public void StoreElement(XElement element, string friendlyName)
4031
{
4132
try
4233
{
43-
using var scope = _scopeProvider.CreateScope(autoComplete: false);
34+
using var scope = scopeProvider.CreateScope(autoComplete: false);
4435
var key = new DataProtectionKey
4536
{
4637
FriendlyName = friendlyName,
@@ -51,7 +42,7 @@ public void StoreElement(XElement element, string friendlyName)
5142
}
5243
catch (Exception ex)
5344
{
54-
_logger.LogError(ex, "Error storing element");
45+
logger.LogError(ex, "Error storing element");
5546
}
5647
}
5748
}

src/Umbraco.Community.DataProtection/Umbraco.Community.DataProtection.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22
<PropertyGroup>
33
<TargetFramework>net8.0</TargetFramework>
4-
<LangVersion>10</LangVersion>
4+
<LangVersion>12</LangVersion>
55
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
66
<Nullable>enable</Nullable>
77
<ImplicitUsings>enable</ImplicitUsings>

0 commit comments

Comments
 (0)