webdav portal auth via ad
This commit is contained in:
parent
05d9fddb5d
commit
7dd090820b
56 changed files with 927 additions and 281 deletions
|
@ -5,7 +5,7 @@ using System.Linq;
|
|||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Routing;
|
||||
using WebsitePanel.WebDavPortal.Config;
|
||||
using WebsitePanel.WebDav.Core;
|
||||
using WebsitePanel.WebDavPortal.DependencyInjection;
|
||||
using WebsitePanel.WebDavPortal.Models;
|
||||
|
||||
|
@ -13,33 +13,22 @@ namespace WebsitePanel.WebDavPortal.Constraints
|
|||
{
|
||||
public class OrganizationRouteConstraint : IRouteConstraint
|
||||
{
|
||||
private static string actualOrgName;
|
||||
|
||||
public bool Match(HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection)
|
||||
{
|
||||
var webdavManager = DependencyResolver.Current.GetService<IWebDavManager>();
|
||||
if (WspContext.User == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
object value;
|
||||
if (!values.TryGetValue(parameterName, out value))
|
||||
if (!values.TryGetValue(parameterName, out value))
|
||||
return false;
|
||||
|
||||
var str = value as string;
|
||||
if (str == null)
|
||||
return false;
|
||||
|
||||
if (routeDirection == RouteDirection.IncomingRequest)
|
||||
return actualOrgName == str;
|
||||
|
||||
if (httpContext.Session == null)
|
||||
if (str == null)
|
||||
return false;
|
||||
|
||||
if (webdavManager != null && str == webdavManager.OrganizationName)
|
||||
{
|
||||
actualOrgName = str;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return WspContext.User.OrganizationId == str;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue