Skip to content

Commit

Permalink
Fix - S'assurer que les roles ont toujours le bon format en db
Browse files Browse the repository at this point in the history
  • Loading branch information
noelmugnier committed Nov 4, 2020
1 parent 3a9d69c commit 5ab3b13
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Sheaft.Identity/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -277,16 +277,16 @@ public void Configure(IApplicationBuilder app)
if (!authContext.Roles.Any())
{
var rm = serviceScope.ServiceProvider.GetService<RoleManager<IdentityRole>>();
rm.CreateAsync(new IdentityRole(Configuration.GetValue<string>("Roles:Admin:value")) { Id = Configuration.GetValue<string>("Roles:Admin:id") }).Wait();
rm.CreateAsync(new IdentityRole(Configuration.GetValue<string>("Roles:Support:value")) { Id = Configuration.GetValue<string>("Roles:Support:id") }).Wait();
rm.CreateAsync(new IdentityRole(Configuration.GetValue<string>("Roles:AppUser:value")) { Id = Configuration.GetValue<string>("Roles:AppUser:id") }).Wait();
rm.CreateAsync(new IdentityRole(Configuration.GetValue<string>("Roles:Admin:value")) { Id = Configuration.GetValue<Guid>("Roles:Admin:id").ToString("D") }).Wait();
rm.CreateAsync(new IdentityRole(Configuration.GetValue<string>("Roles:Support:value")) { Id = Configuration.GetValue<Guid>("Roles:Support:id").ToString("D") }).Wait();
rm.CreateAsync(new IdentityRole(Configuration.GetValue<string>("Roles:AppUser:value")) { Id = Configuration.GetValue<Guid>("Roles:AppUser:id").ToString("D") }).Wait();
//specific for sheaft
rm.CreateAsync(new IdentityRole(Configuration.GetValue<string>("Roles:User:value")) { Id = Configuration.GetValue<string>("Roles:User:id") }).Wait();
rm.CreateAsync(new IdentityRole(Configuration.GetValue<string>("Roles:Consumer:value")) { Id = Configuration.GetValue<string>("Roles:Consumer:id") }).Wait();
rm.CreateAsync(new IdentityRole(Configuration.GetValue<string>("Roles:Owner:value")) { Id = Configuration.GetValue<string>("Roles:Owner:id") }).Wait();
rm.CreateAsync(new IdentityRole(Configuration.GetValue<string>("Roles:Producer:value")) { Id = Configuration.GetValue<string>("Roles:Producer:id") }).Wait();
rm.CreateAsync(new IdentityRole(Configuration.GetValue<string>("Roles:Store:value")) { Id = Configuration.GetValue<string>("Roles:Store:id") }).Wait();
rm.CreateAsync(new IdentityRole(Configuration.GetValue<string>("Roles:Anonymous:value")) { Id = Configuration.GetValue<string>("Roles:Anonymous:id") }).Wait();
rm.CreateAsync(new IdentityRole(Configuration.GetValue<string>("Roles:User:value")) { Id = Configuration.GetValue<Guid>("Roles:User:id").ToString("D") }).Wait();
rm.CreateAsync(new IdentityRole(Configuration.GetValue<string>("Roles:Consumer:value")) { Id = Configuration.GetValue<Guid>("Roles:Consumer:id").ToString("D") }).Wait();
rm.CreateAsync(new IdentityRole(Configuration.GetValue<string>("Roles:Owner:value")) { Id = Configuration.GetValue<Guid>("Roles:Owner:id").ToString("D") }).Wait();
rm.CreateAsync(new IdentityRole(Configuration.GetValue<string>("Roles:Producer:value")) { Id = Configuration.GetValue<Guid>("Roles:Producer:id").ToString("D") }).Wait();
rm.CreateAsync(new IdentityRole(Configuration.GetValue<string>("Roles:Store:value")) { Id = Configuration.GetValue<Guid>("Roles:Store:id").ToString("D") }).Wait();
rm.CreateAsync(new IdentityRole(Configuration.GetValue<string>("Roles:Anonymous:value")) { Id = Configuration.GetValue<Guid>("Roles:Anonymous:id").ToString("D") }).Wait();

authContext.SaveChanges();
}
Expand Down

0 comments on commit 5ab3b13

Please sign in to comment.