ensures the front office group existence

This commit is contained in:
2016-09-05 00:26:12 +02:00
parent 81925e3787
commit 0bbcb749a7

View File

@ -34,7 +34,6 @@ namespace Yavsc
public static string ConnectionString { get; private set; } public static string ConnectionString { get; private set; }
public static string Authority { get; private set; } public static string Authority { get; private set; }
public static string Audience { get; private set; } public static string Audience { get; private set; }
private static ILogger logger; private static ILogger logger;
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv) public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv)
{ {
@ -131,11 +130,8 @@ namespace Yavsc
.AddDbContext<ApplicationDbContext>(options => options.UseNpgsql(ConnectionString)) .AddDbContext<ApplicationDbContext>(options => options.UseNpgsql(ConnectionString))
; ;
ConfigureOAuthServices(services); ConfigureOAuthServices(services);
services.AddCors( services.AddCors(
/* /*
options => options =>
@ -203,11 +199,9 @@ namespace Yavsc
options.ResourcesPath = "Resources"; options.ResourcesPath = "Resources";
}).AddDataAnnotationsLocalization(); }).AddDataAnnotationsLocalization();
services.AddScoped<LanguageActionFilter>(); services.AddScoped<LanguageActionFilter>();
// Inject ticket formatting
// Inject ticket formatting
services.AddTransient(typeof(ISecureDataFormat<>), typeof(SecureDataFormat<>)); services.AddTransient(typeof(ISecureDataFormat<>), typeof(SecureDataFormat<>));
services.AddTransient<Microsoft.AspNet.Authentication.ISecureDataFormat<AuthenticationTicket>, Microsoft.AspNet.Authentication.SecureDataFormat<AuthenticationTicket>>(); services.AddTransient<Microsoft.AspNet.Authentication.ISecureDataFormat<AuthenticationTicket>, Microsoft.AspNet.Authentication.SecureDataFormat<AuthenticationTicket>>();
services.AddTransient<ISecureDataFormat<AuthenticationTicket>, TicketDataFormat>(); services.AddTransient<ISecureDataFormat<AuthenticationTicket>, TicketDataFormat>();
@ -282,6 +276,7 @@ namespace Yavsc
Task.Run(async ()=>{ Task.Run(async ()=>{
foreach (string roleName in new string[] {Constants.AdminGroupName, foreach (string roleName in new string[] {Constants.AdminGroupName,
Constants.StarGroupName, Constants.PerformerGroupName, Constants.StarGroupName, Constants.PerformerGroupName,
Constants.FrontOfficeGroupName,
Constants.StarHunterGroupName Constants.StarHunterGroupName
}) })
if (!await _roleManager.RoleExistsAsync(roleName)) if (!await _roleManager.RoleExistsAsync(roleName))