web portal es tab view added

This commit is contained in:
vfedosevich 2015-03-02 02:11:38 -08:00
parent c78570eb11
commit 6bf818f1d8
35 changed files with 2592 additions and 116 deletions

View file

@ -45,6 +45,16 @@ namespace WebsitePanel.WebDav.Core.Config.Entities
}
}
public string OwaEditFoldersSessionKey
{
get
{
SessionKeysElement sessionKey =
_sessionKeys.FirstOrDefault(x => x.Key == SessionKeysElement.OwaEditFoldersSessionKey);
return sessionKey != null ? sessionKey.Value : null;
}
}
public string WebDavRootFoldersPermissions
{
get

View file

@ -14,6 +14,7 @@ namespace WebsitePanel.WebDav.Core.Config.WebConfigSections
public const string WebDavRootFolderPermissionsKey = "WebDavRootFolderPermissionsKey";
public const string ResourseRenderCountKey = "ResourseRenderCountSessionKey";
public const string ItemIdSessionKey = "ItemId";
public const string OwaEditFoldersSessionKey = "OwaEditFoldersSession";
[ConfigurationProperty(KeyKey, IsKey = true, IsRequired = true)]
public string Key

View file

@ -34,7 +34,9 @@ namespace WebsitePanel.WebDav.Core.Owa
{
var resource = _webDavManager.GetResource(path);
var readOnly = _webDavAuthorizationService.GetPermissions(WspContext.User, path).HasFlag(WebDavPermissions.Write) == false;
var permissions = _webDavAuthorizationService.GetPermissions(WspContext.User, path);
var readOnly = permissions.HasFlag(WebDavPermissions.Write) == false || permissions.HasFlag(WebDavPermissions.OwaEdit) == false;
var cFileInfo = new CheckFileInfo
{

View file

@ -8,6 +8,8 @@ namespace WebsitePanel.WebDav.Core.Security.Authorization.Enums
Empty = 0,
None = 1,
Read = 2,
Write = 4
Write = 4,
OwaRead = 8,
OwaEdit = 16
}
}

View file

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Cobalt;
using WebsitePanel.EnterpriseServer.Base.HostedSolution;
using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.WebDav.Core.Config;
@ -54,6 +55,17 @@ namespace WebsitePanel.WebDav.Core.Security.Authorization
}
}
var owaEditFolders = GetOwaFoldersWithEditPermission(principal);
if (owaEditFolders.Contains(rootFolder))
{
resultPermissions |= WebDavPermissions.OwaEdit;
}
else
{
resultPermissions |= WebDavPermissions.OwaRead;
}
return resultPermissions;
}
@ -105,5 +117,41 @@ namespace WebsitePanel.WebDav.Core.Security.Authorization
return groups ?? new ExchangeAccount[0];
}
private IEnumerable<string> GetOwaFoldersWithEditPermission(WspPrincipal principal)
{
var folders = HttpContext.Current.Session != null ? HttpContext.Current.Session[WebDavAppConfigManager.Instance.SessionKeys.OwaEditFoldersSessionKey] as IEnumerable<string> : null;
if (folders != null)
{
return folders;
}
var accountsIds = new List<int>();
accountsIds.Add(principal.AccountId);
var groups = GetUserSecurityGroups(principal);
accountsIds.AddRange(groups.Select(x=>x.AccountId));
try
{
folders = WspContext.Services.EnterpriseStorage.GetUserEnterpriseFolderWithOwaEditPermission(principal.ItemId, accountsIds.ToArray());
}
catch (Exception)
{
//TODO remove try catch when es &portal will be updated
return new List<string>();
}
if (HttpContext.Current.Session != null)
{
HttpContext.Current.Session[WebDavAppConfigManager.Instance.SessionKeys.OwaEditFoldersSessionKey] = folders;
}
return folders;
}
}
}