Merge Wsp2013 Fork into Main
This commit is contained in:
commit
f2032d5716
84 changed files with 14799 additions and 12456 deletions
|
@ -31,6 +31,7 @@ using System.IO;
|
|||
using System.Text;
|
||||
using System.Security.Cryptography;
|
||||
using System.Configuration;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace WebsitePanel.EnterpriseServer
|
||||
{
|
||||
|
@ -39,9 +40,32 @@ namespace WebsitePanel.EnterpriseServer
|
|||
/// </summary>
|
||||
public class CryptoUtils
|
||||
{
|
||||
static string EnterpriseServerRegistryPath = "SOFTWARE\\WebsitePanel\\EnterpriseServer";
|
||||
|
||||
public static string CryptoKey
|
||||
{
|
||||
get { return ConfigurationManager.AppSettings["WebsitePanel.CryptoKey"]; }
|
||||
get
|
||||
{
|
||||
string Key = ConfigurationManager.AppSettings["WebsitePanel.AltCryptoKey"];
|
||||
string value = string.Empty;
|
||||
|
||||
if (!string.IsNullOrEmpty(Key))
|
||||
{
|
||||
RegistryKey root = Registry.LocalMachine;
|
||||
RegistryKey rk = root.OpenSubKey(EnterpriseServerRegistryPath);
|
||||
if (rk != null)
|
||||
{
|
||||
value = (string)rk.GetValue(Key, null);
|
||||
rk.Close();
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(value))
|
||||
return value;
|
||||
else
|
||||
return ConfigurationManager.AppSettings["WebsitePanel.CryptoKey"];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static bool EncryptionEnabled
|
||||
|
|
|
@ -34,6 +34,7 @@ using System.Text.RegularExpressions;
|
|||
using WebsitePanel.Providers.HostedSolution;
|
||||
using Microsoft.ApplicationBlocks.Data;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace WebsitePanel.EnterpriseServer
|
||||
{
|
||||
|
@ -42,11 +43,31 @@ namespace WebsitePanel.EnterpriseServer
|
|||
/// </summary>
|
||||
public static class DataProvider
|
||||
{
|
||||
|
||||
static string EnterpriseServerRegistryPath = "SOFTWARE\\WebsitePanel\\EnterpriseServer";
|
||||
|
||||
private static string ConnectionString
|
||||
{
|
||||
get
|
||||
{
|
||||
return ConfigurationManager.ConnectionStrings["EnterpriseServer"].ConnectionString;
|
||||
string ConnectionKey = ConfigurationManager.AppSettings["WebsitePanel.AltConnectionString"];
|
||||
string value = string.Empty;
|
||||
|
||||
if (!string.IsNullOrEmpty(ConnectionKey))
|
||||
{
|
||||
RegistryKey root = Registry.LocalMachine;
|
||||
RegistryKey rk = root.OpenSubKey(EnterpriseServerRegistryPath);
|
||||
if (rk != null)
|
||||
{
|
||||
value = (string)rk.GetValue(ConnectionKey, null);
|
||||
rk.Close();
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(value))
|
||||
return value;
|
||||
else
|
||||
return ConfigurationManager.ConnectionStrings["EnterpriseServer"].ConnectionString;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2512,7 +2533,8 @@ namespace WebsitePanel.EnterpriseServer
|
|||
#region Exchange Mailbox Plans
|
||||
public static int AddExchangeMailboxPlan(int itemID, string mailboxPlan, bool enableActiveSync, bool enableIMAP, bool enableMAPI, bool enableOWA, bool enablePOP,
|
||||
bool isDefault, int issueWarningPct, int keepDeletedItemsDays, int mailboxSizeMB, int maxReceiveMessageSizeKB, int maxRecipients,
|
||||
int maxSendMessageSizeKB, int prohibitSendPct, int prohibitSendReceivePct, bool hideFromAddressBook, int mailboxPlanType)
|
||||
int maxSendMessageSizeKB, int prohibitSendPct, int prohibitSendReceivePct, bool hideFromAddressBook, int mailboxPlanType,
|
||||
bool enabledLitigationHold, long recoverabelItemsSpace, long recoverabelItemsWarning)
|
||||
{
|
||||
SqlParameter outParam = new SqlParameter("@MailboxPlanId", SqlDbType.Int);
|
||||
outParam.Direction = ParameterDirection.Output;
|
||||
|
@ -2539,7 +2561,10 @@ namespace WebsitePanel.EnterpriseServer
|
|||
new SqlParameter("@ProhibitSendPct", prohibitSendPct),
|
||||
new SqlParameter("@ProhibitSendReceivePct", prohibitSendReceivePct),
|
||||
new SqlParameter("@HideFromAddressBook", hideFromAddressBook),
|
||||
new SqlParameter("@MailboxPlanType", mailboxPlanType)
|
||||
new SqlParameter("@MailboxPlanType", mailboxPlanType),
|
||||
new SqlParameter("@AllowLitigationHold",enabledLitigationHold),
|
||||
new SqlParameter("@RecoverableItemsWarningPct", recoverabelItemsSpace),
|
||||
new SqlParameter("@RecoverableItemsSpace",recoverabelItemsWarning)
|
||||
);
|
||||
|
||||
return Convert.ToInt32(outParam.Value);
|
||||
|
@ -2549,7 +2574,8 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
public static void UpdateExchangeMailboxPlan(int mailboxPlanID, string mailboxPlan, bool enableActiveSync, bool enableIMAP, bool enableMAPI, bool enableOWA, bool enablePOP,
|
||||
bool isDefault, int issueWarningPct, int keepDeletedItemsDays, int mailboxSizeMB, int maxReceiveMessageSizeKB, int maxRecipients,
|
||||
int maxSendMessageSizeKB, int prohibitSendPct, int prohibitSendReceivePct, bool hideFromAddressBook, int mailboxPlanType)
|
||||
int maxSendMessageSizeKB, int prohibitSendPct, int prohibitSendReceivePct, bool hideFromAddressBook, int mailboxPlanType,
|
||||
bool enabledLitigationHold, long recoverabelItemsSpace, long recoverabelItemsWarning)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
|
@ -2572,7 +2598,10 @@ namespace WebsitePanel.EnterpriseServer
|
|||
new SqlParameter("@ProhibitSendPct", prohibitSendPct),
|
||||
new SqlParameter("@ProhibitSendReceivePct", prohibitSendReceivePct),
|
||||
new SqlParameter("@HideFromAddressBook", hideFromAddressBook),
|
||||
new SqlParameter("@MailboxPlanType", mailboxPlanType)
|
||||
new SqlParameter("@MailboxPlanType", mailboxPlanType),
|
||||
new SqlParameter("@AllowLitigationHold", enabledLitigationHold),
|
||||
new SqlParameter("@RecoverableItemsWarningPct", recoverabelItemsSpace),
|
||||
new SqlParameter("@RecoverableItemsSpace", recoverabelItemsWarning)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -1709,6 +1709,25 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return BusinessErrorCodes.ERROR_EXCHANGE_STORAGE_QUOTAS_EXCEED_HOST_VALUES;
|
||||
}
|
||||
|
||||
int maxRecoverableItemsSpace = -1;
|
||||
int quotaRecoverableItemsUsed = 0;
|
||||
if (cntx.Quotas.ContainsKey(Quotas.EXCHANGE2007_RECOVERABLEITEMSSPACE)
|
||||
&& cntx.Quotas[Quotas.EXCHANGE2007_RECOVERABLEITEMSSPACE].QuotaAllocatedValue > 0)
|
||||
{
|
||||
maxRecoverableItemsSpace = cntx.Quotas[Quotas.EXCHANGE2007_RECOVERABLEITEMSSPACE].QuotaAllocatedValue;
|
||||
quotaRecoverableItemsUsed = cntx.Quotas[Quotas.EXCHANGE2007_RECOVERABLEITEMSSPACE].QuotaUsedValue;
|
||||
}
|
||||
|
||||
if (maxRecoverableItemsSpace != -1)
|
||||
{
|
||||
if (plan.RecoverableItemsSpace == -1)
|
||||
return BusinessErrorCodes.ERROR_EXCHANGE_STORAGE_QUOTAS_EXCEED_HOST_VALUES;
|
||||
|
||||
if ((quotaRecoverableItemsUsed + plan.RecoverableItemsSpace) > (maxRecoverableItemsSpace))
|
||||
return BusinessErrorCodes.ERROR_EXCHANGE_STORAGE_QUOTAS_EXCEED_HOST_VALUES;
|
||||
}
|
||||
|
||||
|
||||
//GetServiceSettings
|
||||
StringDictionary primSettings = ServerController.GetServiceSettings(exchangeServiceId);
|
||||
|
||||
|
@ -1729,7 +1748,10 @@ namespace WebsitePanel.EnterpriseServer
|
|||
plan.MaxSendMessageSizeKB,
|
||||
plan.MaxReceiveMessageSizeKB,
|
||||
plan.HideFromAddressBook,
|
||||
Convert.ToBoolean(cntx.Quotas[Quotas.EXCHANGE2007_ISCONSUMER].QuotaAllocatedValue));
|
||||
Convert.ToBoolean(cntx.Quotas[Quotas.EXCHANGE2007_ISCONSUMER].QuotaAllocatedValue),
|
||||
plan.AllowLitigationHold,
|
||||
plan.RecoverableItemsSpace != -1 ? (plan.RecoverableItemsSpace * 1024) : -1,
|
||||
plan.RecoverableItemsSpace != -1 ? (((long)plan.RecoverableItemsWarningPct * (long)plan.RecoverableItemsSpace * 1024) / 100) : -1);
|
||||
|
||||
MailboxManagerActions pmmActions = MailboxManagerActions.GeneralSettings
|
||||
| MailboxManagerActions.MailFlowSettings
|
||||
|
@ -2653,6 +2675,24 @@ namespace WebsitePanel.EnterpriseServer
|
|||
}
|
||||
}
|
||||
|
||||
int maxRecoverableItemsSpace = -1;
|
||||
int quotaRecoverableItemsUsed = 0;
|
||||
if (cntx.Quotas.ContainsKey(Quotas.EXCHANGE2007_RECOVERABLEITEMSSPACE)
|
||||
&& cntx.Quotas[Quotas.EXCHANGE2007_RECOVERABLEITEMSSPACE].QuotaAllocatedValue > 0)
|
||||
{
|
||||
maxRecoverableItemsSpace = cntx.Quotas[Quotas.EXCHANGE2007_RECOVERABLEITEMSSPACE].QuotaAllocatedValue;
|
||||
quotaRecoverableItemsUsed = cntx.Quotas[Quotas.EXCHANGE2007_RECOVERABLEITEMSSPACE].QuotaUsedValue;
|
||||
}
|
||||
|
||||
if (maxRecoverableItemsSpace != -1)
|
||||
{
|
||||
if (plan.RecoverableItemsSpace == -1)
|
||||
return BusinessErrorCodes.ERROR_EXCHANGE_STORAGE_QUOTAS_EXCEED_HOST_VALUES;
|
||||
|
||||
if ((quotaRecoverableItemsUsed + plan.RecoverableItemsSpace) > (maxRecoverableItemsSpace))
|
||||
return BusinessErrorCodes.ERROR_EXCHANGE_STORAGE_QUOTAS_EXCEED_HOST_VALUES;
|
||||
}
|
||||
|
||||
// get mailbox settings
|
||||
int exchangeServiceId = GetExchangeServiceID(org.PackageId);
|
||||
ExchangeServer exchange = GetExchangeServer(exchangeServiceId, org.ServiceId);
|
||||
|
@ -2671,7 +2711,10 @@ namespace WebsitePanel.EnterpriseServer
|
|||
plan.KeepDeletedItemsDays,
|
||||
plan.MaxRecipients,
|
||||
plan.MaxSendMessageSizeKB,
|
||||
plan.MaxReceiveMessageSizeKB);
|
||||
plan.MaxReceiveMessageSizeKB,
|
||||
plan.AllowLitigationHold,
|
||||
plan.RecoverableItemsSpace != -1 ? (plan.RecoverableItemsSpace * 1024) : -1,
|
||||
plan.RecoverableItemsSpace != -1 ? (((long)plan.RecoverableItemsWarningPct * (long)plan.RecoverableItemsSpace * 1024) / 100) : -1);
|
||||
|
||||
DataProvider.SetExchangeAccountMailboxPlan(accountId, mailboxPlanId);
|
||||
|
||||
|
@ -2835,11 +2878,18 @@ namespace WebsitePanel.EnterpriseServer
|
|||
mailboxPlan.MaxRecipients = cntx.Quotas[Quotas.EXCHANGE2007_MAXRECIPIENTS].QuotaAllocatedValue;
|
||||
|
||||
if (Convert.ToBoolean(cntx.Quotas[Quotas.EXCHANGE2007_ISCONSUMER].QuotaAllocatedValue)) mailboxPlan.HideFromAddressBook = true;
|
||||
|
||||
mailboxPlan.AllowLitigationHold = mailboxPlan.AllowLitigationHold & Convert.ToBoolean(cntx.Quotas[Quotas.EXCHANGE2007_ALLOWLITIGATIONHOLD].QuotaAllocatedValue);
|
||||
|
||||
if (cntx.Quotas[Quotas.EXCHANGE2007_RECOVERABLEITEMSSPACE].QuotaAllocatedValue != -1)
|
||||
if (mailboxPlan.RecoverableItemsSpace > cntx.Quotas[Quotas.EXCHANGE2007_RECOVERABLEITEMSSPACE].QuotaAllocatedValue)
|
||||
mailboxPlan.RecoverableItemsSpace = cntx.Quotas[Quotas.EXCHANGE2007_RECOVERABLEITEMSSPACE].QuotaAllocatedValue;
|
||||
}
|
||||
|
||||
return DataProvider.AddExchangeMailboxPlan(itemID, mailboxPlan.MailboxPlan, mailboxPlan.EnableActiveSync, mailboxPlan.EnableIMAP, mailboxPlan.EnableMAPI, mailboxPlan.EnableOWA, mailboxPlan.EnablePOP,
|
||||
mailboxPlan.IsDefault, mailboxPlan.IssueWarningPct, mailboxPlan.KeepDeletedItemsDays, mailboxPlan.MailboxSizeMB, mailboxPlan.MaxReceiveMessageSizeKB, mailboxPlan.MaxRecipients,
|
||||
mailboxPlan.MaxSendMessageSizeKB, mailboxPlan.ProhibitSendPct, mailboxPlan.ProhibitSendReceivePct, mailboxPlan.HideFromAddressBook, mailboxPlan.MailboxPlanType);
|
||||
mailboxPlan.MaxSendMessageSizeKB, mailboxPlan.ProhibitSendPct, mailboxPlan.ProhibitSendReceivePct, mailboxPlan.HideFromAddressBook, mailboxPlan.MailboxPlanType,
|
||||
mailboxPlan.AllowLitigationHold, mailboxPlan.RecoverableItemsSpace, mailboxPlan.RecoverableItemsWarningPct);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -2897,11 +2947,19 @@ namespace WebsitePanel.EnterpriseServer
|
|||
mailboxPlan.MaxRecipients = cntx.Quotas[Quotas.EXCHANGE2007_MAXRECIPIENTS].QuotaAllocatedValue;
|
||||
|
||||
if (Convert.ToBoolean(cntx.Quotas[Quotas.EXCHANGE2007_ISCONSUMER].QuotaAllocatedValue)) mailboxPlan.HideFromAddressBook = true;
|
||||
|
||||
mailboxPlan.AllowLitigationHold = mailboxPlan.AllowLitigationHold & Convert.ToBoolean(cntx.Quotas[Quotas.EXCHANGE2007_ALLOWLITIGATIONHOLD].QuotaAllocatedValue);
|
||||
|
||||
if (cntx.Quotas[Quotas.EXCHANGE2007_RECOVERABLEITEMSSPACE].QuotaAllocatedValue != -1)
|
||||
if (mailboxPlan.RecoverableItemsSpace > cntx.Quotas[Quotas.EXCHANGE2007_RECOVERABLEITEMSSPACE].QuotaAllocatedValue)
|
||||
mailboxPlan.RecoverableItemsSpace = cntx.Quotas[Quotas.EXCHANGE2007_RECOVERABLEITEMSSPACE].QuotaAllocatedValue;
|
||||
|
||||
}
|
||||
|
||||
DataProvider.UpdateExchangeMailboxPlan(mailboxPlan.MailboxPlanId, mailboxPlan.MailboxPlan, mailboxPlan.EnableActiveSync, mailboxPlan.EnableIMAP, mailboxPlan.EnableMAPI, mailboxPlan.EnableOWA, mailboxPlan.EnablePOP,
|
||||
mailboxPlan.IsDefault, mailboxPlan.IssueWarningPct, mailboxPlan.KeepDeletedItemsDays, mailboxPlan.MailboxSizeMB, mailboxPlan.MaxReceiveMessageSizeKB, mailboxPlan.MaxRecipients,
|
||||
mailboxPlan.MaxSendMessageSizeKB, mailboxPlan.ProhibitSendPct, mailboxPlan.ProhibitSendReceivePct, mailboxPlan.HideFromAddressBook, mailboxPlan.MailboxPlanType);
|
||||
mailboxPlan.MaxSendMessageSizeKB, mailboxPlan.ProhibitSendPct, mailboxPlan.ProhibitSendReceivePct, mailboxPlan.HideFromAddressBook, mailboxPlan.MailboxPlanType,
|
||||
mailboxPlan.AllowLitigationHold, mailboxPlan.RecoverableItemsSpace, mailboxPlan.RecoverableItemsWarningPct);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
@ -912,5 +912,163 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
return users.ToArray();
|
||||
}
|
||||
|
||||
public static int SetFolderQuota(int packageId, string path, string driveName)
|
||||
{
|
||||
|
||||
// check account
|
||||
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
||||
if (accountCheck < 0) return accountCheck;
|
||||
|
||||
// check package
|
||||
int packageCheck = SecurityContext.CheckPackage(packageId, DemandPackage.IsActive);
|
||||
if (packageCheck < 0) return packageCheck;
|
||||
|
||||
// place log record
|
||||
TaskManager.StartTask("FILES", "SET_QUOTA_ON_FOLDER", path);
|
||||
TaskManager.ItemId = packageId;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
// disk space quota
|
||||
// This gets all the disk space allocated for a specific customer
|
||||
// It includes the package Add Ons * Quatity + Hosting Plan System disk space value.
|
||||
QuotaValueInfo diskSpaceQuota = PackageController.GetPackageQuota(packageId, Quotas.OS_DISKSPACE);
|
||||
|
||||
|
||||
#region figure Quota Unit
|
||||
|
||||
// Quota Unit
|
||||
string unit = String.Empty;
|
||||
if (diskSpaceQuota.QuotaDescription.ToLower().Contains("gb"))
|
||||
unit = "GB";
|
||||
else if (diskSpaceQuota.QuotaDescription.ToLower().Contains("mb"))
|
||||
unit = "MB";
|
||||
else
|
||||
unit = "KB";
|
||||
|
||||
#endregion
|
||||
|
||||
OS.OperatingSystem os = GetOS(packageId);
|
||||
|
||||
os.SetQuotaLimitOnFolder(path, driveName, diskSpaceQuota.QuotaAllocatedValue.ToString() + unit, 0, String.Empty, String.Empty);
|
||||
|
||||
return 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//Log and return a generic error rather than throwing an exception
|
||||
TaskManager.WriteError(ex);
|
||||
return BusinessErrorCodes.ERROR_FILE_GENERIC_LOGGED;
|
||||
}
|
||||
finally
|
||||
{
|
||||
TaskManager.CompleteTask();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static int ApplyEnableHardQuotaFeature(int packageId)
|
||||
{
|
||||
if (SecurityContext.CheckAccount(DemandAccount.IsActive | DemandAccount.IsAdmin | DemandAccount.NotDemo) != 0)
|
||||
throw new Exception("This method could be called by serveradmin only.");
|
||||
|
||||
// place log record
|
||||
TaskManager.StartTask("FILES", "APPLY_ENABLEHARDQUOTAFEATURE");
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
// request OS service
|
||||
//int osId = PackageController.GetPackageServiceId(packageId, ResourceGroups.Os);
|
||||
//if (osId == 0)
|
||||
// return -1;
|
||||
|
||||
//OS.OperatingSystem os = new OS.OperatingSystem();
|
||||
//ServiceProviderProxy.Init(os, osId);
|
||||
|
||||
////Get operating system settings
|
||||
// StringDictionary osSesstings = ServerController.GetServiceSettings(osId);
|
||||
// bool diskQuotaEnabled = (osSesstings["EnableHardQuota"] != null) ? bool.Parse(osSesstings["EnableHardQuota"]) : false;
|
||||
//string driveName = osSesstings["LocationDrive"];
|
||||
|
||||
//if (!diskQuotaEnabled)
|
||||
// return -1;
|
||||
|
||||
|
||||
List<PackageInfo> allPackages = PackageController.GetPackagePackages(packageId, true);
|
||||
|
||||
foreach (PackageInfo childPackage in allPackages)
|
||||
{
|
||||
// request OS service
|
||||
int osId = PackageController.GetPackageServiceId(childPackage.PackageId, ResourceGroups.Os);
|
||||
if (osId == 0)
|
||||
continue;
|
||||
|
||||
OS.OperatingSystem os = new OS.OperatingSystem();
|
||||
ServiceProviderProxy.Init(os, osId);
|
||||
|
||||
//Get operating system settings
|
||||
StringDictionary osSesstings = ServerController.GetServiceSettings(osId);
|
||||
string driveName = osSesstings["LocationDrive"];
|
||||
|
||||
if (String.IsNullOrEmpty(driveName))
|
||||
continue;
|
||||
|
||||
string homeFolder = FilesController.GetHomeFolder(childPackage.PackageId);
|
||||
FilesController.SetFolderQuota(childPackage.PackageId, homeFolder, driveName);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw TaskManager.WriteError(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
TaskManager.CompleteTask();
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
public static int DeleteDirectoryRecursive(int packageId, string rootPath)
|
||||
{
|
||||
|
||||
// check account
|
||||
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
||||
if (accountCheck < 0) return accountCheck;
|
||||
|
||||
// check package
|
||||
int packageCheck = SecurityContext.CheckPackage(packageId, DemandPackage.IsActive);
|
||||
if (packageCheck < 0) return packageCheck;
|
||||
|
||||
// place log record
|
||||
TaskManager.StartTask("FILES", "DELETE_DIRECTORY_RECURSIVE", rootPath);
|
||||
TaskManager.ItemId = packageId;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
OS.OperatingSystem os = GetOS(packageId);
|
||||
os.DeleteDirectoryRecursive(rootPath);
|
||||
|
||||
return 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//Log and return a generic error rather than throwing an exception
|
||||
TaskManager.WriteError(ex);
|
||||
return BusinessErrorCodes.ERROR_FILE_GENERIC_LOGGED;
|
||||
}
|
||||
finally
|
||||
{
|
||||
TaskManager.CompleteTask();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -406,6 +406,15 @@ namespace WebsitePanel.EnterpriseServer
|
|||
TaskManager.CompleteTask();
|
||||
}
|
||||
}
|
||||
|
||||
// Check If FSRM Role services were installed
|
||||
public static bool CheckFileServicesInstallation(int serviceId)
|
||||
{
|
||||
OS.OperatingSystem os = GetOS(serviceId);
|
||||
return os.CheckFileServicesInstallation();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Web Platform Installer
|
||||
|
|
|
@ -770,6 +770,9 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
if (result.ExceedingQuotas.Tables[0].Rows.Count > 0)
|
||||
result.Result = BusinessErrorCodes.ERROR_PACKAGE_QUOTA_EXCEED;
|
||||
|
||||
// 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);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -963,6 +966,9 @@ namespace WebsitePanel.EnterpriseServer
|
|||
homeFolder.PackageId = packageId;
|
||||
homeFolder.Name = path;
|
||||
|
||||
// Added By Haya
|
||||
UpdatePackageHardQuota(packageId);
|
||||
|
||||
// save package item
|
||||
return AddPackageItem(homeFolder);
|
||||
}
|
||||
|
@ -976,6 +982,30 @@ namespace WebsitePanel.EnterpriseServer
|
|||
{
|
||||
DataProvider.UpdatePackageBandwidthUpdate(packageId, updateDate);
|
||||
}
|
||||
|
||||
// This gets the system quota and updates the home folder with the value
|
||||
public static void UpdatePackageHardQuota(int packageId)
|
||||
{
|
||||
// request OS service
|
||||
int osId = GetPackageServiceId(packageId, ResourceGroups.Os);
|
||||
if (osId == 0)
|
||||
return;
|
||||
|
||||
OS.OperatingSystem os = new OS.OperatingSystem();
|
||||
ServiceProviderProxy.Init(os, osId);
|
||||
|
||||
//Get operating system settings
|
||||
StringDictionary osSesstings = ServerController.GetServiceSettings(osId);
|
||||
bool diskQuotaEnabled = (osSesstings["EnableHardQuota"] != null) ? bool.Parse(osSesstings["EnableHardQuota"]) : false;
|
||||
string driveName = osSesstings["LocationDrive"];
|
||||
|
||||
if (!diskQuotaEnabled)
|
||||
return;
|
||||
|
||||
string homeFolder = FilesController.GetHomeFolder(packageId);
|
||||
FilesController.SetFolderQuota(packageId, homeFolder, driveName);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -1035,6 +1065,8 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
result.Result = addonId;
|
||||
|
||||
// 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);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -1062,6 +1094,9 @@ namespace WebsitePanel.EnterpriseServer
|
|||
if (result.ExceedingQuotas.Tables[0].Rows.Count > 0)
|
||||
result.Result = BusinessErrorCodes.ERROR_PACKAGE_QUOTA_EXCEED;
|
||||
|
||||
// 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);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -1072,6 +1107,10 @@ namespace WebsitePanel.EnterpriseServer
|
|||
| DemandAccount.IsReseller);
|
||||
if (accountCheck < 0) return accountCheck;
|
||||
|
||||
|
||||
// Update the Hard quota on home folder in case it was enabled and in case there was a change in disk space
|
||||
UpdatePackageHardQuota(GetPackageAddon(packageAddonId).PackageId);
|
||||
|
||||
DataProvider.DeletePackageAddon(SecurityContext.User.UserId, packageAddonId);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -583,7 +583,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
}
|
||||
}
|
||||
|
||||
public static int DeleteWebSite(int siteItemId)
|
||||
public static int DeleteWebSite(int siteItemId, bool deleteWebsiteDirectory)
|
||||
{
|
||||
// check account
|
||||
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
||||
|
@ -655,6 +655,16 @@ namespace WebsitePanel.EnterpriseServer
|
|||
//
|
||||
web.DeleteSite(siteItem.SiteId);
|
||||
|
||||
// Delete WebManagementAccess Account
|
||||
WebServerController.RevokeWebManagementAccess(siteItemId);
|
||||
|
||||
if (deleteWebsiteDirectory)
|
||||
{
|
||||
// Delete website directory from file server
|
||||
// This will remove the hard quota as well
|
||||
FilesController.DeleteDirectoryRecursive(siteItem.PackageId, new DirectoryInfo(siteItem.DataPath).Parent.FullName);
|
||||
|
||||
}
|
||||
// delete service item
|
||||
PackageController.DeletePackageItem(siteItemId);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue