bug fixes

This commit is contained in:
vfedosevich 2013-12-03 16:08:29 +03:00
parent c4cad794e4
commit 142d5f51e8
2 changed files with 71 additions and 47 deletions

View file

@ -66,12 +66,12 @@ namespace WebsitePanel.EnterpriseServer
public static ResultObject DeleteEnterpriseStorage(int packageId, int itemId) public static ResultObject DeleteEnterpriseStorage(int packageId, int itemId)
{ {
return DeleteEnterpriseStorageInternal(packageId,itemId); return DeleteEnterpriseStorageInternal(packageId, itemId);
} }
public static SystemFile[] GetFolders(int itemId) public static SystemFile[] GetFolders(int itemId)
{ {
return GetFoldersInternal(itemId); return GetFoldersInternal(itemId);
} }
public static SystemFile GetFolder(int itemId, string folderName) public static SystemFile GetFolder(int itemId, string folderName)
@ -102,7 +102,7 @@ namespace WebsitePanel.EnterpriseServer
public static ResultObject DeleteFolder(int itemId, string folderName) public static ResultObject DeleteFolder(int itemId, string folderName)
{ {
return DeleteFolderInternal(itemId, folderName); return DeleteFolderInternal(itemId, folderName);
} }
public static List<ExchangeAccount> SearchESAccounts(int itemId, string filterColumn, string filterValue, string sortColumn) public static List<ExchangeAccount> SearchESAccounts(int itemId, string filterColumn, string filterValue, string sortColumn)
{ {
@ -121,7 +121,7 @@ namespace WebsitePanel.EnterpriseServer
public static ESPermission[] GetFolderPermission(int itemId, string folder) public static ESPermission[] GetFolderPermission(int itemId, string folder)
{ {
return ConvertToESPermission(itemId,GetFolderWebDavRulesInternal(itemId, folder)); return ConvertToESPermission(itemId, GetFolderWebDavRulesInternal(itemId, folder));
} }
public static bool CheckFileServicesInstallation(int serviceId) public static bool CheckFileServicesInstallation(int serviceId)
@ -144,7 +144,7 @@ namespace WebsitePanel.EnterpriseServer
public static bool GetDirectoryBrowseEnabled(int itemId, string siteId) public static bool GetDirectoryBrowseEnabled(int itemId, string siteId)
{ {
return GetDirectoryBrowseEnabledInternal(itemId, siteId); return GetDirectoryBrowseEnabledInternal(itemId, siteId);
} }
public static void SetDirectoryBrowseEnabled(int itemId, string siteId, bool enabled) public static void SetDirectoryBrowseEnabled(int itemId, string siteId, bool enabled)
@ -164,10 +164,10 @@ namespace WebsitePanel.EnterpriseServer
public static int DeleteWebDavDirectory(int packageId, string site, string vdirName) public static int DeleteWebDavDirectory(int packageId, string site, string vdirName)
{ {
return DeleteWebDavDirectoryInternal(packageId, site, vdirName); return DeleteWebDavDirectoryInternal(packageId, site, vdirName);
} }
#endregion #endregion
#endregion #endregion
protected static bool CheckUsersDomainExistsInternal(int itemId) protected static bool CheckUsersDomainExistsInternal(int itemId)
@ -227,7 +227,7 @@ namespace WebsitePanel.EnterpriseServer
string usersDomain = esSesstings["UsersDomain"]; string usersDomain = esSesstings["UsersDomain"];
WebServer web = GetWebServer(packageId); WebServer web = GetWebServer(packageId);
if (!web.VirtualDirectoryExists(usersDomain, org.OrganizationId)) if (!web.VirtualDirectoryExists(usersDomain, org.OrganizationId))
{ {
checkResult = false; checkResult = false;
@ -347,7 +347,7 @@ namespace WebsitePanel.EnterpriseServer
Organization org = OrganizationController.GetOrganization(itemId); Organization org = OrganizationController.GetOrganization(itemId);
if (org == null) if (org == null)
{ {
return null; return new SystemFile[0];
} }
EnterpriseStorage es = GetEnterpriseStorage(GetEnterpriseStorageServiceID(org.PackageId)); EnterpriseStorage es = GetEnterpriseStorage(GetEnterpriseStorageServiceID(org.PackageId));
@ -418,6 +418,8 @@ namespace WebsitePanel.EnterpriseServer
EnterpriseStorage es = GetEnterpriseStorage(GetEnterpriseStorageServiceID(org.PackageId)); EnterpriseStorage es = GetEnterpriseStorage(GetEnterpriseStorageServiceID(org.PackageId));
es.CreateFolder(org.OrganizationId, folderName); es.CreateFolder(org.OrganizationId, folderName);
UpdateESHardQuota(org.PackageId);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -473,7 +475,7 @@ namespace WebsitePanel.EnterpriseServer
return result; return result;
} }
protected static List<ExchangeAccount> SearchESAccountsInternal(int itemId, string filterColumn, string filterValue, string sortColumn) protected static List<ExchangeAccount> SearchESAccountsInternal(int itemId, string filterColumn, string filterValue, string sortColumn)
{ {
// load organization // load organization
@ -547,7 +549,7 @@ namespace WebsitePanel.EnterpriseServer
return result; return result;
} }
#region WebDav #region WebDav
protected static int AddWebDavDirectoryInternal(int packageId, string site, string vdirName, string contentpath) protected static int AddWebDavDirectoryInternal(int packageId, string site, string vdirName, string contentpath)
@ -750,7 +752,7 @@ namespace WebsitePanel.EnterpriseServer
var account = ObjectUtils.FillObjectFromDataReader<ExchangeAccount>(DataProvider.GetExchangeAccountByAccountName(itemId, permission.Account)); var account = ObjectUtils.FillObjectFromDataReader<ExchangeAccount>(DataProvider.GetExchangeAccountByAccountName(itemId, permission.Account));
if (account.AccountType == ExchangeAccountType.SecurityGroup if (account.AccountType == ExchangeAccountType.SecurityGroup
|| account.AccountType == ExchangeAccountType.DefaultSecurityGroup) || account.AccountType == ExchangeAccountType.DefaultSecurityGroup)
{ {
rule.Roles.Add(permission.Account); rule.Roles.Add(permission.Account);
@ -833,6 +835,33 @@ namespace WebsitePanel.EnterpriseServer
} }
private static void UpdateESHardQuota(int packageId)
{
int esServiceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.EnterpriseStorage);
if (esServiceId != 0)
{
StringDictionary esSesstings = ServerController.GetServiceSettings(esServiceId);
string usersHome = esSesstings["UsersHome"];
string usersDomain = esSesstings["UsersDomain"];
string locationDrive = esSesstings["LocationDrive"];
string homePath = string.Format("{0}:\\{1}", locationDrive, usersHome);
int osId = PackageController.GetPackageServiceId(packageId, ResourceGroups.Os);
bool enableHardQuota = (esSesstings["enablehardquota"] != null)
? bool.Parse(esSesstings["enablehardquota"])
: false;
if (enableHardQuota && osId != 0 && OperatingSystemController.CheckFileServicesInstallation(osId))
{
FilesController.SetFolderQuota(packageId, usersHome, locationDrive, Quotas.ENTERPRISESTORAGE_DISKSTORAGESPACE);
}
}
}
/// <summary> /// <summary>
/// Get webserver (IIS) installed on server connected with packageId /// Get webserver (IIS) installed on server connected with packageId
/// </summary> /// </summary>
@ -842,15 +871,15 @@ namespace WebsitePanel.EnterpriseServer
{ {
try try
{ {
var group = ServerController.GetResourceGroupByName(ResourceGroups.Web); var webGroup = ServerController.GetResourceGroupByName(ResourceGroups.Web);
var webProviders = ServerController.GetProvidersByGroupID(webGroup.GroupId);
var esServiceInfo = ServerController.GetServiceInfo(GetEnterpriseStorageServiceID(packageId));
var webProviders = ServerController.GetProvidersByGroupID(group.GroupId); var serverId = esServiceInfo.ServerId;
var package = PackageController.GetPackage(packageId);
foreach (var webProvider in webProviders) foreach (var webProvider in webProviders)
{ {
BoolResult result = ServerController.IsInstalled(package.ServerId, webProvider.ProviderId); BoolResult result = ServerController.IsInstalled(serverId, webProvider.ProviderId);
if (result.IsSuccess && result.Value) if (result.IsSuccess && result.Value)
{ {
@ -867,7 +896,7 @@ namespace WebsitePanel.EnterpriseServer
//foreach (string key in serviceSettings.Keys) //foreach (string key in serviceSettings.Keys)
// cnfg.ProviderSettings.Settings[key] = serviceSettings[key]; // cnfg.ProviderSettings.Settings[key] = serviceSettings[key];
ServiceProviderProxy.ServerInit(web, cnfg, package.ServerId); ServiceProviderProxy.ServerInit(web, cnfg, serverId);
return web; return web;
} }

View file

@ -489,7 +489,7 @@ namespace WebsitePanel.EnterpriseServer
ServerController.AddServiceDNSRecords(packageId, ResourceGroups.VPSForPC, domain, ""); ServerController.AddServiceDNSRecords(packageId, ResourceGroups.VPSForPC, domain, "");
} }
} }
if (createInstantAlias) if (createInstantAlias)
ServerController.CreateDomainInstantAlias("", domainId); ServerController.CreateDomainInstantAlias("", domainId);
@ -783,7 +783,6 @@ namespace WebsitePanel.EnterpriseServer
// Update the Hard quota on home folder in case it was enabled and in case there was a change in disk space // Update the Hard quota on home folder in case it was enabled and in case there was a change in disk space
UpdatePackageHardQuota(package.PackageId); UpdatePackageHardQuota(package.PackageId);
UpdateESHardQuota(package.PackageId);
DataProvider.DistributePackageServices(SecurityContext.User.UserId, package.PackageId); DataProvider.DistributePackageServices(SecurityContext.User.UserId, package.PackageId);
} }
@ -981,7 +980,6 @@ namespace WebsitePanel.EnterpriseServer
// Added By Haya // Added By Haya
UpdatePackageHardQuota(packageId); UpdatePackageHardQuota(packageId);
UpdateESHardQuota(packageId);
// save package item // save package item
return AddPackageItem(homeFolder); return AddPackageItem(homeFolder);
@ -996,7 +994,7 @@ namespace WebsitePanel.EnterpriseServer
{ {
DataProvider.UpdatePackageBandwidthUpdate(packageId, updateDate); DataProvider.UpdatePackageBandwidthUpdate(packageId, updateDate);
} }
// This gets the system quota and updates the home folder with the value // This gets the system quota and updates the home folder with the value
public static void UpdatePackageHardQuota(int packageId) public static void UpdatePackageHardQuota(int packageId)
{ {
@ -1021,32 +1019,32 @@ namespace WebsitePanel.EnterpriseServer
} }
public static void UpdateESHardQuota(int packageId) //public static void UpdateESHardQuota(int packageId)
{ //{
int esServiceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.EnterpriseStorage); // int esServiceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.EnterpriseStorage);
if (esServiceId != 0) // if (esServiceId != 0)
{ // {
StringDictionary esSesstings = ServerController.GetServiceSettings(esServiceId); // StringDictionary esSesstings = ServerController.GetServiceSettings(esServiceId);
string usersHome = esSesstings["UsersHome"]; // string usersHome = esSesstings["UsersHome"];
string usersDomain = esSesstings["UsersDomain"]; // string usersDomain = esSesstings["UsersDomain"];
string locationDrive = esSesstings["LocationDrive"]; // string locationDrive = esSesstings["LocationDrive"];
string homePath = string.Format("{0}:\\{1}", locationDrive, usersHome); // string homePath = string.Format("{0}:\\{1}", locationDrive, usersHome);
int osId = PackageController.GetPackageServiceId(packageId, ResourceGroups.Os); // int osId = PackageController.GetPackageServiceId(packageId, ResourceGroups.Os);
bool enableHardQuota = (esSesstings["enablehardquota"] != null) // bool enableHardQuota = (esSesstings["enablehardquota"] != null)
? bool.Parse(esSesstings["enablehardquota"]) // ? bool.Parse(esSesstings["enablehardquota"])
: false; // : false;
if (enableHardQuota && osId != 0 && OperatingSystemController.CheckFileServicesInstallation(osId)) // if (enableHardQuota && osId != 0 && OperatingSystemController.CheckFileServicesInstallation(osId))
{ // {
FilesController.SetFolderQuota(packageId, usersHome, locationDrive, Quotas.ENTERPRISESTORAGE_DISKSTORAGESPACE); // FilesController.SetFolderQuota(packageId, usersHome, locationDrive, Quotas.ENTERPRISESTORAGE_DISKSTORAGESPACE);
} // }
} // }
} //}
#endregion #endregion
@ -1090,7 +1088,7 @@ namespace WebsitePanel.EnterpriseServer
if (result.Result < 0) if (result.Result < 0)
result.Result = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive result.Result = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive
| DemandAccount.IsResellerCSR); | DemandAccount.IsResellerCSR);
if (result.Result < 0) return result; if (result.Result < 0) return result;
int addonId = 0; int addonId = 0;
@ -1108,7 +1106,6 @@ namespace WebsitePanel.EnterpriseServer
// Update the Hard quota on home folder in case it was enabled and in case there was a change in disk space // Update the Hard quota on home folder in case it was enabled and in case there was a change in disk space
UpdatePackageHardQuota(addon.PackageId); UpdatePackageHardQuota(addon.PackageId);
UpdateESHardQuota(addon.PackageId);
return result; return result;
} }
@ -1138,7 +1135,6 @@ namespace WebsitePanel.EnterpriseServer
// Update the Hard quota on home folder in case it was enabled and in case there was a change in disk space // Update the Hard quota on home folder in case it was enabled and in case there was a change in disk space
UpdatePackageHardQuota(addon.PackageId); UpdatePackageHardQuota(addon.PackageId);
UpdateESHardQuota(addon.PackageId);
return result; return result;
} }
@ -1155,7 +1151,6 @@ namespace WebsitePanel.EnterpriseServer
// Update the Hard quota on home folder in case it was enabled and in case there was a change in disk space // Update the Hard quota on home folder in case it was enabled and in case there was a change in disk space
UpdatePackageHardQuota(packageId); UpdatePackageHardQuota(packageId);
UpdateESHardQuota(packageId);
return 0; return 0;
} }
@ -2107,7 +2102,7 @@ namespace WebsitePanel.EnterpriseServer
} }
items["Addons"] = addOns; items["Addons"] = addOns;
// package contexts // package contexts
Hashtable cntxs = new Hashtable(); Hashtable cntxs = new Hashtable();
foreach (PackageInfo package in packages) foreach (PackageInfo package in packages)