From 8e2b4ac8f4f2a7e02d7053d0048f85b6eeea1119 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Sat, 3 Dec 2016 22:14:43 +0000 Subject: [PATCH] Fixed admin redirect issue --- PlexRequests.Core/SecurityExtensions.cs | 10 +++++----- PlexRequests.UI/NinjectModules/ConfigurationModule.cs | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/PlexRequests.Core/SecurityExtensions.cs b/PlexRequests.Core/SecurityExtensions.cs index d02b0d5e5..38972cf22 100644 --- a/PlexRequests.Core/SecurityExtensions.cs +++ b/PlexRequests.Core/SecurityExtensions.cs @@ -46,7 +46,7 @@ namespace PlexRequests.Core Linker = linker; PlexUsers = plexUsers; } - + private IUserRepository UserRepository { get; } private IResourceLinker Linker { get; } private IPlexUserRepository PlexUsers { get; } @@ -61,7 +61,7 @@ namespace PlexRequests.Core { realUser = true; } - + return realUser || plexUser; } @@ -131,7 +131,7 @@ namespace PlexRequests.Core /// Hook that returns an Unauthorized response if the user is not /// authenticated or does have the claims, null otherwise private Func DoesNotHavePermissions(int perm) - { + { return ForbiddenIfNot(ctx => { var permissions = GetPermissions(ctx.CurrentUser); @@ -142,7 +142,7 @@ namespace PlexRequests.Core public bool DoesNotHavePermissions(int perm, IUserIdentity currentUser) { - return DoesNotHavePermissions((Permissions) perm, currentUser); + return DoesNotHavePermissions((Permissions)perm, currentUser); } public bool DoesNotHavePermissions(Permissions perm, IUserIdentity currentUser) @@ -192,7 +192,7 @@ namespace PlexRequests.Core var r = response(context); return r.StatusCode == code - ? new RedirectResponse(url.ToString()) + ? new RedirectResponse($"{url.ToString()}?redirect={context.Request.Path}") : null; } public Response HasAnyPermissionsRedirect(NancyContext context, string routeName, HttpStatusCode code, params Permissions[] perm) diff --git a/PlexRequests.UI/NinjectModules/ConfigurationModule.cs b/PlexRequests.UI/NinjectModules/ConfigurationModule.cs index fee5ba0d9..b5a379184 100644 --- a/PlexRequests.UI/NinjectModules/ConfigurationModule.cs +++ b/PlexRequests.UI/NinjectModules/ConfigurationModule.cs @@ -26,7 +26,7 @@ #endregion using Mono.Data.Sqlite; using Nancy.Authentication.Forms; - +using Nancy.Linker; using Ninject.Modules; using PlexRequests.Core;