web portal folder permission fix
This commit is contained in:
parent
833b7c1aa4
commit
5d37adf09b
7 changed files with 33 additions and 3 deletions
|
@ -61,6 +61,7 @@ namespace WebsitePanel.WebDavPortal.Controllers
|
||||||
Session[WebDavAppConfigManager.Instance.SessionKeys.ItemId] = exchangeAccount.ItemId;
|
Session[WebDavAppConfigManager.Instance.SessionKeys.ItemId] = exchangeAccount.ItemId;
|
||||||
|
|
||||||
model.Groups = ES.Services.Organizations.GetSecurityGroupsByMember(exchangeAccount.ItemId, exchangeAccount.AccountId);
|
model.Groups = ES.Services.Organizations.GetSecurityGroupsByMember(exchangeAccount.ItemId, exchangeAccount.AccountId);
|
||||||
|
model.DisplayName = exchangeAccount.DisplayName;
|
||||||
|
|
||||||
WebDavManager manager = null;
|
WebDavManager manager = null;
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,8 @@ namespace WebsitePanel.WebDavPortal
|
||||||
BundleConfig.RegisterBundles(BundleTable.Bundles);
|
BundleConfig.RegisterBundles(BundleTable.Bundles);
|
||||||
|
|
||||||
DependencyResolver.SetResolver(new NinjectDependecyResolver());
|
DependencyResolver.SetResolver(new NinjectDependecyResolver());
|
||||||
|
|
||||||
|
log4net.Config.XmlConfigurator.Configure();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void Application_Error(object sender, EventArgs e)
|
protected void Application_Error(object sender, EventArgs e)
|
||||||
|
|
|
@ -23,6 +23,8 @@ namespace WebsitePanel.WebDavPortal.Models
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string DisplayName { get; set; }
|
||||||
|
|
||||||
public IEnumerable<ExchangeAccount> Groups { get; set; }
|
public IEnumerable<ExchangeAccount> Groups { get; set; }
|
||||||
|
|
||||||
public string LdapError { get; set; }
|
public string LdapError { get; set; }
|
||||||
|
|
|
@ -12,13 +12,16 @@ using WebsitePanel.Providers.OS;
|
||||||
using Ninject;
|
using Ninject;
|
||||||
using WebsitePanel.WebDavPortal.DependencyInjection;
|
using WebsitePanel.WebDavPortal.DependencyInjection;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
|
using log4net;
|
||||||
|
|
||||||
namespace WebsitePanel.WebDavPortal.Models
|
namespace WebsitePanel.WebDavPortal.Models
|
||||||
{
|
{
|
||||||
public class WebDavManager : IWebDavManager
|
public class WebDavManager : IWebDavManager
|
||||||
{
|
{
|
||||||
private readonly WebDavSession _webDavSession = new WebDavSession();
|
private readonly WebDavSession _webDavSession = new WebDavSession();
|
||||||
|
|
||||||
private readonly AccountModel _accountModel;
|
private readonly AccountModel _accountModel;
|
||||||
|
private readonly ILog Log;
|
||||||
|
|
||||||
private IList<SystemFile> _rootFolders;
|
private IList<SystemFile> _rootFolders;
|
||||||
private int _itemId;
|
private int _itemId;
|
||||||
|
@ -40,6 +43,7 @@ namespace WebsitePanel.WebDavPortal.Models
|
||||||
public WebDavManager(NetworkCredential credential, int itemId)
|
public WebDavManager(NetworkCredential credential, int itemId)
|
||||||
{
|
{
|
||||||
_accountModel = DependencyResolver.Current.GetService<AccountModel>();
|
_accountModel = DependencyResolver.Current.GetService<AccountModel>();
|
||||||
|
Log = LogManager.GetLogger(this.GetType());
|
||||||
|
|
||||||
_webDavSession.Credentials = credential;
|
_webDavSession.Credentials = credential;
|
||||||
_itemId = itemId;
|
_itemId = itemId;
|
||||||
|
@ -132,13 +136,15 @@ namespace WebsitePanel.WebDavPortal.Models
|
||||||
private IList<SystemFile> ConnectToWebDavServer(AccountModel user)
|
private IList<SystemFile> ConnectToWebDavServer(AccountModel user)
|
||||||
{
|
{
|
||||||
var rootFolders = new List<SystemFile>();
|
var rootFolders = new List<SystemFile>();
|
||||||
|
|
||||||
foreach (var folder in ES.Services.EnterpriseStorage.GetEnterpriseFolders(_itemId))
|
foreach (var folder in ES.Services.EnterpriseStorage.GetEnterpriseFolders(_itemId))
|
||||||
{
|
{
|
||||||
var permissions = ES.Services.EnterpriseStorage.GetEnterpriseFolderPermissions(_itemId, folder.Name);
|
var permissions = ES.Services.EnterpriseStorage.GetEnterpriseFolderPermissions(_itemId, folder.Name);
|
||||||
|
|
||||||
foreach (var permission in permissions)
|
foreach (var permission in permissions)
|
||||||
{
|
{
|
||||||
if ((!permission.IsGroup && permission.DisplayName == user.UserName)
|
if ((!permission.IsGroup
|
||||||
|
&& (permission.DisplayName == user.UserName || permission.DisplayName == user.DisplayName))
|
||||||
|| (permission.IsGroup && user.Groups.Any(x=> x.DisplayName == permission.DisplayName)))
|
|| (permission.IsGroup && user.Groups.Any(x=> x.DisplayName == permission.DisplayName)))
|
||||||
{
|
{
|
||||||
rootFolders.Add(folder);
|
rootFolders.Add(folder);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!--
|
<!--
|
||||||
For more information on how to configure your ASP.NET application, please visit
|
For more information on how to configure your ASP.NET application, please visit
|
||||||
http://go.microsoft.com/fwlink/?LinkId=301880
|
http://go.microsoft.com/fwlink/?LinkId=301880
|
||||||
|
@ -6,7 +6,22 @@
|
||||||
<configuration>
|
<configuration>
|
||||||
<configSections>
|
<configSections>
|
||||||
<section name="webDavExplorerConfigurationSettings" type="WebsitePanel.WebDavPortal.WebConfigSections.WebDavExplorerConfigurationSettingsSection" allowLocation="true" allowDefinition="Everywhere" />
|
<section name="webDavExplorerConfigurationSettings" type="WebsitePanel.WebDavPortal.WebConfigSections.WebDavExplorerConfigurationSettingsSection" allowLocation="true" allowDefinition="Everywhere" />
|
||||||
|
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
|
||||||
</configSections>
|
</configSections>
|
||||||
|
<log4net>
|
||||||
|
<appender name="FileAppender" type="log4net.Appender.FileAppender">
|
||||||
|
<param name="File" value="Logs\log-debug.log" />
|
||||||
|
<param name="AppendToFile" value="true" />
|
||||||
|
<layout type="log4net.Layout.PatternLayout">
|
||||||
|
<param name="ConversionPattern" value="%d %-5p %c - %m%n" />
|
||||||
|
</layout>
|
||||||
|
</appender>
|
||||||
|
<root>
|
||||||
|
<level value="DEBUG" />
|
||||||
|
<appender-ref ref="FileAppender" />
|
||||||
|
</root>
|
||||||
|
</log4net>
|
||||||
|
|
||||||
<appSettings>
|
<appSettings>
|
||||||
<add key="webpages:Version" value="3.0.0.0"/>
|
<add key="webpages:Version" value="3.0.0.0"/>
|
||||||
<add key="webpages:Enabled" value="false"/>
|
<add key="webpages:Enabled" value="false"/>
|
||||||
|
|
|
@ -48,6 +48,9 @@
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll</HintPath>
|
<HintPath>..\packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="log4net">
|
||||||
|
<HintPath>..\packages\log4net.2.0.0\lib\net40-full\log4net.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<Reference Include="Microsoft.Web.Services3">
|
<Reference Include="Microsoft.Web.Services3">
|
||||||
<HintPath>..\..\Lib\Microsoft.Web.Services3.dll</HintPath>
|
<HintPath>..\..\Lib\Microsoft.Web.Services3.dll</HintPath>
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
<package id="bootstrap" version="3.3.0" targetFramework="net45" />
|
<package id="bootstrap" version="3.3.0" targetFramework="net45" />
|
||||||
<package id="jQuery" version="2.1.1" targetFramework="net45" />
|
<package id="jQuery" version="2.1.1" targetFramework="net45" />
|
||||||
<package id="jQuery.Validation" version="1.13.1" targetFramework="net45" />
|
<package id="jQuery.Validation" version="1.13.1" targetFramework="net45" />
|
||||||
|
<package id="log4net" version="2.0.0" targetFramework="net45" />
|
||||||
<package id="Microsoft.AspNet.Mvc" version="5.2.2" targetFramework="net45" />
|
<package id="Microsoft.AspNet.Mvc" version="5.2.2" targetFramework="net45" />
|
||||||
<package id="Microsoft.AspNet.Razor" version="3.2.2" targetFramework="net45" />
|
<package id="Microsoft.AspNet.Razor" version="3.2.2" targetFramework="net45" />
|
||||||
<package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net45" />
|
<package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net45" />
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue