From 0043689b8f67ad2b2c25f20c0b3d50ef9146e2e3 Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Fri, 22 Nov 2013 14:35:44 +0300 Subject: [PATCH 1/2] bug fixes --- .../App_Themes/Default/Icons.skin | 2 +- .../Default/Images/Exchange/spaces16.png | Bin 0 -> 1546 bytes .../Default/Images/Exchange/spaces48.png | Bin 0 -> 3623 bytes 3 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Images/Exchange/spaces16.png create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Images/Exchange/spaces48.png diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Icons.skin b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Icons.skin index 4d334ddb..2e2c3967 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Icons.skin +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Icons.skin @@ -94,4 +94,4 @@ Default skin template. The following skins are provided as examples only. <%-- Enterprise Storage Icons --%> - \ No newline at end of file + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Images/Exchange/spaces16.png b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Images/Exchange/spaces16.png new file mode 100644 index 0000000000000000000000000000000000000000..9885c54b8660ab057a9e231e232ed27df6c094d8 GIT binary patch literal 1546 zcmbVMeNYs27+xa}a=>FW5&T2e#l|nVy}jf1?pE&b_U;J60|qE)rhw&cfm81G+*`c^ z84j=vt!5}GAWdz=QOEpfnvBBW1jNh_qM^|m8YC&B91ccM=;F5D@>PGBf3&l^zmI*M z=l%G-@9xV;dp>N*swEHvg{34LGQk)wJRu_Rj()&XV2I+3xm*@g#JMPzhIAIDkcLxi zR56`NQj)L8`QoECIYmgaT0?dVN z6oF?T+;$Bz>r}2O1J*Mv4J#z_II|SPU>uiV@d_NrVquvSlc7>@<8fF#p}+~55}vyd zV2!mD5t)XhIa^?*K}tBzL7=G1<&wDM5{4~CF|}GPXvk!701@XbvvZU?&hCtvS1`~{ zGi!BlR>lqsic}%9lhYu;)7cPg4wGp?*zTN56i6BBrW`0Hk)k%65Z4Ua$z{_2xbaxD zGrP<|qnWgm*~yy0c@)LWlR@sDY)AkCZ-{i(3J!%TH8AF#Hrmdm7&Hj@BC%L41gTb$ za)lJv;|iHkj$t|#rc>ie6{*72N>WeGYdnstlp3WfHD&-z62pvgwOS_CD@c`2jwwhv zxxh`aJ2}d3rswTif!#T-{)t>d&(ajfu-Ob#I$r@9B@D+nOBe^N&%)vLIaa%caXB{# z$1@wPfo83{XiE~y*x;G`64uAqSCR3!B3_+jRQ^}ovs}yn$r%cqL51S@SFy}*feI9+ z3#AVh3(Z5@LC3J5HJbAed;mdD5h(^;w)@Azzj!_|$lPlZSu#q{NRNNQ*OA)e*;YMS z{_g!-*~XXsesNoV?Z+dYBSamv%A4U1+PcRv)}5pKb@}RxP26uk@tb{tJy>nnvY@M% z`Yw%2v7^<&zRHzT+a84M9uDcayrr}*GI{B%n%ng?6KGa{Q9@g1PT3#%*G825K*iJp zzSlp%>#96&Y-$uFs{5+?YR0R+5+lprZ=dv??6_KRtfL3^K5Wo69*in&@un$TjM4or z?BevF4TGI%(cT!BRu;SY(bULIE^5X3mG~=x>vx*Jxp6d|#RX66=ML<{%4^Q_)I(>2)?TSSy!32q zdI0V2>GEzo+3A&Ry9w|5vVQOrG9-88k$+R@Ic>oFZGY3XkksJV(We(J&N-1z7r64f zyQnnZYr|+>)7Gb6K}r0=J#QL@Q#|${QAXFO+U0v4^EFw pi*J2)g;{a-nX$mRq?g3u1yJP%jc#wMVNm!xrx?==XUT$^zX2RaR@VRk literal 0 HcmV?d00001 diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Images/Exchange/spaces48.png b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Images/Exchange/spaces48.png new file mode 100644 index 0000000000000000000000000000000000000000..4e200101da864b0faf9648a05bc542b125b8a551 GIT binary patch literal 3623 zcmbVPc{r5o-?uNJ#ZpGt#&d6ArjJ=RCGc?A`XbgstkflN~l)aO^)mD+n z63S92Ya&u297{UcD!*~g>AdeB=lZ?Z^*-10Joonbe7?*5y|3qbE*?L2RAQIhE*>5p z35*R2$8B|Y9uXn#+l_A{k=w{J(e6wqx*szP&mi$w5b3@o0EUY9C*eqVV)&U(k_itF zzaQDzo$2mik08*gAp8yn#G(dq**rWZW~?AQfkI*ed`bRf8WOlv-vk7ZiAbOu)IrxF z$cl8DY!ksCIYk_ECPYvOMns^QDZqq<;0jPlOgw-^4WtDlSV-WXx(IH6XBrFy{0U)F zkifs3a(6fmu%a_a04PXbhoB3A0AMf>!~hC|L9_vSx)43EF87A%KnxI27(x#Y`1=BK ztucsx2pr1#Z(H0E5_p=)3_^gxVPRpQFnti6;SYuw85!+p=;`Tj5jw%)G$x*?q=W=^;!ckn8DRAy9)H9R3le1^=BWZpy$cd=MA{(gjngJ8}Jq z4rby=|KrBLqJy2ogGgW;DVQF@AaM7?Px%*_o4fyRXa~sk27zUextoFyM9~Q$R1%Ge zK_P+M6%dh3L>R&iU{C`iYcw3Hht`KcEDRwQMliUcr6J4+ZfRxtOXJ_T7F?X3r2&e| zw1hy=`j&c@P_&^n#2O0KhojJtUtA0=n2DzmNWbioxpx2NTK!ip!iqt{GwBRxIz8}L z1sp$3XVQaD(}Mt3PB4JF8<|F=hXrfwY|mfOqDTyKD2Zszpi=>V<`+T!7yE`*|5x09 zaf$z*oPoK{fOm@He-+EGDQ*SsbpI)R?%HvIL?09SR!SS>sk+$k78`-H@hUUKfLca3bLzJa+p=E15J=&C|(Sz)9 z6>P-yTK%Qqo+oSL?1}p~<`H+N-fTjwPr|?}`$6Td{Lew?WebY5Vpv<>XqoIpWV~c) zrbgD%eL{=0@MTYt`co!j{qWI;-+S$`weeMwBh1XB5-3iS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JL~!UTafW)mpruV9_Vmxt?<9CE@zgNU_j+ifQF*cTX0Mbrt}$&F41N z(;SVAcI86bW{MlK_6px>wA+q#OY(8s$X73s8lJ>y-dcYUtSL~6_E)9>V}e5_Le z=3l^#R{Bm=XOtDRU4C*bInY#g{^fJYJa*o6eRV^7jJ9OKosal;&s#ZSz-;W;giTxd zG$FuMaYCFq15KUo;eO0{C-QA8R-M+h-*&j+iZ1iZNSVm}+*5LNwOzPrs=lUWlAaS? z!8nocmG)dF(mt&4)_s-Lo&@R=e}Ck&{TDL_2f*2|JE8P5nD9W8<}hom*5_cXQRQZ5 z*gCG09+9J8I^2oXTx8s;*q+>MB^>u6w@&_QQib0shjV++`owDsG?5Qj)k>?MDA82AcNq22aTu*V#ckFqVG~3-)&E~b+@w_uPPpq9FB9sc#S%}+nPUrekT8M6!FndwPqgE X0s9lryS_B+{JLS#$57>#KC%A+RftWw literal 0 HcmV?d00001 From d859dd56c1e51af66c2b4f5448538704aa13db2f Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Wed, 27 Nov 2013 18:18:28 +0300 Subject: [PATCH 2/2] bug fixes --- .../EnterpriseStorageController.cs | 28 +++--- .../Packages/PackageController.cs | 40 ++++++++- .../Windows2012.cs | 86 +++++++++++++++---- 3 files changed, 120 insertions(+), 34 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/EnterpriseStorage/EnterpriseStorageController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/EnterpriseStorage/EnterpriseStorageController.cs index dec560e2..5f17b245 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/EnterpriseStorage/EnterpriseStorageController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/EnterpriseStorage/EnterpriseStorageController.cs @@ -261,16 +261,16 @@ namespace WebsitePanel.EnterpriseServer EnterpriseStorageController.AddWebDavDirectory(packageId, usersDomain, org.OrganizationId, homePath); - int osId = PackageController.GetPackageServiceId(packageId, ResourceGroups.Os); - bool enableHardQuota = (esSesstings["enablehardquota"] != null) - ? bool.Parse(esSesstings["enablehardquota"]) - : false; + //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, Path.Combine(usersHome, org.OrganizationId), - locationDrive, Quotas.ENTERPRISESTORAGE_DISKSTORAGESPACE); - } + //if (enableHardQuota && osId != 0 && OperatingSystemController.CheckFileServicesInstallation(osId)) + //{ + // FilesController.SetFolderQuota(packageId, Path.Combine(usersHome, org.OrganizationId), + // locationDrive, Quotas.ENTERPRISESTORAGE_DISKSTORAGESPACE); + //} } } catch (Exception ex) @@ -579,11 +579,6 @@ namespace WebsitePanel.EnterpriseServer dir.HttpErrors = null; dir.MimeMaps = null; - int serviceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.Web); - - if (serviceId == -1) - return serviceId; - // create directory WebServer web = GetWebServer(packageId); @@ -867,6 +862,11 @@ namespace WebsitePanel.EnterpriseServer cnfg.ProviderSettings.ProviderName = webProvider.DisplayName; cnfg.ProviderSettings.ProviderType = webProvider.ProviderType; + //// set service settings + //StringDictionary serviceSettings = ServerController.GetServiceSettings(serviceId); + //foreach (string key in serviceSettings.Keys) + // cnfg.ProviderSettings.Settings[key] = serviceSettings[key]; + ServiceProviderProxy.ServerInit(web, cnfg, package.ServerId); return web; diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Packages/PackageController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Packages/PackageController.cs index 1b89f3dc..f07a01bf 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Packages/PackageController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Packages/PackageController.cs @@ -783,6 +783,7 @@ 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 UpdatePackageHardQuota(package.PackageId); + UpdateESHardQuota(package.PackageId); DataProvider.DistributePackageServices(SecurityContext.User.UserId, package.PackageId); } @@ -980,6 +981,7 @@ namespace WebsitePanel.EnterpriseServer // Added By Haya UpdatePackageHardQuota(packageId); + UpdateESHardQuota(packageId); // save package item return AddPackageItem(homeFolder); @@ -1019,6 +1021,33 @@ namespace WebsitePanel.EnterpriseServer } + public 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); + } + } + } + #endregion #region Package Add-ons @@ -1079,6 +1108,7 @@ 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 UpdatePackageHardQuota(addon.PackageId); + UpdateESHardQuota(addon.PackageId); return result; } @@ -1108,7 +1138,7 @@ 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 UpdatePackageHardQuota(addon.PackageId); - + UpdateESHardQuota(addon.PackageId); return result; } @@ -1119,12 +1149,14 @@ 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); + var packageId = GetPackageAddon(packageAddonId).PackageId; DataProvider.DeletePackageAddon(SecurityContext.User.UserId, packageAddonId); + // Update the Hard quota on home folder in case it was enabled and in case there was a change in disk space + UpdatePackageHardQuota(packageId); + UpdateESHardQuota(packageId); + return 0; } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.OS.Windows2012/Windows2012.cs b/WebsitePanel/Sources/WebsitePanel.Providers.OS.Windows2012/Windows2012.cs index 3542555e..238cbc0c 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.OS.Windows2012/Windows2012.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.OS.Windows2012/Windows2012.cs @@ -49,6 +49,7 @@ using System.Management.Automation.Runspaces; using WebsitePanel.Providers.Common; using WebsitePanel.Providers; using WebsitePanel.Providers.HostedSolution; +using System.Runtime.InteropServices; namespace WebsitePanel.Providers.OS @@ -80,28 +81,34 @@ namespace WebsitePanel.Providers.OS Log.WriteInfo("ShareNameDrive : {0}", shareNameDrive); Log.WriteInfo("QuotaLimit : {0}", quotaLimit); + string path = Path.Combine(shareNameDrive + @":\", folderPath); + var quota = CalculateQuota(quotaLimit); + Runspace runSpace = null; try { runSpace = OpenRunspace(); - string[] splits = folderPath.Split('\\'); - if (splits.Length > 0) + + if (path.IndexOfAny(Path.GetInvalidPathChars()) == -1) { - string sharePath = String.Empty; + if (!FileUtils.DirectoryExists(path)) + FileUtils.CreateDirectory(path); - if (splits.Length > 4) + switch (mode) { - // Form the share physicalPath - sharePath = shareNameDrive + @":\" + splits[3]; - - if (splits.Length == 5 && !quotaLimit.Equals(String.Empty)) - { - Command cmd = new Command("Set-FsrmQuota"); - cmd.Parameters.Add("Path", sharePath + @"\" + splits[4]); - cmd.Parameters.Add("Size", quotaLimit); - cmd.Parameters.Add("Confirm", true); - ExecuteShellCommand(runSpace, cmd, false); - } + //deleting old quota and creating new one + case 0: + { + RemoveOldQuotaOnFolder(runSpace, path); + ChangeQuotaOnFolder(runSpace, "New-FsrmQuota", path, quota); + break; + } + //modifying folder quota + case 1: + { + ChangeQuotaOnFolder(runSpace, "Set-FsrmQuota", path, quota); + break; + } } } } @@ -112,13 +119,60 @@ namespace WebsitePanel.Providers.OS } finally { - CloseRunspace(runSpace); } Log.WriteEnd("SetQuotaLimitOnFolder"); } + public UInt64 CalculateQuota(string quota) + { + UInt64 OneKb = 1024; + UInt64 OneMb = OneKb * 1024; + UInt64 OneGb = OneMb * 1024; + + UInt64 result = 0; + + // Quota Unit + if (quota.ToLower().Contains("gb")) + { + result = UInt64.Parse(quota.ToLower().Replace("gb", "")) * OneGb; + } + else if (quota.ToLower().Contains("mb")) + { + result = UInt64.Parse(quota.ToLower().Replace("mb", "")) * OneMb; + } + else + { + result = UInt64.Parse(quota.ToLower().Replace("kb", "")) * OneKb; + } + + return result; + } + + public void RemoveOldQuotaOnFolder(Runspace runSpace, string path) + { + try + { + runSpace = OpenRunspace(); + if (!string.IsNullOrEmpty(path)) + { + Command cmd = new Command("Remove-FsrmQuota"); + cmd.Parameters.Add("Path", path); + ExecuteShellCommand(runSpace, cmd, false); + } + } + catch { /* do nothing */ } + } + + public void ChangeQuotaOnFolder(Runspace runSpace, string command, string path, UInt64 quota) + { + Command cmd = new Command(command); + cmd.Parameters.Add("Path", path); + cmd.Parameters.Add("Size", quota); + ExecuteShellCommand(runSpace, cmd, false); + } + #region PowerShell integration private static InitialSessionState session = null;