pull/2194/head
Jamie Rees 7 years ago
parent 0ce9fb2df9
commit a0dbd1c442

@ -32,14 +32,7 @@ namespace Ombi.Core.Engine.Interfaces
private OmbiUser _user;
protected async Task<OmbiUser> GetUser()
{
if (IsApiUser)
{
return new OmbiUser
{
UserName = Username,
};
}
return _user ?? (_user = await UserManager.Users.FirstOrDefaultAsync(x => x.UserName == Username));
return _user ?? (_user = await UserManager.Users.FirstOrDefaultAsync(x => x.UserName.Equals(Username, StringComparison.CurrentCultureIgnoreCase)));
}
protected async Task<string> UserAlias()
@ -49,10 +42,6 @@ namespace Ombi.Core.Engine.Interfaces
protected async Task<bool> IsInRole(string roleName)
{
if (IsApiUser && roleName != OmbiRoles.Disabled)
{
return true;
}
return await UserManager.IsInRoleAsync(await GetUser(), roleName);
}
@ -72,7 +61,5 @@ namespace Ombi.Core.Engine.Interfaces
var ruleResults = await Rules.StartSpecificRules(model, rule);
return ruleResults;
}
private bool IsApiUser => Username.Equals("Api", StringComparison.CurrentCultureIgnoreCase);
}
}

@ -123,7 +123,23 @@ namespace Ombi.Store.Context
{
NormalizedName = OmbiRoles.RecievesNewsletter.ToUpper()
});
SaveChanges();
}
// Make sure we have the API User
var apiUserExists = Users.Any(x => x.UserName.Equals("Api", StringComparison.CurrentCultureIgnoreCase));
if (!apiUserExists)
{
Users.Add(new OmbiUser
{
UserName = "Api",
UserType = UserType.SystemUser,
NormalizedUserName = "API",
});
SaveChanges();
}
//Check if templates exist
var templates = NotificationTemplates.ToList();

@ -29,6 +29,7 @@ namespace Ombi.Store.Entities
{
public enum UserType
{
SystemUser = 0,
LocalUser = 1,
PlexUser = 2,
EmbyUser = 3,

@ -213,7 +213,7 @@ namespace Ombi.Controllers
[PowerUser]
public async Task<IEnumerable<UserViewModel>> GetAllUsers()
{
var users = await UserManager.Users
var users = await UserManager.Users.Where(x => x.UserType != UserType.LocalUser)
.ToListAsync();
var model = new List<UserViewModel>();

@ -10,6 +10,7 @@
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"commandLineArgs": "-baseurl /testing",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"

Loading…
Cancel
Save