diff --git a/DynamicAuthPolicyDemo.Web/DynamicAuthPolicyDemo.Web.csproj b/DynamicAuthPolicyDemo.Web/DynamicAuthPolicyDemo.Web.csproj index 028ac8f..1ba3842 100644 --- a/DynamicAuthPolicyDemo.Web/DynamicAuthPolicyDemo.Web.csproj +++ b/DynamicAuthPolicyDemo.Web/DynamicAuthPolicyDemo.Web.csproj @@ -1,21 +1,21 @@ - - - - net8.0 - false - - - - 1701;1702;0436 - - - 1701;1702;0436 - - - - - - - - - + + + + net8.0 + false + + + + 1701;1702;0436 + + + 1701;1702;0436 + + + + + + + + + diff --git a/cloudscribe.DynamicPolicy.CoreIntegration/RoleCopiedHandler.cs b/cloudscribe.DynamicPolicy.CoreIntegration/RoleCopiedHandler.cs new file mode 100644 index 0000000..709d8dd --- /dev/null +++ b/cloudscribe.DynamicPolicy.CoreIntegration/RoleCopiedHandler.cs @@ -0,0 +1,55 @@ +using cloudscribe.Core.Models; +using cloudscribe.Core.Models.EventHandlers; +using cloudscribe.DynamicPolicy.Models; +using Microsoft.Extensions.Logging; +using System; +using System.Threading.Tasks; + +namespace cloudscribe.DynamicPolicy.CoreIntegration +{ + public class RoleCopiedHandler : IHandleRoleCopied + { + public RoleCopiedHandler( + IAuthorizationPolicyCommands policyCommands, + IAuthorizationPolicyQueries policyQueries, + ILogger logger) + { + _policyCommands = policyCommands; + _policyQueries = policyQueries; + _log = logger; + } + + private readonly IAuthorizationPolicyCommands _policyCommands; + private readonly IAuthorizationPolicyQueries _policyQueries; + private readonly ILogger _log; + + public async Task Handle(ISiteRole sourceRole, ISiteRole newRole) + { + try + { + var tenantId = sourceRole.SiteId.ToString(); + var policies = await _policyQueries.GetAll(tenantId); + + int updatedCount = 0; + foreach (var policy in policies) + { + if (policy.AllowedRoles.Contains(sourceRole.RoleName)) + { + if (!policy.AllowedRoles.Contains(newRole.RoleName)) + { + policy.AllowedRoles.Add(newRole.RoleName); + await _policyCommands.Update(policy); + updatedCount++; + } + } + } + + _log.LogInformation($"Role '{sourceRole.RoleName}' copied to '{newRole.RoleName}'. Updated {updatedCount} authorization policies."); + } + catch (Exception ex) + { + _log.LogError($"Error handling role copied event: {ex.Message}-{ex.StackTrace}"); + } + } + } +} diff --git a/cloudscribe.DynamicPolicy.CoreIntegration/StartupExtensions.cs b/cloudscribe.DynamicPolicy.CoreIntegration/StartupExtensions.cs index b1e5fd5..b3538a7 100644 --- a/cloudscribe.DynamicPolicy.CoreIntegration/StartupExtensions.cs +++ b/cloudscribe.DynamicPolicy.CoreIntegration/StartupExtensions.cs @@ -20,6 +20,7 @@ IConfiguration configuration services.AddScoped(); services.AddScoped(); services.AddScoped(); + services.AddScoped(); services.AddScoped(); diff --git a/cloudscribe.DynamicPolicy.CoreIntegration/cloudscribe.DynamicPolicy.CoreIntegration.csproj b/cloudscribe.DynamicPolicy.CoreIntegration/cloudscribe.DynamicPolicy.CoreIntegration.csproj index f7ab96a..52b948f 100644 --- a/cloudscribe.DynamicPolicy.CoreIntegration/cloudscribe.DynamicPolicy.CoreIntegration.csproj +++ b/cloudscribe.DynamicPolicy.CoreIntegration/cloudscribe.DynamicPolicy.CoreIntegration.csproj @@ -1,39 +1,39 @@ - - - - cloudscribe Core integration for Dynamic Authorization Policy Services for ASP.NET Core - 8.5.0 - net8.0 - Joe Audette - icon.png - https://github.com/cloudscribe/dynamic-authorization-policy - Apache-2.0 - https://github.com/cloudscribe/dynamic-authorization-policy.git - git - README.md - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + cloudscribe Core integration for Dynamic Authorization Policy Services for ASP.NET Core + 8.6.0 + net8.0 + Joe Audette + icon.png + https://github.com/cloudscribe/dynamic-authorization-policy + Apache-2.0 + https://github.com/cloudscribe/dynamic-authorization-policy.git + git + README.md + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cloudscribe.DynamicPolicy.Models/cloudscribe.DynamicPolicy.Models.csproj b/cloudscribe.DynamicPolicy.Models/cloudscribe.DynamicPolicy.Models.csproj index dbfcd70..fc36d58 100644 --- a/cloudscribe.DynamicPolicy.Models/cloudscribe.DynamicPolicy.Models.csproj +++ b/cloudscribe.DynamicPolicy.Models/cloudscribe.DynamicPolicy.Models.csproj @@ -1,31 +1,31 @@ - - - - model classes for Dynamic Authorization Policy for ASP.NET Core - 8.5.0 - net8.0 - Joe Audette - icon.png - https://github.com/cloudscribe/dynamic-authorization-policy - Apache-2.0 - https://github.com/cloudscribe/dynamic-authorization-policy.git - git - README.md - - - - - - - - - - - - - - - - - - + + + + model classes for Dynamic Authorization Policy for ASP.NET Core + 8.6.0 + net8.0 + Joe Audette + icon.png + https://github.com/cloudscribe/dynamic-authorization-policy + Apache-2.0 + https://github.com/cloudscribe/dynamic-authorization-policy.git + git + README.md + + + + + + + + + + + + + + + + + + diff --git a/cloudscribe.DynamicPolicy.Storage.EFCore.Common/AuthorizationPolicyCommands.cs b/cloudscribe.DynamicPolicy.Storage.EFCore.Common/AuthorizationPolicyCommands.cs index 0b81529..7659a14 100644 --- a/cloudscribe.DynamicPolicy.Storage.EFCore.Common/AuthorizationPolicyCommands.cs +++ b/cloudscribe.DynamicPolicy.Storage.EFCore.Common/AuthorizationPolicyCommands.cs @@ -142,7 +142,7 @@ private void SyncClaimRequirements( { if (entity.RequiredClaims.Count > 0) { - for (int i = 0; i < entity.RequiredClaims.Count; i++) + for (int i = entity.RequiredClaims.Count - 1; i >= 0; i--) { if (!requiredClaims.HasClaim(entity.RequiredClaims[i].ClaimName)) { @@ -192,7 +192,7 @@ private void SyncClaimAllowedValues( { if (entity.AllowedValues.Count > 0) { - for (int i = 0; i < entity.AllowedValues.Count; i++) + for (int i = entity.AllowedValues.Count - 1; i >= 0; i--) { if (!claim.AllowedValues.Contains(entity.AllowedValues[i].AllowedValue)) { @@ -235,7 +235,7 @@ private static void SyncSchemes( { if (entity.AuthenticationSchemes.Count > 0) { - for (int i = 0; i < entity.AuthenticationSchemes.Count; i++) + for (int i = entity.AuthenticationSchemes.Count - 1; i >= 0; i--) { if (!authSchemeStrings.Contains(entity.AuthenticationSchemes[i].AuthenticationScheme)) { @@ -276,13 +276,14 @@ private void SyncRoles( { if (entity.AllowedRoles.Count > 0) { - for (int i = 0; i < entity.AllowedRoles.Count; i++) + // go backwards to avoid classic removal index issues, + // changing what you are supposed to be looping through + for (int i = entity.AllowedRoles.Count - 1; i >= 0; i--) { if (!allowedRoleStrings.Contains(entity.AllowedRoles[i].AllowedRole)) { db.AllowedRoles.Remove(entity.AllowedRoles[i]); entity.AllowedRoles.RemoveAt(i); - } } } diff --git a/cloudscribe.DynamicPolicy.Storage.EFCore.Common/cloudscribe.DynamicPolicy.Storage.EFCore.Common.csproj b/cloudscribe.DynamicPolicy.Storage.EFCore.Common/cloudscribe.DynamicPolicy.Storage.EFCore.Common.csproj index 59e26eb..556ed88 100644 --- a/cloudscribe.DynamicPolicy.Storage.EFCore.Common/cloudscribe.DynamicPolicy.Storage.EFCore.Common.csproj +++ b/cloudscribe.DynamicPolicy.Storage.EFCore.Common/cloudscribe.DynamicPolicy.Storage.EFCore.Common.csproj @@ -1,33 +1,33 @@ - - - - Entity Framework Core implementation of commands and queries for Dynamic Authorization Policies for ASP.NET Core - 8.5.0 - net8.0 - Joe Audette - icon.png - https://github.com/cloudscribe/dynamic-authorization-policy - Apache-2.0 - https://github.com/cloudscribe/dynamic-authorization-policy.git - git - README.md - - - - - - - - - - - - - - - - - - - - + + + + Entity Framework Core implementation of commands and queries for Dynamic Authorization Policies for ASP.NET Core + 8.6.0 + net8.0 + Joe Audette + icon.png + https://github.com/cloudscribe/dynamic-authorization-policy + Apache-2.0 + https://github.com/cloudscribe/dynamic-authorization-policy.git + git + README.md + + + + + + + + + + + + + + + + + + + + diff --git a/cloudscribe.DynamicPolicy.Storage.EFCore.MSSQL/cloudscribe.DynamicPolicy.Storage.EFCore.MSSQL.csproj b/cloudscribe.DynamicPolicy.Storage.EFCore.MSSQL/cloudscribe.DynamicPolicy.Storage.EFCore.MSSQL.csproj index e32f5c4..c32462d 100644 --- a/cloudscribe.DynamicPolicy.Storage.EFCore.MSSQL/cloudscribe.DynamicPolicy.Storage.EFCore.MSSQL.csproj +++ b/cloudscribe.DynamicPolicy.Storage.EFCore.MSSQL/cloudscribe.DynamicPolicy.Storage.EFCore.MSSQL.csproj @@ -1,30 +1,30 @@ - - - - MSSQL Entity Framework Core implementation of commands and queries for Dynamic Authorization Policies for ASP.NET Core - 8.5.0 - net8.0 - Joe Audette - icon.png - https://github.com/cloudscribe/dynamic-authorization-policy - Apache-2.0 - https://github.com/cloudscribe/dynamic-authorization-policy.git - git - - - - - - - - - - - - - - - - - - + + + + MSSQL Entity Framework Core implementation of commands and queries for Dynamic Authorization Policies for ASP.NET Core + 8.6.0 + net8.0 + Joe Audette + icon.png + https://github.com/cloudscribe/dynamic-authorization-policy + Apache-2.0 + https://github.com/cloudscribe/dynamic-authorization-policy.git + git + + + + + + + + + + + + + + + + + + diff --git a/cloudscribe.DynamicPolicy.Storage.EFCore.MySql/cloudscribe.DynamicPolicy.Storage.EFCore.MySql.csproj b/cloudscribe.DynamicPolicy.Storage.EFCore.MySql/cloudscribe.DynamicPolicy.Storage.EFCore.MySql.csproj index 31a5bfb..1185eef 100644 --- a/cloudscribe.DynamicPolicy.Storage.EFCore.MySql/cloudscribe.DynamicPolicy.Storage.EFCore.MySql.csproj +++ b/cloudscribe.DynamicPolicy.Storage.EFCore.MySql/cloudscribe.DynamicPolicy.Storage.EFCore.MySql.csproj @@ -1,33 +1,33 @@ - - - - MySql Entity Framework Core implementation of commands and queries for Dynamic Authorization Policies for ASP.NET Core - 8.5.0 - net8.0 - Joe Audette - icon.png - https://github.com/cloudscribe/dynamic-authorization-policy - Apache-2.0 - https://github.com/cloudscribe/dynamic-authorization-policy.git - git - - - - - - - - - - - - - - - - - - - - - + + + + MySql Entity Framework Core implementation of commands and queries for Dynamic Authorization Policies for ASP.NET Core + 8.6.0 + net8.0 + Joe Audette + icon.png + https://github.com/cloudscribe/dynamic-authorization-policy + Apache-2.0 + https://github.com/cloudscribe/dynamic-authorization-policy.git + git + + + + + + + + + + + + + + + + + + + + + diff --git a/cloudscribe.DynamicPolicy.Storage.EFCore.PostgreSql/cloudscribe.DynamicPolicy.Storage.EFCore.PostgreSql.csproj b/cloudscribe.DynamicPolicy.Storage.EFCore.PostgreSql/cloudscribe.DynamicPolicy.Storage.EFCore.PostgreSql.csproj index f56e308..39e6ab2 100644 --- a/cloudscribe.DynamicPolicy.Storage.EFCore.PostgreSql/cloudscribe.DynamicPolicy.Storage.EFCore.PostgreSql.csproj +++ b/cloudscribe.DynamicPolicy.Storage.EFCore.PostgreSql/cloudscribe.DynamicPolicy.Storage.EFCore.PostgreSql.csproj @@ -1,34 +1,34 @@ - - - - PostgreSql Entity Framework Core implementation of commands and queries for Dynamic Authorization Policies for ASP.NET Core - 8.5.0 - net8.0 - Joe Audette - icon.png - https://github.com/cloudscribe/dynamic-authorization-policy - Apache-2.0 - https://github.com/cloudscribe/dynamic-authorization-policy.git - git - - - - - - - - - - - - - - - - - - - - - - + + + + PostgreSql Entity Framework Core implementation of commands and queries for Dynamic Authorization Policies for ASP.NET Core + 8.6.0 + net8.0 + Joe Audette + icon.png + https://github.com/cloudscribe/dynamic-authorization-policy + Apache-2.0 + https://github.com/cloudscribe/dynamic-authorization-policy.git + git + + + + + + + + + + + + + + + + + + + + + + diff --git a/cloudscribe.DynamicPolicy.Storage.EFCore.SQLite/cloudscribe.DynamicPolicy.Storage.EFCore.SQLite.csproj b/cloudscribe.DynamicPolicy.Storage.EFCore.SQLite/cloudscribe.DynamicPolicy.Storage.EFCore.SQLite.csproj index c87f298..cce58ed 100644 --- a/cloudscribe.DynamicPolicy.Storage.EFCore.SQLite/cloudscribe.DynamicPolicy.Storage.EFCore.SQLite.csproj +++ b/cloudscribe.DynamicPolicy.Storage.EFCore.SQLite/cloudscribe.DynamicPolicy.Storage.EFCore.SQLite.csproj @@ -1,32 +1,32 @@ - - - - SQLite Entity Framework Core implementation of commands and queries for Dynamic Authorization Policies for ASP.NET Core - 8.5.0 - net8.0 - Joe Audette - icon.png - https://github.com/cloudscribe/dynamic-authorization-policy - Apache-2.0 - https://github.com/cloudscribe/dynamic-authorization-policy.git - git - - - - - - - - - - - - - - - - - - - - + + + + SQLite Entity Framework Core implementation of commands and queries for Dynamic Authorization Policies for ASP.NET Core + 8.6.0 + net8.0 + Joe Audette + icon.png + https://github.com/cloudscribe/dynamic-authorization-policy + Apache-2.0 + https://github.com/cloudscribe/dynamic-authorization-policy.git + git + + + + + + + + + + + + + + + + + + + + diff --git a/cloudscribe.DynamicPolicy.Storage.NoDb/cloudscribe.DynamicPolicy.Storage.NoDb.csproj b/cloudscribe.DynamicPolicy.Storage.NoDb/cloudscribe.DynamicPolicy.Storage.NoDb.csproj index 39850ca..0bb80cd 100644 --- a/cloudscribe.DynamicPolicy.Storage.NoDb/cloudscribe.DynamicPolicy.Storage.NoDb.csproj +++ b/cloudscribe.DynamicPolicy.Storage.NoDb/cloudscribe.DynamicPolicy.Storage.NoDb.csproj @@ -1,39 +1,39 @@ - - - - NoDb storage for Dynamic Authorization Policies for ASP.NET Core - 8.5.0 - net8.0 - Joe Audette - icon.png - https://github.com/cloudscribe/dynamic-authorization-policy - Apache-2.0 - https://github.com/cloudscribe/dynamic-authorization-policy.git - git - README.md - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + NoDb storage for Dynamic Authorization Policies for ASP.NET Core + 8.6.0 + net8.0 + Joe Audette + icon.png + https://github.com/cloudscribe/dynamic-authorization-policy + Apache-2.0 + https://github.com/cloudscribe/dynamic-authorization-policy.git + git + README.md + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cloudscribe.DynamicPolicy.Web.Mvc/cloudscribe.DynamicPolicy.Web.Mvc.csproj b/cloudscribe.DynamicPolicy.Web.Mvc/cloudscribe.DynamicPolicy.Web.Mvc.csproj index 0912b84..65d6940 100644 --- a/cloudscribe.DynamicPolicy.Web.Mvc/cloudscribe.DynamicPolicy.Web.Mvc.csproj +++ b/cloudscribe.DynamicPolicy.Web.Mvc/cloudscribe.DynamicPolicy.Web.Mvc.csproj @@ -1,41 +1,41 @@ - - - - Dynamic Authorization Policy Services for ASP.NET Core - 8.5.0 - net8.0 - Joe Audette - icon.png - https://github.com/cloudscribe/dynamic-authorization-policy - Apache-2.0 - https://github.com/cloudscribe/dynamic-authorization-policy.git - git - README.md - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + Dynamic Authorization Policy Services for ASP.NET Core + 8.6.0 + net8.0 + Joe Audette + icon.png + https://github.com/cloudscribe/dynamic-authorization-policy + Apache-2.0 + https://github.com/cloudscribe/dynamic-authorization-policy.git + git + README.md + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cloudscribe.DynamicPolicy.Web.Views.Bootstrap3/cloudscribe.DynamicPolicy.Web.Views.Bootstrap3.csproj b/cloudscribe.DynamicPolicy.Web.Views.Bootstrap3/cloudscribe.DynamicPolicy.Web.Views.Bootstrap3.csproj index e0604d3..337d641 100644 --- a/cloudscribe.DynamicPolicy.Web.Views.Bootstrap3/cloudscribe.DynamicPolicy.Web.Views.Bootstrap3.csproj +++ b/cloudscribe.DynamicPolicy.Web.Views.Bootstrap3/cloudscribe.DynamicPolicy.Web.Views.Bootstrap3.csproj @@ -1,40 +1,40 @@ - - - - Bootstrap 3 views for cloudscribe Dynamic Authorization Policy - 8.5.0 - net8.0 - Joe Audette - true - icon.png - https://github.com/cloudscribe/dynamic-authorization-policy - Apache-2.0 - https://github.com/cloudscribe/dynamic-authorization-policy.git - git - README.md - - - - - - - - - - - - 1701;1702;0436 - - - 1701;1702;0436 - - - - - - - - - - - + + + + Bootstrap 3 views for cloudscribe Dynamic Authorization Policy + 8.6.0 + net8.0 + Joe Audette + true + icon.png + https://github.com/cloudscribe/dynamic-authorization-policy + Apache-2.0 + https://github.com/cloudscribe/dynamic-authorization-policy.git + git + README.md + + + + + + + + + + + + 1701;1702;0436 + + + 1701;1702;0436 + + + + + + + + + + + diff --git a/cloudscribe.DynamicPolicy.Web.Views.Bootstrap4/cloudscribe.DynamicPolicy.Web.Views.Bootstrap4.csproj b/cloudscribe.DynamicPolicy.Web.Views.Bootstrap4/cloudscribe.DynamicPolicy.Web.Views.Bootstrap4.csproj index 689b134..a25e3c4 100644 --- a/cloudscribe.DynamicPolicy.Web.Views.Bootstrap4/cloudscribe.DynamicPolicy.Web.Views.Bootstrap4.csproj +++ b/cloudscribe.DynamicPolicy.Web.Views.Bootstrap4/cloudscribe.DynamicPolicy.Web.Views.Bootstrap4.csproj @@ -1,39 +1,39 @@ - - - - Bootstrap 4 views for cloudscribe Dynamic Authorization Policy - 8.5.0 - net8.0 - Joe Audette - true - icon.png - https://github.com/cloudscribe/dynamic-authorization-policy - Apache-2.0 - https://github.com/cloudscribe/dynamic-authorization-policy.git - git - README.md - - - - - - - - - - - - 1701;1702;0436 - - - 1701;1702;0436 - - - - - - - - - - + + + + Bootstrap 4 views for cloudscribe Dynamic Authorization Policy + 8.6.0 + net8.0 + Joe Audette + true + icon.png + https://github.com/cloudscribe/dynamic-authorization-policy + Apache-2.0 + https://github.com/cloudscribe/dynamic-authorization-policy.git + git + README.md + + + + + + + + + + + + 1701;1702;0436 + + + 1701;1702;0436 + + + + + + + + + + diff --git a/cloudscribe.DynamicPolicy.Web.Views.Bootstrap5/cloudscribe.DynamicPolicy.Web.Views.Bootstrap5.csproj b/cloudscribe.DynamicPolicy.Web.Views.Bootstrap5/cloudscribe.DynamicPolicy.Web.Views.Bootstrap5.csproj index 93dd245..fd82a91 100644 --- a/cloudscribe.DynamicPolicy.Web.Views.Bootstrap5/cloudscribe.DynamicPolicy.Web.Views.Bootstrap5.csproj +++ b/cloudscribe.DynamicPolicy.Web.Views.Bootstrap5/cloudscribe.DynamicPolicy.Web.Views.Bootstrap5.csproj @@ -1,39 +1,39 @@ - - - - Bootstrap 5 views for cloudscribe Dynamic Authorization Policy - 8.5.0 - net8.0 - Joe Audette - true - icon.png - https://github.com/cloudscribe/dynamic-authorization-policy - Apache-2.0 - https://github.com/cloudscribe/dynamic-authorization-policy.git - git - README.md - - - - - - - - - - - - 1701;1702;0436 - - - 1701;1702;0436 - - - - - - - - - - + + + + Bootstrap 5 views for cloudscribe Dynamic Authorization Policy + 8.6.0 + net8.0 + Joe Audette + true + icon.png + https://github.com/cloudscribe/dynamic-authorization-policy + Apache-2.0 + https://github.com/cloudscribe/dynamic-authorization-policy.git + git + README.md + + + + + + + + + + + + 1701;1702;0436 + + + 1701;1702;0436 + + + + + + + + + + diff --git a/cloudscribeDemo.Web/cloudscribeDemo.Web.csproj b/cloudscribeDemo.Web/cloudscribeDemo.Web.csproj index 2722875..c52ecbd 100644 --- a/cloudscribeDemo.Web/cloudscribeDemo.Web.csproj +++ b/cloudscribeDemo.Web/cloudscribeDemo.Web.csproj @@ -1,77 +1,77 @@ - - - - net8.0 - cloudscribeDemo.Web-EBE25C92-4443-4147-BC94-2D9B090657A7 - false - - - - 1701;1702;0436 - - - 1701;1702;0436 - - - - - PreserveNewest - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + net8.0 + cloudscribeDemo.Web-EBE25C92-4443-4147-BC94-2D9B090657A7 + false + + + + 1701;1702;0436 + + + 1701;1702;0436 + + + + + PreserveNewest + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/update_version.ps1 b/update_version.ps1 index 4b4dc56..89c2df5 100644 --- a/update_version.ps1 +++ b/update_version.ps1 @@ -1,52 +1,52 @@ -################### -## PS script to implement a semantic versioning change from (say) 8.0.x to 8.1 -## across all interdependent cs packages - -## Wherever we have 8.0.n replace it to 8.1.0 where n >= 0 - -## Wherever we have replace it to - -## Wherever we have replace it to where n >= 0 - -## Exclude cloudscribe.HtmlAgilityPack and DbHelpers because those ones are ancient and frozen -################### - - -# Define the directory containing the .csproj files -$directory = "./" # DIFFERENT in this Repo !!!! - -# Define the old & new versions -$oldVersion = '8\.4' # slash needed ! -$newVersion = "8.5.0" -$newWildcardVersion = "8.5.*" - - -# Get all .csproj files in the directory and subdirectories -$csprojFiles = Get-ChildItem -Path $directory -Recurse -Filter *.csproj - -foreach ($file in $csprojFiles) { - # Read the content of the .csproj file - $content = Get-Content -Path $file.FullName - - # Update the version of cloudscribe package references, except for cloudscribe.HtmlAgilityPack and cloudscribe.DbHelpers - - $wildCardPattern = '(?<=$newVersion" - $updatedContent = $updatedContent -replace $versionPattern, $replacement - - - # Write the updated content back to the .csproj file - Set-Content -Path $file.FullName -Value $updatedContent - - Write-Host "Updated $file.FullName" -} - -Write-Host "All cloudscribe package references (except cloudscribe.HtmlAgilityPack and cloudscribe.DbHelpers) and elements have been updated to version $newVersion or $newWildcardVersion as appropriate." - +################### +## PS script to implement a semantic versioning change from (say) 8.0.x to 8.1 +## across all interdependent cs packages + +## Wherever we have 8.0.n replace it to 8.1.0 where n >= 0 + +## Wherever we have replace it to + +## Wherever we have replace it to where n >= 0 + +## Exclude cloudscribe.HtmlAgilityPack and DbHelpers because those ones are ancient and frozen +################### + + +# Define the directory containing the .csproj files +$directory = "./" # DIFFERENT in this Repo !!!! + +# Define the old & new versions +$oldVersion = '8\.5' # slash needed ! +$newVersion = "8.6.0" +$newWildcardVersion = "8.6.*" + + +# Get all .csproj files in the directory and subdirectories +$csprojFiles = Get-ChildItem -Path $directory -Recurse -Filter *.csproj + +foreach ($file in $csprojFiles) { + # Read the content of the .csproj file + $content = Get-Content -Path $file.FullName + + # Update the version of cloudscribe package references, except for cloudscribe.HtmlAgilityPack and cloudscribe.DbHelpers + + $wildCardPattern = '(?<=$newVersion" + $updatedContent = $updatedContent -replace $versionPattern, $replacement + + + # Write the updated content back to the .csproj file + Set-Content -Path $file.FullName -Value $updatedContent + + Write-Host "Updated $file.FullName" +} + +Write-Host "All cloudscribe package references (except cloudscribe.HtmlAgilityPack and cloudscribe.DbHelpers) and elements have been updated to version $newVersion or $newWildcardVersion as appropriate." +