webdav portal Dependency resolver added
This commit is contained in:
parent
6e6b2abd8a
commit
2244ce5add
16 changed files with 210 additions and 35 deletions
|
@ -4,6 +4,7 @@ using System.Web.Routing;
|
|||
using Ninject;
|
||||
using WebsitePanel.WebDavPortal.DependencyInjection;
|
||||
using WebsitePanel.WebDavPortal.Models;
|
||||
using WebsitePanel.WebDavPortal.UI.Routes;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.CustomAttributes
|
||||
{
|
||||
|
@ -11,16 +12,19 @@ namespace WebsitePanel.WebDavPortal.CustomAttributes
|
|||
{
|
||||
protected override bool AuthorizeCore(HttpContextBase httpContext)
|
||||
{
|
||||
IKernel kernel = new StandardKernel(new NinjectSettings { AllowNullInjection = true }, new WebDavExplorerAppModule());
|
||||
var accountInfo = kernel.Get<AccountModel>();
|
||||
var accountInfo = DependencyResolver.Current.GetService<AccountModel>();
|
||||
|
||||
if (accountInfo == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext)
|
||||
{
|
||||
filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new { controller = "Account", action = "Login" }));
|
||||
filterContext.Result = new RedirectToRouteResult(AccountRouteNames.Login, null);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue