update functionallity enterprise storage

This commit is contained in:
vfedosevich 2013-11-05 17:54:40 +03:00
parent 922009d402
commit 8784e493d5
28 changed files with 10952 additions and 8121 deletions

View file

@ -100,7 +100,7 @@ namespace WebsitePanel.EnterpriseServer
public static ESPermission[] GetFolderPermission(int itemId, string folder)
{
return ConvertToESPermission(GetFolderWebDavRulesInternal(itemId, folder));
return ConvertToESPermission(itemId,GetFolderWebDavRulesInternal(itemId, folder));
}
public static bool CheckFileServicesInstallation(int serviceId)
@ -109,6 +109,11 @@ namespace WebsitePanel.EnterpriseServer
return es.CheckFileServicesInstallation();
}
public static SystemFile RenameFolder(int itemId, string oldFolder, string newFolder)
{
return RenameFolderInternal(itemId, oldFolder, newFolder);
}
#endregion
@ -161,6 +166,28 @@ namespace WebsitePanel.EnterpriseServer
}
}
protected static SystemFile RenameFolderInternal(int itemId, string oldFolder, string newFolder)
{
try
{
// load organization
Organization org = OrganizationController.GetOrganization(itemId);
if (org == null)
{
return null;
}
EnterpriseStorage es = GetEnterpriseStorage(GetEnterpriseStorageServiceID(org.PackageId));
return es.RenameFolder(org.OrganizationId, oldFolder, newFolder);
}
catch (Exception ex)
{
throw ex;
}
}
protected static ResultObject CreateFolderInternal(int itemId, string folderName)
{
ResultObject result = TaskManager.StartResultTask<ResultObject>("ENTERPRISE_STORAGE", "CREATE_FOLDER");
@ -240,7 +267,8 @@ namespace WebsitePanel.EnterpriseServer
if (org == null)
return null;
string accountTypes = string.Format("{0}, {1}", ((int)ExchangeAccountType.SecurityGroup), ((int)ExchangeAccountType.User));
string accountTypes = string.Format("{0}, {1}, {2}", ((int)ExchangeAccountType.SecurityGroup),
(int)ExchangeAccountType.DefaultSecurityGroup, ((int)ExchangeAccountType.User));
if (PackageController.GetPackageServiceId(org.PackageId, ResourceGroups.Exchange) != 0)
{
@ -257,25 +285,16 @@ namespace WebsitePanel.EnterpriseServer
foreach (ExchangeAccount tmpAccount in tmpAccounts.ToArray())
{
bool bSuccess = false;
if (tmpAccount.AccountType == ExchangeAccountType.SecurityGroup || tmpAccount.AccountType == ExchangeAccountType.SecurityGroup
? OrganizationController.GetSecurityGroupGeneralSettings(itemId, tmpAccount.AccountId) == null
: OrganizationController.GetSecurityGroupGeneralSettings(itemId, tmpAccount.AccountId) == null)
continue;
switch (tmpAccount.AccountType)
{
case ExchangeAccountType.SecurityGroup:
bSuccess = OrganizationController.GetSecurityGroupGeneralSettings(itemId, tmpAccount.AccountId) != null;
break;
default:
bSuccess = OrganizationController.GetUserGeneralSettings(itemId, tmpAccount.AccountId) != null;
break;
}
if (bSuccess)
{
exAccounts.Add(tmpAccount);
}
exAccounts.Add(tmpAccount);
}
return exAccounts;
}
protected static SystemFilesPaged GetEnterpriseFoldersPagedInternal(int itemId, string filterValue, string sortColumn,
@ -423,7 +442,7 @@ namespace WebsitePanel.EnterpriseServer
return rules.ToArray();
}
private static ESPermission[] ConvertToESPermission(WebDavFolderRule[] rules)
private static ESPermission[] ConvertToESPermission(int itemId, WebDavFolderRule[] rules)
{
var permissions = new List<ESPermission>();
@ -435,6 +454,31 @@ namespace WebsitePanel.EnterpriseServer
permission.IsGroup = rule.Roles.Any();
var orgObj = OrganizationController.GetAccountByAccountName(itemId, permission.Account);
if (orgObj == null)
continue;
if (permission.IsGroup)
{
var secGroupObj = OrganizationController.GetSecurityGroupGeneralSettings(itemId, orgObj.AccountId);
if (secGroupObj == null)
continue;
permission.DisplayName = secGroupObj.DisplayName;
}
else
{
var userObj = OrganizationController.GetUserGeneralSettings(itemId, orgObj.AccountId);
if (userObj == null)
continue;
permission.DisplayName = userObj.DisplayName;
}
if (rule.Read && !rule.Write)
{
permission.Access = "Read-Only";
@ -444,10 +488,12 @@ namespace WebsitePanel.EnterpriseServer
permission.Access = "Read-Write";
}
permissions.Add(permission);
}
return permissions.ToArray();
}
}
}