From c9494b647d5827356932c2113a197eb79a4bed3c Mon Sep 17 00:00:00 2001 From: Halil ibrahim Kalkan Date: Thu, 24 Jan 2019 14:30:29 +0300 Subject: [PATCH] Fix abp.io web site for permission module changes. --- .../AbpWebSiteWebModule.cs | 32 +++++++++++++------ .../Volo.AbpWebSite.Web.csproj | 4 ++- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/abp_io/src/Volo.AbpWebSite.Web/AbpWebSiteWebModule.cs b/abp_io/src/Volo.AbpWebSite.Web/AbpWebSiteWebModule.cs index 310b23718e..bbbce26cee 100644 --- a/abp_io/src/Volo.AbpWebSite.Web/AbpWebSiteWebModule.cs +++ b/abp_io/src/Volo.AbpWebSite.Web/AbpWebSiteWebModule.cs @@ -14,6 +14,7 @@ using Volo.Abp.AspNetCore.Mvc.UI.Bundling; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Bundling; using Volo.Abp.AspNetCore.Mvc.UI.Theming; +using Volo.Abp.Authorization.Permissions; using Volo.Abp.Autofac; using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; @@ -21,6 +22,8 @@ using Volo.Abp.Identity; using Volo.Abp.Identity.Web; using Volo.Abp.Localization; using Volo.Abp.Modularity; +using Volo.Abp.PermissionManagement; +using Volo.Abp.PermissionManagement.Identity; using Volo.Abp.Threading; using Volo.Abp.UI; using Volo.Abp.VirtualFileSystem; @@ -40,6 +43,8 @@ namespace Volo.AbpWebSite typeof(AbpAccountWebModule), typeof(AbpIdentityApplicationModule), typeof(AbpIdentityWebModule), + typeof(AbpPermissionManagementApplicationModule), + typeof(AbpPermissionManagementDomainIdentityModule), typeof(BloggingApplicationModule), typeof(BloggingWebModule) )] @@ -160,16 +165,25 @@ namespace Volo.AbpWebSite app.UseMvcWithDefaultRouteAndArea(); - AsyncHelper.RunSync(async () => + using (var scope = context.ServiceProvider.CreateScope()) { - await context.ServiceProvider - .GetRequiredService() - .SeedAsync( - "1q2w3E*", - IdentityPermissions.GetAll() - .Union(BloggingPermissions.GetAll()) - ); - }); + AsyncHelper.RunSync(async () => + { + await scope.ServiceProvider + .GetRequiredService() + .SeedAsync( + "1q2w3E*" + ); + + await scope.ServiceProvider + .GetRequiredService() + .SeedAsync( + RolePermissionValueProvider.ProviderName, + "admin", + IdentityPermissions.GetAll().Union(BloggingPermissions.GetAll()) + ); + }); + } } } } diff --git a/abp_io/src/Volo.AbpWebSite.Web/Volo.AbpWebSite.Web.csproj b/abp_io/src/Volo.AbpWebSite.Web/Volo.AbpWebSite.Web.csproj index 5c410ca673..8fbbbfd711 100644 --- a/abp_io/src/Volo.AbpWebSite.Web/Volo.AbpWebSite.Web.csproj +++ b/abp_io/src/Volo.AbpWebSite.Web/Volo.AbpWebSite.Web.csproj @@ -31,6 +31,8 @@ + + @@ -38,7 +40,7 @@ Always - + Always