using System; using Nancy; using Nancy.Security; using PlexRequests.Helpers.Permissions; namespace PlexRequests.Core { public interface ISecurityExtensions { Response AdminLoginRedirect(Permissions perm, NancyContext context); bool DoesNotHavePermissions(Permissions perm, IUserIdentity currentUser); bool DoesNotHavePermissions(int perm, IUserIdentity currentUser); Func ForbiddenIfNot(Func test); bool HasAnyPermissions(IUserIdentity user, params Permissions[] perm); bool HasPermissions(IUserIdentity user, Permissions perm); Response HasPermissionsRedirect(Permissions perm, NancyContext context, string routeName, HttpStatusCode code); Func HttpStatusCodeIfNot(HttpStatusCode statusCode, Func test); bool IsLoggedIn(NancyContext context); bool IsNormalUser(NancyContext context); bool IsPlexUser(NancyContext context); bool HasPermissions(string userName, Permissions perm); /// /// Gets the username this could be the alias! We should always use this method when getting the username /// /// The username. /// null if we cannot find a user string GetUsername(string username); } }