Split creators out of identity
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Hutopy.Domain.Constants;
|
||||
using Hutopy.Infrastructure.Identity;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@@ -24,7 +25,7 @@ public static class InitializerExtensions
|
||||
public class ApplicationDbContextInitializer(
|
||||
ILogger<ApplicationDbContextInitializer> logger,
|
||||
ApplicationDbContext context,
|
||||
RoleManager<IdentityRole> roleManager)
|
||||
RoleManager<ApplicationRole> roleManager)
|
||||
{
|
||||
public async Task InitialiseAsync()
|
||||
{
|
||||
@@ -54,13 +55,13 @@ public class ApplicationDbContextInitializer(
|
||||
|
||||
private async Task TrySeedAsync()
|
||||
{
|
||||
var administratorRole = new IdentityRole(Roles.Administrator);
|
||||
var administratorRole = new ApplicationRole(Roles.Administrator);
|
||||
if (roleManager.Roles.All(r => r.Name != administratorRole.Name))
|
||||
{
|
||||
await roleManager.CreateAsync(administratorRole);
|
||||
}
|
||||
|
||||
var roleCreator = new IdentityRole(Roles.Creator);
|
||||
var roleCreator = new ApplicationRole(Roles.Creator);
|
||||
if (roleManager.Roles.All(r => r.Name != roleCreator.Name))
|
||||
{
|
||||
await roleManager.CreateAsync(roleCreator);
|
||||
|
||||
Reference in New Issue
Block a user