From 5ab3b1376a4615a870b4e45ec544ebb07298d691 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=ABl=20Mugnier?= Date: Wed, 4 Nov 2020 15:51:09 +0100 Subject: [PATCH] Fix - S'assurer que les roles ont toujours le bon format en db --- Sheaft.Identity/Startup.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Sheaft.Identity/Startup.cs b/Sheaft.Identity/Startup.cs index c1d9b29..9cbbc73 100644 --- a/Sheaft.Identity/Startup.cs +++ b/Sheaft.Identity/Startup.cs @@ -277,16 +277,16 @@ public void Configure(IApplicationBuilder app) if (!authContext.Roles.Any()) { var rm = serviceScope.ServiceProvider.GetService>(); - rm.CreateAsync(new IdentityRole(Configuration.GetValue("Roles:Admin:value")) { Id = Configuration.GetValue("Roles:Admin:id") }).Wait(); - rm.CreateAsync(new IdentityRole(Configuration.GetValue("Roles:Support:value")) { Id = Configuration.GetValue("Roles:Support:id") }).Wait(); - rm.CreateAsync(new IdentityRole(Configuration.GetValue("Roles:AppUser:value")) { Id = Configuration.GetValue("Roles:AppUser:id") }).Wait(); + rm.CreateAsync(new IdentityRole(Configuration.GetValue("Roles:Admin:value")) { Id = Configuration.GetValue("Roles:Admin:id").ToString("D") }).Wait(); + rm.CreateAsync(new IdentityRole(Configuration.GetValue("Roles:Support:value")) { Id = Configuration.GetValue("Roles:Support:id").ToString("D") }).Wait(); + rm.CreateAsync(new IdentityRole(Configuration.GetValue("Roles:AppUser:value")) { Id = Configuration.GetValue("Roles:AppUser:id").ToString("D") }).Wait(); //specific for sheaft - rm.CreateAsync(new IdentityRole(Configuration.GetValue("Roles:User:value")) { Id = Configuration.GetValue("Roles:User:id") }).Wait(); - rm.CreateAsync(new IdentityRole(Configuration.GetValue("Roles:Consumer:value")) { Id = Configuration.GetValue("Roles:Consumer:id") }).Wait(); - rm.CreateAsync(new IdentityRole(Configuration.GetValue("Roles:Owner:value")) { Id = Configuration.GetValue("Roles:Owner:id") }).Wait(); - rm.CreateAsync(new IdentityRole(Configuration.GetValue("Roles:Producer:value")) { Id = Configuration.GetValue("Roles:Producer:id") }).Wait(); - rm.CreateAsync(new IdentityRole(Configuration.GetValue("Roles:Store:value")) { Id = Configuration.GetValue("Roles:Store:id") }).Wait(); - rm.CreateAsync(new IdentityRole(Configuration.GetValue("Roles:Anonymous:value")) { Id = Configuration.GetValue("Roles:Anonymous:id") }).Wait(); + rm.CreateAsync(new IdentityRole(Configuration.GetValue("Roles:User:value")) { Id = Configuration.GetValue("Roles:User:id").ToString("D") }).Wait(); + rm.CreateAsync(new IdentityRole(Configuration.GetValue("Roles:Consumer:value")) { Id = Configuration.GetValue("Roles:Consumer:id").ToString("D") }).Wait(); + rm.CreateAsync(new IdentityRole(Configuration.GetValue("Roles:Owner:value")) { Id = Configuration.GetValue("Roles:Owner:id").ToString("D") }).Wait(); + rm.CreateAsync(new IdentityRole(Configuration.GetValue("Roles:Producer:value")) { Id = Configuration.GetValue("Roles:Producer:id").ToString("D") }).Wait(); + rm.CreateAsync(new IdentityRole(Configuration.GetValue("Roles:Store:value")) { Id = Configuration.GetValue("Roles:Store:id").ToString("D") }).Wait(); + rm.CreateAsync(new IdentityRole(Configuration.GetValue("Roles:Anonymous:value")) { Id = Configuration.GetValue("Roles:Anonymous:id").ToString("D") }).Wait(); authContext.SaveChanges(); }