|
|
|
@ -87,53 +87,6 @@ namespace Ombi.Store.Context
|
|
|
|
|
|
|
|
|
|
public void Seed()
|
|
|
|
|
{
|
|
|
|
|
// VACUUM;
|
|
|
|
|
Database.ExecuteSqlCommand("VACUUM;");
|
|
|
|
|
|
|
|
|
|
// Make sure we have the roles
|
|
|
|
|
var newsletterRole = Roles.Where(x => x.Name == OmbiRoles.ReceivesNewsletter);
|
|
|
|
|
if (!newsletterRole.Any())
|
|
|
|
|
{
|
|
|
|
|
Roles.Add(new IdentityRole(OmbiRoles.ReceivesNewsletter)
|
|
|
|
|
{
|
|
|
|
|
NormalizedName = OmbiRoles.ReceivesNewsletter.ToUpper()
|
|
|
|
|
});
|
|
|
|
|
SaveChanges();
|
|
|
|
|
}
|
|
|
|
|
var requestMusicRole = Roles.Where(x => x.Name == OmbiRoles.RequestMusic);
|
|
|
|
|
if (!requestMusicRole.Any())
|
|
|
|
|
{
|
|
|
|
|
Roles.Add(new IdentityRole(OmbiRoles.RequestMusic)
|
|
|
|
|
{
|
|
|
|
|
NormalizedName = OmbiRoles.RequestMusic.ToUpper()
|
|
|
|
|
});
|
|
|
|
|
Roles.Add(new IdentityRole(OmbiRoles.AutoApproveMusic)
|
|
|
|
|
{
|
|
|
|
|
NormalizedName = OmbiRoles.AutoApproveMusic.ToUpper()
|
|
|
|
|
});
|
|
|
|
|
SaveChanges();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var manageOwnRequestsRole = Roles.Where(x => x.Name == OmbiRoles.ManageOwnRequests);
|
|
|
|
|
if (!manageOwnRequestsRole.Any())
|
|
|
|
|
{
|
|
|
|
|
Roles.Add(new IdentityRole(OmbiRoles.ManageOwnRequests)
|
|
|
|
|
{
|
|
|
|
|
NormalizedName = OmbiRoles.ManageOwnRequests.ToUpper()
|
|
|
|
|
});
|
|
|
|
|
SaveChanges();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var editCustomPage = Roles.Where(x => x.Name == OmbiRoles.EditCustomPage);
|
|
|
|
|
if (!editCustomPage.Any())
|
|
|
|
|
{
|
|
|
|
|
Roles.Add(new IdentityRole(OmbiRoles.EditCustomPage)
|
|
|
|
|
{
|
|
|
|
|
NormalizedName = OmbiRoles.EditCustomPage.ToUpper()
|
|
|
|
|
});
|
|
|
|
|
SaveChanges();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Make sure we have the API User
|
|
|
|
|
var apiUserExists = Users.Any(x => x.UserName.Equals("Api", StringComparison.CurrentCultureIgnoreCase));
|
|
|
|
|
if (!apiUserExists)
|
|
|
|
|