diff --git a/core/Piranha.Manager/Extensions/ManagerExtensions.cs b/core/Piranha.Manager/Extensions/ManagerExtensions.cs index 233a90df8..cd6f9b469 100644 --- a/core/Piranha.Manager/Extensions/ManagerExtensions.cs +++ b/core/Piranha.Manager/Extensions/ManagerExtensions.cs @@ -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 => { @@ -115,11 +128,13 @@ public static IServiceCollection AddPiranhaManager(this IServiceCollection servi /// The application builder /// The builder 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" + }); } ///