diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/EnterpriseStorage/EnterpriseStorageController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/EnterpriseStorage/EnterpriseStorageController.cs index b0cd2cca..63e6d81b 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/EnterpriseStorage/EnterpriseStorageController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/EnterpriseStorage/EnterpriseStorageController.cs @@ -455,7 +455,7 @@ namespace WebsitePanel.EnterpriseServer // check if it's not root folder if (!string.IsNullOrEmpty(folderName)) { - UpdateESHardQuota(org.PackageId, org.OrganizationId, folderName, quota); + SetFolderQuota(org.PackageId, org.OrganizationId, folderName, quota); } } catch (Exception ex) @@ -870,33 +870,64 @@ namespace WebsitePanel.EnterpriseServer } - private static void UpdateESHardQuota(int packageId, string orgId, string folderName, int quotaSize) + private static void SetFolderQuota(int packageId, string orgId, string folderName, int quotaSize) { + int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive); + if (accountCheck < 0) + return; + + int packageCheck = SecurityContext.CheckPackage(packageId, DemandPackage.IsActive); + if (packageCheck < 0) + return; + 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"]; - var orgRootFolder = Path.Combine(usersHome, orgId); var orgFolder = Path.Combine(usersHome, orgId, folderName); - bool enableHardQuota = (esSesstings["enablehardquota"] != null) - ? bool.Parse(esSesstings["enablehardquota"]) - : false; - if (enableHardQuota) - { - var os = GetOS(packageId); + FSRMQuotaType quotaType = (esSesstings["enablehardquota"] != null) + ? bool.Parse(esSesstings["enablehardquota"]) == true ? FSRMQuotaType.Hard : FSRMQuotaType.Soft + : FSRMQuotaType.Soft; - if (os != null && os.CheckFileServicesInstallation()) + var os = GetOS(packageId); + + if (os != null && os.CheckFileServicesInstallation()) + { + TaskManager.StartTask("FILES", "SET_QUOTA_ON_FOLDER", orgFolder, packageId); + + try { - SetFolderQuotaByQuotaName(packageId, os, orgRootFolder, locationDrive, Quotas.ENTERPRISESTORAGE_DISKSTORAGESPACE); - SetFolderQuotaByQuotaSize(packageId, os, orgFolder, locationDrive, quotaSize, "MB"); + QuotaValueInfo diskSpaceQuota = PackageController.GetPackageQuota(packageId, Quotas.ENTERPRISESTORAGE_DISKSTORAGESPACE); + + #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.SetQuotaLimitOnFolder(orgFolder, locationDrive, quotaType, quotaSize.ToString() + unit, 0, String.Empty, String.Empty); + } + catch (Exception ex) + { + TaskManager.WriteError(ex); + } + finally + { + TaskManager.CompleteTask(); } } } @@ -947,88 +978,6 @@ namespace WebsitePanel.EnterpriseServer return null; } - private static int SetFolderQuotaByQuotaName(int packageId, WebsitePanel.Providers.OS.OperatingSystem os, string path, string driveName, string quotaName) - { - - // 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, 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. //Quotas.OS_DISKSPACE - QuotaValueInfo diskSpaceQuota = PackageController.GetPackageQuota(packageId, quotaName); - - #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.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(); - } - } - - private static int SetFolderQuotaByQuotaSize(int packageId,WebsitePanel.Providers.OS.OperatingSystem os, string path, string driveName, int quotaSize ,string unit) - { - - // 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, packageId); - - try - { - os.SetQuotaLimitOnFolder(path, driveName, quotaSize.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(); - } - } - private static WebsitePanel.Providers.OS.OperatingSystem GetOS(int packageId) { var esServiceInfo = ServerController.GetServiceInfo(GetEnterpriseStorageServiceID(packageId)); @@ -1037,7 +986,7 @@ namespace WebsitePanel.EnterpriseServer var osGroups = ServerController.GetResourceGroupByName(ResourceGroups.Os); var osProviders = ServerController.GetProvidersByGroupID(osGroups.GroupId); - var regexResult = Regex.Match(esProviderInfo.ProviderType,"Windows([0-9]+)"); + var regexResult = Regex.Match(esProviderInfo.ProviderType, "Windows([0-9]+)"); if(regexResult.Success) { @@ -1054,12 +1003,7 @@ namespace WebsitePanel.EnterpriseServer cnfg.ProviderSettings.ProviderCode = osProvider.ProviderName; cnfg.ProviderSettings.ProviderName = osProvider.DisplayName; cnfg.ProviderSettings.ProviderType = osProvider.ProviderType; - - //// set service settings - //StringDictionary serviceSettings = ServerController.GetServiceSettings(serviceId); - //foreach (string key in serviceSettings.Keys) - // cnfg.ProviderSettings.Settings[key] = serviceSettings[key]; - + ServiceProviderProxy.ServerInit(os, cnfg, esServiceInfo.ServerId); return os; diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Files/FilesController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Files/FilesController.cs index cffcc6db..bf511db4 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Files/FilesController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Files/FilesController.cs @@ -948,7 +948,7 @@ namespace WebsitePanel.EnterpriseServer OS.OperatingSystem os = GetOS(packageId); - os.SetQuotaLimitOnFolder(path, driveName, diskSpaceQuota.QuotaAllocatedValue.ToString() + unit, 0, String.Empty, String.Empty); + os.SetQuotaLimitOnFolder(path, driveName, FSRMQuotaType.Hard, diskSpaceQuota.QuotaAllocatedValue.ToString() + unit, 0, String.Empty, String.Empty); return 0; } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esEnterpriseStorage.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esEnterpriseStorage.asmx.cs index 6e8f4195..4b279f39 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esEnterpriseStorage.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esEnterpriseStorage.asmx.cs @@ -150,7 +150,7 @@ namespace WebsitePanel.EnterpriseServer } [WebMethod] - public void SetEnterpriseFolderSettings(int itemId, SystemFile folder, ESPermission[] permissions, bool directoyBrowsingEnabled,int quota) + public void SetEnterpriseFolderSettings(int itemId, SystemFile folder, ESPermission[] permissions, bool directoyBrowsingEnabled, int quota) { EnterpriseStorageController.SetDirectoryBrowseEnabled(itemId, folder.Url, directoyBrowsingEnabled); EnterpriseStorageController.SetFolderPermission(itemId, folder.Name, permissions); diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/OS/FSRMQuotaType.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/OS/FSRMQuotaType.cs new file mode 100644 index 00000000..97d9078b --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/OS/FSRMQuotaType.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace WebsitePanel.Providers.OS +{ + public enum FSRMQuotaType + { + Soft = 1, + Hard = 2 + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/OS/IOperatingSystem.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/OS/IOperatingSystem.cs index 62bddb93..db1bac5a 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/OS/IOperatingSystem.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/OS/IOperatingSystem.cs @@ -82,7 +82,7 @@ namespace WebsitePanel.Providers.OS FolderGraph GetFolderGraph(string path); void ExecuteSyncActions(FileSyncAction[] actions); - void SetQuotaLimitOnFolder(string folderPath, string shareNameDrive, string quotaLimit, int mode, string wmiUserName, string wmiPassword); + void SetQuotaLimitOnFolder(string folderPath, string shareNameDrive, FSRMQuotaType quotaType, string quotaLimit, int mode, string wmiUserName, string wmiPassword); int GetQuotaLimitOnFolder(string folderPath, string wmiUserName, string wmiPassword); void DeleteDirectoryRecursive(string rootPath); diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj b/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj index 427c0ffa..b699d9d9 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj @@ -113,6 +113,7 @@ + diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.EnterpriseStorage.Windows2012/Windows2012.cs b/WebsitePanel/Sources/WebsitePanel.Providers.EnterpriseStorage.Windows2012/Windows2012.cs index 49876eaf..86e71aca 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.EnterpriseStorage.Windows2012/Windows2012.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.EnterpriseStorage.Windows2012/Windows2012.cs @@ -80,17 +80,23 @@ namespace WebsitePanel.Providers.EnterpriseStorage { string fullName = System.IO.Path.Combine(rootPath, dir.Name); - SystemFile folder = new SystemFile(dir.Name, fullName, true, - FileUtils.BytesToMb(FileUtils.CalculateFolderSize(dir.FullName)), dir.CreationTime, dir.LastWriteTime); + SystemFile folder = new SystemFile(); + + folder.Name = dir.Name; + folder.FullName = dir.FullName; + folder.IsDirectory = true; + folder.Size = windows.GetUsageOnFolder(fullName); + if (folder.Size == -1) + { + folder.Size = FileUtils.BytesToMb(FileUtils.CalculateFolderSize(dir.FullName)); + } + folder.Url = string.Format("https://{0}/{1}/{2}", UsersDomain, organizationId, dir.Name); folder.Rules = webdav.GetFolderWebDavRules(organizationId, dir.Name); folder.FRSMQuotaMB = windows.GetQuotaLimitOnFolder(fullName, string.Empty, string.Empty); items.Add(folder); - - // check if the directory is empty - folder.IsEmpty = (Directory.GetFileSystemEntries(fullName).Length == 0); } } @@ -108,14 +114,23 @@ namespace WebsitePanel.Providers.EnterpriseStorage { DirectoryInfo root = new DirectoryInfo(fullName); - folder = new SystemFile(root.Name, fullName, true, - FileUtils.BytesToMb(FileUtils.CalculateFolderSize(root.FullName)), root.CreationTime, root.LastWriteTime); + folder = new SystemFile(); + + folder.Name = root.Name; + folder.FullName = root.FullName; + folder.IsDirectory = true; + + folder.Size = windows.GetUsageOnFolder(fullName); + if (folder.Size == -1) + { + folder.Size = FileUtils.BytesToMb(FileUtils.CalculateFolderSize(root.FullName)); + } folder.Url = string.Format("https://{0}/{1}/{2}", UsersDomain, organizationId, folderName); folder.Rules = GetFolderWebDavRules(organizationId, folderName); - folder.FRSMQuotaMB = windows.GetQuotaLimitOnFolder(fullName, string.Empty, string.Empty); } + return folder; } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.OS.Windows2003/Windows2003.cs b/WebsitePanel/Sources/WebsitePanel.Providers.OS.Windows2003/Windows2003.cs index 1830bb0f..5d4e7fd4 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.OS.Windows2003/Windows2003.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.OS.Windows2003/Windows2003.cs @@ -209,8 +209,8 @@ namespace WebsitePanel.Providers.OS SecurityUtils.GrantGroupNtfsPermissions(path, users, resetChildPermissions, ServerSettings, usersOU, null); } - - public virtual void SetQuotaLimitOnFolder(string folderPath, string shareNameDrive, string quotaLimit, int mode, string wmiUserName, string wmiPassword) + + public virtual void SetQuotaLimitOnFolder(string folderPath, string shareNameDrive, FSRMQuotaType quotaType, string quotaLimit, int mode, string wmiUserName, string wmiPassword) { FileUtils.SetQuotaLimitOnFolder(folderPath, shareNameDrive, quotaLimit, mode, wmiUserName, wmiPassword); } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.OS.Windows2012/Windows2012.cs b/WebsitePanel/Sources/WebsitePanel.Providers.OS.Windows2012/Windows2012.cs index 1a84b334..20278f65 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.OS.Windows2012/Windows2012.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.OS.Windows2012/Windows2012.cs @@ -74,7 +74,7 @@ namespace WebsitePanel.Providers.OS || version == WebsitePanel.Server.Utils.OS.WindowsVersion.Windows81; } - public override void SetQuotaLimitOnFolder(string folderPath, string shareNameDrive, string quotaLimit, int mode, string wmiUserName, string wmiPassword) + public override void SetQuotaLimitOnFolder(string folderPath, string shareNameDrive, FSRMQuotaType quotaType, string quotaLimit, int mode, string wmiUserName, string wmiPassword) { Log.WriteStart("SetQuotaLimitOnFolder"); Log.WriteInfo("FolderPath : {0}", folderPath); @@ -82,7 +82,6 @@ namespace WebsitePanel.Providers.OS Log.WriteInfo("QuotaLimit : {0}", quotaLimit); string path = Path.Combine(shareNameDrive + @":\", folderPath); - var quota = CalculateQuota(quotaLimit); Runspace runSpace = null; try @@ -94,21 +93,30 @@ namespace WebsitePanel.Providers.OS if (!FileUtils.DirectoryExists(path)) FileUtils.CreateDirectory(path); - switch (mode) + if (quotaLimit.Contains("-")) { + RemoveOldQuotaOnFolder(runSpace, path); + } + else + { + var quota = CalculateQuota(quotaLimit); + + switch (mode) + { //deleting old quota and creating new one - case 0: - { - RemoveOldQuotaOnFolder(runSpace, path); - ChangeQuotaOnFolder(runSpace, "New-FsrmQuota", path, quota); - break; - } + case 0: + { + RemoveOldQuotaOnFolder(runSpace, path); + ChangeQuotaOnFolder(runSpace, "New-FsrmQuota", path, quotaType, quota); + break; + } //modifying folder quota - case 1: - { - ChangeQuotaOnFolder(runSpace, "Set-FsrmQuota", path, quota); - break; - } + case 1: + { + ChangeQuotaOnFolder(runSpace, "Set-FsrmQuota", path, quotaType, quota); + break; + } + } } } } @@ -132,7 +140,7 @@ namespace WebsitePanel.Providers.OS Runspace runSpace = null; - int quota = 0; + int quota = -1; try { @@ -165,6 +173,45 @@ namespace WebsitePanel.Providers.OS return quota; } + public int GetUsageOnFolder(string folderPath) + { + Log.WriteStart("GetUsageOnFolder"); + Log.WriteInfo("FolderPath : {0}", folderPath); + + + Runspace runSpace = null; + int size = -1; + + try + { + runSpace = OpenRunspace(); + + if (folderPath.IndexOfAny(Path.GetInvalidPathChars()) == -1) + { + Command cmd = new Command("Get-FsrmQuota"); + cmd.Parameters.Add("Path", folderPath); + var result = ExecuteShellCommand(runSpace, cmd, false); + + if (result.Count > 0) + { + size = ConvertBytesToMB(Convert.ToInt64(GetPSObjectProperty(result[0], "usage"))); + } + } + } + catch (Exception ex) + { + Log.WriteError("GetUsageOnFolder", ex); + throw; + } + finally + { + CloseRunspace(runSpace); + } + + Log.WriteEnd("GetUsageOnFolder"); + + return size; + } public UInt64 CalculateQuota(string quota) { @@ -217,11 +264,17 @@ namespace WebsitePanel.Providers.OS catch { /* do nothing */ } } - public void ChangeQuotaOnFolder(Runspace runSpace, string command, string path, UInt64 quota) + public void ChangeQuotaOnFolder(Runspace runSpace, string command, string path, FSRMQuotaType quotaType, UInt64 quota) { Command cmd = new Command(command); cmd.Parameters.Add("Path", path); cmd.Parameters.Add("Size", quota); + + if (quotaType == FSRMQuotaType.Soft) + { + cmd.Parameters.Add("SoftLimit", true); + } + ExecuteShellCommand(runSpace, cmd, false); } diff --git a/WebsitePanel/Sources/WebsitePanel.Server.Client/OperatingSystemProxy.cs b/WebsitePanel/Sources/WebsitePanel.Server.Client/OperatingSystemProxy.cs index e57c860a..e0baa912 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server.Client/OperatingSystemProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.Server.Client/OperatingSystemProxy.cs @@ -1741,11 +1741,12 @@ namespace WebsitePanel.Providers.OS /// [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/SetQuotaLimitOnFolder", RequestNamespace = "http://smbsaas/websitepanel/server/", ResponseNamespace = "http://smbsaas/websitepanel/server/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public void SetQuotaLimitOnFolder(string folderPath, string shareNameDrive, string quotaLimit, int mode, string wmiUserName, string wmiPassword) + public void SetQuotaLimitOnFolder(string folderPath, string shareNameDrive, FSRMQuotaType quotaType, string quotaLimit, int mode, string wmiUserName, string wmiPassword) { this.Invoke("SetQuotaLimitOnFolder", new object[] { folderPath, shareNameDrive, + quotaType, quotaLimit, mode, wmiUserName, @@ -1753,11 +1754,12 @@ namespace WebsitePanel.Providers.OS } /// - public System.IAsyncResult BeginSetQuotaLimitOnFolder(string folderPath, string shareNameDrive, string quotaLimit, int mode, string wmiUserName, string wmiPassword, System.AsyncCallback callback, object asyncState) + public System.IAsyncResult BeginSetQuotaLimitOnFolder(string folderPath, string shareNameDrive, FSRMQuotaType quotaType, string quotaLimit, int mode, string wmiUserName, string wmiPassword, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("SetQuotaLimitOnFolder", new object[] { folderPath, shareNameDrive, + quotaType, quotaLimit, mode, wmiUserName, @@ -1771,13 +1773,13 @@ namespace WebsitePanel.Providers.OS } /// - public void SetQuotaLimitOnFolderAsync(string folderPath, string shareNameDrive, string quotaLimit, int mode, string wmiUserName, string wmiPassword) + public void SetQuotaLimitOnFolderAsync(string folderPath, string shareNameDrive, FSRMQuotaType quotaType, string quotaLimit, int mode, string wmiUserName, string wmiPassword) { - this.SetQuotaLimitOnFolderAsync(folderPath, shareNameDrive, quotaLimit, mode, wmiUserName, wmiPassword, null); + this.SetQuotaLimitOnFolderAsync(folderPath, shareNameDrive, quotaType, quotaLimit, mode, wmiUserName, wmiPassword, null); } /// - public void SetQuotaLimitOnFolderAsync(string folderPath, string shareNameDrive, string quotaLimit, int mode, string wmiUserName, string wmiPassword, object userState) + public void SetQuotaLimitOnFolderAsync(string folderPath, string shareNameDrive, FSRMQuotaType quotaType, string quotaLimit, int mode, string wmiUserName, string wmiPassword, object userState) { if ((this.SetQuotaLimitOnFolderOperationCompleted == null)) { @@ -1786,6 +1788,7 @@ namespace WebsitePanel.Providers.OS this.InvokeAsync("SetQuotaLimitOnFolder", new object[] { folderPath, shareNameDrive, + quotaType, quotaLimit, mode, wmiUserName, diff --git a/WebsitePanel/Sources/WebsitePanel.Server/OperatingSystem.asmx.cs b/WebsitePanel/Sources/WebsitePanel.Server/OperatingSystem.asmx.cs index acc992a1..eda7fb06 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server/OperatingSystem.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.Server/OperatingSystem.asmx.cs @@ -536,12 +536,12 @@ namespace WebsitePanel.Server [WebMethod, SoapHeader("settings")] - public void SetQuotaLimitOnFolder(string folderPath, string shareNameDrive, string quotaLimit, int mode, string wmiUserName, string wmiPassword) + public void SetQuotaLimitOnFolder(string folderPath, string shareNameDrive, FSRMQuotaType quotaType, string quotaLimit, int mode, string wmiUserName, string wmiPassword) { try { Log.WriteStart("'{0}' SetQuotaLimitOnFolder", ProviderSettings.ProviderName); - OsProvider.SetQuotaLimitOnFolder(folderPath, shareNameDrive, quotaLimit, mode, wmiUserName, wmiPassword); + OsProvider.SetQuotaLimitOnFolder(folderPath, shareNameDrive, quotaType, quotaLimit, mode, wmiUserName, wmiPassword); Log.WriteEnd("'{0}' SetQuotaLimitOnFolder", ProviderSettings.ProviderName); } catch (Exception ex) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/EnterpriseStorageFolderGeneralSettings.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/EnterpriseStorageFolderGeneralSettings.ascx.resx index 1dabc5e0..677983cb 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/EnterpriseStorageFolderGeneralSettings.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/EnterpriseStorageFolderGeneralSettings.ascx.resx @@ -147,4 +147,13 @@ Folder Url: + + Folder Limit Size (Mb): + + + * + + + Enter Folder Size + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx index d6305bc2..b161524d 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx @@ -30,13 +30,23 @@ - + + + + + + + +

+ diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx.cs index c8896ff0..fc3a15e2 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx.cs @@ -75,6 +75,11 @@ namespace WebsitePanel.Portal.ExchangeServer // bind form txtFolderName.Text = folder.Name; lblFolderUrl.Text = folder.Url; + + if (folder.FRSMQuotaMB != -1) + { + txtFolderSize.Text = folder.FRSMQuotaMB.ToString(); + } var esPermissions = ES.Services.EnterpriseStorage.GetEnterpriseFolderPermissions(PanelRequest.ItemID,folder.Name); @@ -122,7 +127,8 @@ namespace WebsitePanel.Portal.ExchangeServer folder = ES.Services.EnterpriseStorage.RenameEnterpriseFolder(PanelRequest.ItemID, PanelRequest.FolderID, txtFolderName.Text); } - ES.Services.EnterpriseStorage.SetEnterpriseFolderSettings(PanelRequest.ItemID, folder, permissions.GetPemissions(), chkDirectoryBrowsing.Checked, 100); + ES.Services.EnterpriseStorage.SetEnterpriseFolderSettings(PanelRequest.ItemID, folder, permissions.GetPemissions(), + chkDirectoryBrowsing.Checked, txtFolderSize.Text.Length == 0 ? -1 : int.Parse(txtFolderSize.Text)); Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "enterprisestorage_folders", diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx.designer.cs index b6b60896..d92313da 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx.designer.cs @@ -1,31 +1,3 @@ -// Copyright (c) 2012, Outercurve Foundation. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// - Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// - Neither the name of the Outercurve Foundation nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - //------------------------------------------------------------------------------ // // This code was generated by a tool. @@ -130,6 +102,33 @@ namespace WebsitePanel.Portal.ExchangeServer { ///
protected global::System.Web.UI.WebControls.RequiredFieldValidator valRequireFolderName; + /// + /// locFolderSize control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locFolderSize; + + /// + /// txtFolderSize control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtFolderSize; + + /// + /// valNumericFolderSize control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CompareValidator valNumericFolderSize; + /// /// locFolderUrl control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx index 86659c0e..2f524d94 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx @@ -251,7 +251,7 @@ - + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.cs index bdadf4b7..68aa14f4 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.cs @@ -300,9 +300,7 @@ namespace WebsitePanel.Portal.ExchangeServer private void BindEnterpriseStorageStats(OrganizationStatistics stats, OrganizationStatistics tenantStats) { - enterpriseStorageSpaceStats.QuotaValue = stats.AllocatedEnterpriseStorageSpace; - enterpriseStorageSpaceStats.QuotaUsedValue = stats.UsedEnterpriseStorageSpace; - if (stats.AllocatedEnterpriseStorageSpace != -1) enterpriseStorageSpaceStats.QuotaAvailable = tenantStats.AllocatedEnterpriseStorageSpace - tenantStats.UsedEnterpriseStorageSpace; + enterpriseStorageSpaceStats.QuotaValue = stats.UsedEnterpriseStorageSpace; lnkBESUsers.NavigateUrl = EditUrl("ItemID", PanelRequest.ItemID.ToString(), "enterprisestorage_folders", "SpaceID=" + PanelSecurity.PackageId.ToString()); diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.designer.cs index dd6be843..6f818d45 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.designer.cs @@ -1,31 +1,3 @@ -// Copyright (c) 2012, Outercurve Foundation. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// - Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// - Neither the name of the Outercurve Foundation nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - //------------------------------------------------------------------------------ // // This code was generated by a tool.