pull/907/head
Jamie.Rees 8 years ago
parent 7f913de835
commit a9ebe041be

@ -47,21 +47,24 @@ namespace Ombi.Store.Repository
public UsersModel GetUser(string userGuid) public UsersModel GetUser(string userGuid)
{ {
var sql = @"SELECT * FROM Users var sql = @"SELECT * FROM Users
WHERE Userguid = @UserGuid"; WHERE Userguid = @UserGuid
COLLATE NOCASE";
return Db.QueryFirstOrDefault<UsersModel>(sql, new {UserGuid = userGuid}); return Db.QueryFirstOrDefault<UsersModel>(sql, new {UserGuid = userGuid});
} }
public UsersModel GetUserByUsername(string username) public UsersModel GetUserByUsername(string username)
{ {
var sql = @"SELECT * FROM Users var sql = @"SELECT * FROM Users
WHERE UserName = @UserName"; WHERE UserName = @UserName
COLLATE NOCASE";
return Db.QueryFirstOrDefault<UsersModel>(sql, new {UserName = username}); return Db.QueryFirstOrDefault<UsersModel>(sql, new {UserName = username});
} }
public async Task<UsersModel> GetUserAsync(string userguid) public async Task<UsersModel> GetUserAsync(string userguid)
{ {
var sql = @"SELECT * FROM Users var sql = @"SELECT * FROM Users
WHERE UserGuid = @UserGuid"; WHERE UserGuid = @UserGuid
COLLATE NOCASE";
return await Db.QueryFirstOrDefaultAsync<UsersModel>(sql, new {UserGuid = userguid}); return await Db.QueryFirstOrDefaultAsync<UsersModel>(sql, new {UserGuid = userguid});
} }

@ -565,7 +565,7 @@ namespace Ombi.UI.Modules
}; };
try try
{ {
if (ShouldAutoApprove(RequestType.Movie, settings, Username)) if (ShouldAutoApprove(RequestType.Movie))
{ {
model.Approved = true; model.Approved = true;
@ -885,7 +885,7 @@ namespace Ombi.UI.Modules
try try
{ {
if (ShouldAutoApprove(RequestType.TvShow, settings, Username)) if (ShouldAutoApprove(RequestType.TvShow))
{ {
model.Approved = true; model.Approved = true;
var s = await sonarrSettings; var s = await sonarrSettings;
@ -981,7 +981,7 @@ namespace Ombi.UI.Modules
private bool ShouldSendNotification(RequestType type, PlexRequestSettings prSettings) private bool ShouldSendNotification(RequestType type, PlexRequestSettings prSettings)
{ {
var sendNotification = ShouldAutoApprove(type, prSettings, Username) var sendNotification = ShouldAutoApprove(type)
? !prSettings.IgnoreNotifyForAutoApprovedRequests ? !prSettings.IgnoreNotifyForAutoApprovedRequests
: true; : true;
@ -1089,7 +1089,7 @@ namespace Ombi.UI.Modules
try try
{ {
if (ShouldAutoApprove(RequestType.Album, settings, Username)) if (ShouldAutoApprove(RequestType.Album))
{ {
model.Approved = true; model.Approved = true;
var hpSettings = HeadphonesService.GetSettings(); var hpSettings = HeadphonesService.GetSettings();
@ -1363,7 +1363,7 @@ namespace Ombi.UI.Modules
return diff; return diff;
} }
public bool ShouldAutoApprove(RequestType requestType, PlexRequestSettings prSettings, string username) public bool ShouldAutoApprove(RequestType requestType)
{ {
var admin = Security.HasPermissions(Context.CurrentUser, Permissions.Administrator); var admin = Security.HasPermissions(Context.CurrentUser, Permissions.Administrator);
// if the user is an admin, they go ahead and allow auto-approval // if the user is an admin, they go ahead and allow auto-approval

Loading…
Cancel
Save