Skip to content

Commit

Permalink
Added missing dependencies to manager. Fixes #1775
Browse files Browse the repository at this point in the history
  • Loading branch information
tidyui committed Nov 30, 2021
1 parent 09cde8c commit c7f56b3
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions core/Piranha.Manager/Extensions/ManagerExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,19 @@ public static IServiceCollection AddPiranhaManager(this IServiceCollection servi
// Add SignalR
services.AddSignalR();

// Add preview policies
services.AddAuthorization(o =>
{
o.AddPolicy(Piranha.Security.Permission.PagePreview, policy =>
{
policy.RequireClaim(Piranha.Security.Permission.PagePreview, Piranha.Security.Permission.PagePreview);
});
o.AddPolicy(Piranha.Security.Permission.PostPreview, policy =>
{
policy.RequireClaim(Piranha.Security.Permission.PostPreview, Piranha.Security.Permission.PostPreview);
});
});

// Setup authorization policies
services.AddAuthorization(o =>
{
Expand Down Expand Up @@ -115,11 +128,13 @@ public static IServiceCollection AddPiranhaManager(this IServiceCollection servi
/// <param name="builder">The application builder</param>
/// <returns>The builder</returns>
public static IApplicationBuilder UsePiranhaManager(this IApplicationBuilder builder) {
return builder.UseStaticFiles(new StaticFileOptions
{
FileProvider = new EmbeddedFileProvider(typeof(ManagerModuleExtensions).Assembly, "Piranha.Manager.assets.dist"),
RequestPath = "/manager/assets"
});
return builder
.UseStaticFiles()
.UseStaticFiles(new StaticFileOptions
{
FileProvider = new EmbeddedFileProvider(typeof(ManagerModuleExtensions).Assembly, "Piranha.Manager.assets.dist"),
RequestPath = "/manager/assets"
});
}

/// <summary>
Expand Down

0 comments on commit c7f56b3

Please sign in to comment.