Fixed admin redirect issue

This commit is contained in:
tidusjar 2016-12-03 22:14:43 +00:00
parent 5bd8e5f313
commit 8e2b4ac8f4
2 changed files with 6 additions and 6 deletions

View file

@ -46,7 +46,7 @@ namespace PlexRequests.Core
Linker = linker; Linker = linker;
PlexUsers = plexUsers; PlexUsers = plexUsers;
} }
private IUserRepository UserRepository { get; } private IUserRepository UserRepository { get; }
private IResourceLinker Linker { get; } private IResourceLinker Linker { get; }
private IPlexUserRepository PlexUsers { get; } private IPlexUserRepository PlexUsers { get; }
@ -61,7 +61,7 @@ namespace PlexRequests.Core
{ {
realUser = true; realUser = true;
} }
return realUser || plexUser; return realUser || plexUser;
} }
@ -131,7 +131,7 @@ namespace PlexRequests.Core
/// <returns>Hook that returns an Unauthorized response if the user is not /// <returns>Hook that returns an Unauthorized response if the user is not
/// authenticated or does have the claims, null otherwise</returns> /// authenticated or does have the claims, null otherwise</returns>
private Func<NancyContext, Response> DoesNotHavePermissions(int perm) private Func<NancyContext, Response> DoesNotHavePermissions(int perm)
{ {
return ForbiddenIfNot(ctx => return ForbiddenIfNot(ctx =>
{ {
var permissions = GetPermissions(ctx.CurrentUser); var permissions = GetPermissions(ctx.CurrentUser);
@ -142,7 +142,7 @@ namespace PlexRequests.Core
public bool DoesNotHavePermissions(int perm, IUserIdentity currentUser) public bool DoesNotHavePermissions(int perm, IUserIdentity currentUser)
{ {
return DoesNotHavePermissions((Permissions) perm, currentUser); return DoesNotHavePermissions((Permissions)perm, currentUser);
} }
public bool DoesNotHavePermissions(Permissions perm, IUserIdentity currentUser) public bool DoesNotHavePermissions(Permissions perm, IUserIdentity currentUser)
@ -192,7 +192,7 @@ namespace PlexRequests.Core
var r = response(context); var r = response(context);
return r.StatusCode == code return r.StatusCode == code
? new RedirectResponse(url.ToString()) ? new RedirectResponse($"{url.ToString()}?redirect={context.Request.Path}")
: null; : null;
} }
public Response HasAnyPermissionsRedirect(NancyContext context, string routeName, HttpStatusCode code, params Permissions[] perm) public Response HasAnyPermissionsRedirect(NancyContext context, string routeName, HttpStatusCode code, params Permissions[] perm)

View file

@ -26,7 +26,7 @@
#endregion #endregion
using Mono.Data.Sqlite; using Mono.Data.Sqlite;
using Nancy.Authentication.Forms; using Nancy.Authentication.Forms;
using Nancy.Linker;
using Ninject.Modules; using Ninject.Modules;
using PlexRequests.Core; using PlexRequests.Core;