From 53cab92f5556b29870407e12c61ba30ccdd67032 Mon Sep 17 00:00:00 2001 From: Olov Karlsson Date: Mon, 15 Sep 2014 11:31:43 +0200 Subject: [PATCH 01/34] Support for ActiveDirectory User Isolation Mode in IIS FTP Provider --- .../WebsitePanel.Providers.FTP.IIs70/MsFTP.cs | 327 +++++++++++++----- .../SecurityUtils.cs | 8 + .../MSFTP70_Settings.ascx.resx | 7 +- .../ProviderControls/MSFTP70_Settings.ascx | 92 +++-- .../ProviderControls/MSFTP70_Settings.ascx.cs | 37 +- .../MSFTP70_Settings.ascx.designer.cs | 49 ++- 6 files changed, 383 insertions(+), 137 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.FTP.IIs70/MsFTP.cs b/WebsitePanel/Sources/WebsitePanel.Providers.FTP.IIs70/MsFTP.cs index 69413bc7..418d8c22 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.FTP.IIs70/MsFTP.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.FTP.IIs70/MsFTP.cs @@ -30,6 +30,7 @@ using System; using System.Collections.Generic; using System.DirectoryServices.ActiveDirectory; using System.IO; +using System.Linq; using System.Net; using System.Net.Sockets; using WebsitePanel.Providers.FTP.IIs70; @@ -99,6 +100,20 @@ namespace WebsitePanel.Providers.FTP { get { return ProviderSettings["ADGroupsOU"]; } } + + protected string AdFtpRoot + { + get { return ProviderSettings["AdFtpRoot"]; } + } + + protected Mode UserIsolationMode + { + get + { + var site = GetSite(ProviderSettings["SiteId"]); + return (Mode)Enum.Parse(typeof(Mode), site["UserIsolationMode"]); + } + } #endregion #region IFtpServer Members @@ -291,134 +306,275 @@ namespace WebsitePanel.Providers.FTP this.ftpSitesService.DeleteSite(siteId); } - /// - /// Checks whether account with given name exists. - /// - /// Account name to check. - /// true - if it exists; false - otherwise. + /// + /// Checks whether account with given name exists. + /// + /// Account name to check. + /// true - if it exists; false - otherwise. public bool AccountExists(string accountName) { if (String.IsNullOrEmpty(accountName)) { - return false; + return false; } - // check acocunt on FTP server - bool ftpExists = this.ftpSitesService.VirtualDirectoryExists(this.SiteId, accountName); + switch (UserIsolationMode) + { + case Mode.ActiveDirectory: + return SecurityUtils.UserExists(accountName, ServerSettings, UsersOU); - // check account in the system - bool systemExists = SecurityUtils.UserExists(accountName, ServerSettings, UsersOU); - return (ftpExists || systemExists); + default: + // check acocunt on FTP server + bool ftpExists = this.ftpSitesService.VirtualDirectoryExists(this.SiteId, accountName); + + // check account in the system + bool systemExists = SecurityUtils.UserExists(accountName, ServerSettings, UsersOU); + return (ftpExists || systemExists); + } } - /// + /// /// Gets available ftp accounts. /// /// List of avaialble accounts. public FtpAccount[] GetAccounts() { - List accounts = new List(); + switch (UserIsolationMode) + { + case Mode.ActiveDirectory: + return SecurityUtils.GetUsers(ServerSettings, UsersOU).Select(GetAccount).ToArray(); + default: + List accounts = new List(); - foreach (string directory in this.ftpSitesService.GetVirtualDirectoriesNames(this.SiteId)) - { - // Skip root virtual directory - if (String.Equals(directory, "/")) - continue; - // - accounts.Add(this.GetAccount(directory.Substring(1))); - } + foreach (string directory in this.ftpSitesService.GetVirtualDirectoriesNames(this.SiteId)) + { + // Skip root virtual directory + if (String.Equals(directory, "/")) + continue; + // + accounts.Add(this.GetAccount(directory.Substring(1))); + } - return accounts.ToArray(); + return accounts.ToArray(); + } } - /// - /// Gets account with given name. - /// - /// Account's name to get. - /// Ftp account. + /// + /// Gets account with given name. + /// + /// Account's name to get. + /// Ftp account. public FtpAccount GetAccount(string accountName) { - FtpAccount acc = new FtpAccount(); - acc.Name = accountName; - this.FillFtpAccountFromIis(acc); - return acc; + switch (UserIsolationMode) + { + case Mode.ActiveDirectory: + var user = SecurityUtils.GetUser(accountName, ServerSettings, UsersOU); + + var path = Path.Combine(user.MsIIS_FTPRoot, user.MsIIS_FTPDir); + var permission = GetUserPermission(accountName, path); + var account = new FtpAccount() + { + CanRead = permission.Read, + CanWrite = permission.Write, + CreatedDate = user.CreatedDate, + Enabled = !user.AccountDisabled, + Folder = path, + GroupName = user.GroupName, + Name = user.Name + }; + + return account; + default: + FtpAccount acc = new FtpAccount(); + acc.Name = accountName; + this.FillFtpAccountFromIis(acc); + return acc; + } } - /// + protected UserPermission GetUserPermission(string accountName, string folder) + { + var userPermission = new UserPermission {AccountName = accountName}; + return SecurityUtils.GetGroupNtfsPermissions(folder, new[] {userPermission}, ServerSettings, UsersOU, GroupsOU)[0]; + } + + + /// /// Creates ftp account under root ftp site. /// /// Ftp account to create. public void CreateAccount(FtpAccount account) { - // Create user account. - SystemUser user = new SystemUser(); - user.Name = account.Name; - user.FullName = account.Name; - user.Description = "WebsitePanel System Account"; - user.MemberOf = new string[] { FtpGroupName }; - user.Password = account.Password; - user.PasswordCantChange = true; - user.PasswordNeverExpires = true; - user.AccountDisabled = !account.Enabled; - user.System = true; + switch (UserIsolationMode) + { + case Mode.ActiveDirectory: + SecurityUtils.EnsureOrganizationalUnitsExist(ServerSettings, UsersOU, GroupsOU); - // Create in the operating system. - if (SecurityUtils.UserExists(user.Name, ServerSettings, UsersOU)) - { - SecurityUtils.DeleteUser(user.Name, ServerSettings, UsersOU); - } - SecurityUtils.CreateUser(user, ServerSettings, UsersOU, GroupsOU); + var systemUser = SecurityUtils.GetUser(account.Name, ServerSettings, UsersOU); - // Prepare account's home folder. - this.EnsureUserHomeFolderExists(account.Folder, account.Name, account.CanRead, account.CanWrite); + if (systemUser == null) + { + systemUser = new SystemUser + { + Name = account.Name, + FullName = account.Name, + Password = account.Password, + PasswordCantChange = true, + PasswordNeverExpires = true, + System = true + }; - // Future account will be given virtual directory under default ftp web site. - this.ftpSitesService.CreateFtpAccount(this.SiteId, account); - // - this.ftpSitesService.ConfigureConnectAs(account.Folder, this.SiteId, account.VirtualPath, - this.GetQualifiedAccountName(account.Name), account.Password, true); - } + SecurityUtils.CreateUser(systemUser, ServerSettings, UsersOU, GroupsOU); + } - /// - /// Updates ftp account. - /// - /// Accoun to update. + UpdateAccount(account); + + break; + + default: + // Create user account. + SystemUser user = new SystemUser(); + user.Name = account.Name; + user.FullName = account.Name; + user.Description = "WebsitePanel System Account"; + user.MemberOf = new string[] {FtpGroupName}; + user.Password = account.Password; + user.PasswordCantChange = true; + user.PasswordNeverExpires = true; + user.AccountDisabled = !account.Enabled; + user.System = true; + + // Create in the operating system. + if (SecurityUtils.UserExists(user.Name, ServerSettings, UsersOU)) + { + SecurityUtils.DeleteUser(user.Name, ServerSettings, UsersOU); + } + SecurityUtils.CreateUser(user, ServerSettings, UsersOU, GroupsOU); + + // Prepare account's home folder. + this.EnsureUserHomeFolderExists(account.Folder, account.Name, account.CanRead, account.CanWrite); + + // Future account will be given virtual directory under default ftp web site. + this.ftpSitesService.CreateFtpAccount(this.SiteId, account); + // + this.ftpSitesService.ConfigureConnectAs(account.Folder, this.SiteId, account.VirtualPath, + this.GetQualifiedAccountName(account.Name), account.Password, true); + break; + } + } + + /// + /// Updates ftp account. + /// + /// Accoun to update. public void UpdateAccount(FtpAccount account) { - // Change user account state and password (if required). - SystemUser user = SecurityUtils.GetUser(account.Name, ServerSettings, UsersOU); - user.Password = account.Password; - user.AccountDisabled = !account.Enabled; - SecurityUtils.UpdateUser(user, ServerSettings, UsersOU, GroupsOU); - // Update iis configuration. - this.FillIisFromFtpAccount(account); + var user = SecurityUtils.GetUser(account.Name, ServerSettings, UsersOU); + + switch (UserIsolationMode) + { + case Mode.ActiveDirectory: + var ftpRoot = AdFtpRoot.ToLower(); + var ftpDir = account.Folder.ToLower().Replace(ftpRoot, ""); + + var oldDir = user.MsIIS_FTPDir; + + user.Password = account.Password; + user.PasswordCantChange = true; + user.PasswordNeverExpires = true; + user.Description = "WebsitePanel FTP Account with AD User Isolation"; + user.MemberOf = new[] {FtpGroupName}; + user.AccountDisabled = !account.Enabled; + user.MsIIS_FTPRoot = ftpRoot; + user.MsIIS_FTPDir = ftpDir; + user.System = true; + + SecurityUtils.UpdateUser(user, ServerSettings, UsersOU, GroupsOU); + + // Set NTFS permissions + var userPermission = GetUserPermission(account.Name, account.Folder); + + // Do we need to change the NTFS permissions? i.e. is users home dir changed or are permissions changed? + if (oldDir != ftpDir || account.CanRead != userPermission.Read || account.CanWrite != userPermission.Write) + { + // First get sid of user account + var sid = SecurityUtils.GetAccountSid(account.Name, ServerSettings, UsersOU, GroupsOU); + + // Remove the permissions set for this account on previous folder + SecurityUtils.RemoveNtfsPermissionsBySid(Path.Combine(ftpRoot, oldDir), sid); + + // If no permissions is to be set, exit + if (!account.CanRead && !account.CanWrite) + { + return; + } + + // Add the new permissions + var ntfsPermissions = account.CanRead ? NTFSPermission.Read : NTFSPermission.Write; + if (account.CanRead && account.CanWrite) + { + ntfsPermissions = NTFSPermission.Modify; + } + + SecurityUtils.GrantNtfsPermissionsBySid(account.Folder, sid, ntfsPermissions, true, true); + } + break; + + default: + + // Change user account state and password (if required). + user.Password = account.Password; + user.AccountDisabled = !account.Enabled; + SecurityUtils.UpdateUser(user, ServerSettings, UsersOU, GroupsOU); + // Update iis configuration. + this.FillIisFromFtpAccount(account); + break; + } } - /// - /// Deletes account with given name. - /// - /// Account's name to be deleted. + /// + /// Deletes account with given name. + /// + /// Account's name to be deleted. public void DeleteAccount(string accountName) { - string virtualDirectory = String.Format("/{0}", accountName); - string currentPhysicalPath = this.ftpSitesService.GetSitePhysicalPath(this.SiteId, virtualDirectory); + switch (UserIsolationMode) + { + case Mode.ActiveDirectory: + var account = GetAccount(accountName); - // Delete virtual directory - this.ftpSitesService.DeleteFtpAccount(this.SiteId, virtualDirectory); + // Remove the NTFS permissions first + SecurityUtils.RemoveNtfsPermissions(account.Folder, account.Name, ServerSettings, UsersOU, GroupsOU); - this.ftpSitesService.CommitChanges(); + if (SecurityUtils.UserExists(accountName, ServerSettings, UsersOU)) + { + SecurityUtils.DeleteUser(accountName, ServerSettings, UsersOU); + } + break; - // Remove permissions - RemoveFtpFolderPermissions(currentPhysicalPath, accountName); + default: + string virtualDirectory = String.Format("/{0}", accountName); + string currentPhysicalPath = this.ftpSitesService.GetSitePhysicalPath(this.SiteId, virtualDirectory); - // Delete system user account - if (SecurityUtils.UserExists(accountName, ServerSettings, UsersOU)) - { - SecurityUtils.DeleteUser(accountName, ServerSettings, UsersOU); - } + // Delete virtual directory + this.ftpSitesService.DeleteFtpAccount(this.SiteId, virtualDirectory); + + this.ftpSitesService.CommitChanges(); + + // Remove permissions + RemoveFtpFolderPermissions(currentPhysicalPath, accountName); + + // Delete system user account + if (SecurityUtils.UserExists(accountName, ServerSettings, UsersOU)) + { + SecurityUtils.DeleteUser(accountName, ServerSettings, UsersOU); + } + break; + } } - /// + /// /// Fills iis configuration from ftp account. /// /// Ftp account to fill from. @@ -519,6 +675,7 @@ namespace WebsitePanel.Providers.FTP ftpSite.AllowAnonymous = iisFtpSite.Security.Authentication.AnonymousAuthentication.Enabled; ftpSite.AnonymousUsername = iisFtpSite.Security.Authentication.AnonymousAuthentication.UserName; ftpSite.AnonymousUserPassword = iisFtpSite.Security.Authentication.AnonymousAuthentication.Password; + ftpSite["UserIsolationMode"] = iisFtpSite.UserIsolation.Mode.ToString(); // Logging settings. ftpSite[FtpSite.MSFTP7_SITE_ID] = iisFtpSite.SiteServiceId; if (iisFtpSite.LogFile.Enabled) diff --git a/WebsitePanel/Sources/WebsitePanel.Server.Utils/SecurityUtils.cs b/WebsitePanel/Sources/WebsitePanel.Server.Utils/SecurityUtils.cs index a2fcd1a9..27ddaa75 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server.Utils/SecurityUtils.cs +++ b/WebsitePanel/Sources/WebsitePanel.Server.Utils/SecurityUtils.cs @@ -511,6 +511,8 @@ namespace WebsitePanel.Providers.Utils user.PasswordCantChange = ((userFlags & ADAccountOptions.UF_PASSWD_CANT_CHANGE) != 0); user.PasswordNeverExpires = ((userFlags & ADAccountOptions.UF_DONT_EXPIRE_PASSWD) != 0); user.AccountDisabled = ((userFlags & ADAccountOptions.UF_ACCOUNTDISABLE) != 0); + user.MsIIS_FTPDir = GetObjectProperty(objUser, "msIIS-FTPDir").ToString(); + user.MsIIS_FTPRoot = GetObjectProperty(objUser, "msIIS-FTPRoot").ToString(); // get user groups user.MemberOf = GetUserGroups(objUser); @@ -727,6 +729,12 @@ namespace WebsitePanel.Providers.Utils objUser.Properties["description"].Value = String.IsNullOrEmpty(user.Description) ? "WebsitePanel System Account" : user.Description; + if (user.MsIIS_FTPDir != string.Empty) + { + SetObjectProperty(objUser, "msIIS-FTPDir", user.MsIIS_FTPDir); + SetObjectProperty(objUser, "msIIS-FTPRoot", user.MsIIS_FTPRoot); + } + ADAccountOptions userFlags = ADAccountOptions.UF_NORMAL_ACCOUNT; if (user.PasswordCantChange) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/MSFTP70_Settings.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/MSFTP70_Settings.ascx.resx index d6149f97..4021bbe7 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/MSFTP70_Settings.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/MSFTP70_Settings.ascx.resx @@ -112,10 +112,10 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Yes @@ -138,4 +138,7 @@ <Select FTP Site> + + FTP RootDir: + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/MSFTP70_Settings.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/MSFTP70_Settings.ascx index 831772d8..bb35b384 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/MSFTP70_Settings.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/MSFTP70_Settings.ascx @@ -1,45 +1,61 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="MSFTP70_Settings.ascx.cs" Inherits="WebsitePanel.Portal.ProviderControls.MSFTP70_Settings" %> <%@ Register Src="Common_ActiveDirectoryIntegration.ascx" TagName="ActiveDirectoryIntegration" TagPrefix="uc1" %> <%@ Register Src="../UserControls/SelectIPAddress.ascx" TagName="SelectIPAddress" TagPrefix="uc1" %> - - - - + + + + + +
- - + + + + - - - - - - - - +
+ + -
- - -
- - +
+ + + + + + + + + + + +
+ + + +
+ + + + +
+
+
+ + + + - - - - - - - - + + - -
+ +
- - - -
- - - - +
+
\ No newline at end of file +
+ +
+ + + +
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/MSFTP70_Settings.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/MSFTP70_Settings.ascx.cs index 9caf61df..71c18d09 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/MSFTP70_Settings.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/MSFTP70_Settings.ascx.cs @@ -27,10 +27,12 @@ // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. using System; +using System.Collections.Generic; using System.Data; using System.Configuration; using System.Collections; using System.Collections.Specialized; +using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; @@ -51,7 +53,8 @@ namespace WebsitePanel.Portal.ProviderControls { int selectedAddressid = this.FindAddressByText(settings["SharedIP"]); ipAddress.AddressId = (selectedAddressid > 0) ? selectedAddressid : 0; - txtSiteId.Text = settings["SiteId"]; + BindSiteId(settings); + txtAdFtpRoot.Text = settings["AdFtpRoot"]; txtFtpGroupName.Text = settings["FtpGroupName"]; chkBuildUncFilesPath.Checked = Utils.ParseBool(settings["BuildUncFilesPath"], false); ActiveDirectoryIntegration.BindSettings(settings); @@ -75,7 +78,11 @@ namespace WebsitePanel.Portal.ProviderControls { settings["SharedIP"] = String.Empty; } - settings["SiteId"] = txtSiteId.Text.Trim(); + settings["SiteId"] = ddlSite.SelectedValue; + if (!string.IsNullOrWhiteSpace(txtAdFtpRoot.Text)) + { + settings["AdFtpRoot"] = txtAdFtpRoot.Text.Trim(); + } settings["FtpGroupName"] = txtFtpGroupName.Text.Trim(); settings["BuildUncFilesPath"] = chkBuildUncFilesPath.Checked.ToString(); ActiveDirectoryIntegration.SaveSettings(settings); @@ -92,5 +99,31 @@ namespace WebsitePanel.Portal.ProviderControls } return 0; } + + private void BindSiteId(StringDictionary settings) + { + var sites = ES.Services.FtpServers.GetFtpSites(PanelRequest.ServiceId); + + foreach (var site in sites) + { + var item = new ListItem(site.Name + " (User Isolation Mode: " + site["UserIsolationMode"] + ")", site.Name); + + if (item.Value == settings["SiteId"]) + { + item.Selected = true; + } + + ddlSite.Items.Add(item); + } + + ddlSite_SelectedIndexChanged(this, null); + } + + protected void ddlSite_SelectedIndexChanged(object sender, EventArgs e) + { + var isActiveDirectoryUserIsolated = ddlSite.SelectedItem.Text.Contains("ActiveDirectory"); + FtpRootRow.Visible = isActiveDirectoryUserIsolated; + txtAdFtpRootReqValidator.Enabled= isActiveDirectoryUserIsolated; + } } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/MSFTP70_Settings.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/MSFTP70_Settings.ascx.designer.cs index 596afc56..b4f88c2a 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/MSFTP70_Settings.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/MSFTP70_Settings.ascx.designer.cs @@ -1,22 +1,15 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:2.0.50727.1378 // // Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// the code is regenerated. // //------------------------------------------------------------------------------ namespace WebsitePanel.Portal.ProviderControls { - /// - /// MSFTP70_Settings class. - /// - /// - /// Auto-generated class. - /// public partial class MSFTP70_Settings { /// @@ -47,13 +40,49 @@ namespace WebsitePanel.Portal.ProviderControls { protected global::System.Web.UI.WebControls.Label lblSite; /// - /// txtSiteId control. + /// ddlSite control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.TextBox txtSiteId; + protected global::System.Web.UI.WebControls.DropDownList ddlSite; + + /// + /// FtpRootRow control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow FtpRootRow; + + /// + /// lblAdFtpRoot control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblAdFtpRoot; + + /// + /// txtAdFtpRoot control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtAdFtpRoot; + + /// + /// txtAdFtpRootReqValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator txtAdFtpRootReqValidator; /// /// lblGroupName control. From c15aff08b09673d2c723809a1e8db0d51d5b0429 Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Mon, 15 Sep 2014 17:28:42 +0300 Subject: [PATCH 02/34] Change vip user icon, resize fields and change title in service levels policy page. --- .../Default/Images/Exchange/vip_user_16.png | Bin 353 -> 1128 bytes .../WebsitePanel/SettingsServiceLevels.ascx | 9 +++++---- .../WebsitePanel/SettingsServiceLevels.ascx.cs | 7 +++++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Images/Exchange/vip_user_16.png b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Images/Exchange/vip_user_16.png index e470ca6ed0fb1f9e18d9adfa0eb894d7c7f553a1..05fb2d5d30ba3956eea1ba712d6d9196d4ead6b6 100644 GIT binary patch literal 1128 zcmaJ=TSyd97#>sXs#rl65t^pxA>6s_s_RZ}rZc-W(U`3ZE^tCr_X z$)7?HM2@sVjNv`cTa&W!f8OVx3f|_TNCMTs29#86KvZb39*~luG=dmVwAPISpo}0g zNj;uG33(N-LW5R34DA{gW)nnNxoatEGeBfLXw=Ox_2K*_iqy3*Ra-2xvL%2feMOrM zYTByeYFo1!(x~#KWSPrj0Rtd~bd3$B!@FT>RF}tR&&*KdC z)~B*1ELpK1pmSY*#&v1Sp7vuweo@L3gkHX$;t$~k;(J^267N(jIvUr9` zCX;kBKtsEc;Xipg5t)L_yXMawcTnGRA+6-Z*3!hBlSH9isva1l=M2L!Q{ z<03_+LNp+7L2MJF{>sWwiYr33#Q-KsakW3(Kw7Rh2!@3{i@?@50WE4ngB(qm*VD(s zrqvtcYUyL)(sCIb4CA%+uQsPlcy_$w_|W3Z_}Bvz&$^9=y76kBtOtzxkeLomox4>$~**#;FsX z_t#6t4}B4JXV2_c1CL&xD?Qo!c24Hq<8N-d%Z6_EKFsQPqQ0LqJDNF(t2o(J*|2$S z-AH0&*N%NNzlvM>KOSg5*7L6KRzcs|9aZv?&in^*$?j>{?d6^8cDD@gk(RBw_+k1H zPx#1ZP1_K>z@;j|==^1poj532;bRa{vGi!~g&e!~vBn4jTXf0QN~lK~y+Ty_B&L zgdh+_Da8^j!N3A2!OYYSOvxz0jMNfL$SuL40!!GN&mA0dAYkDAnVoT9eSCIT89gNS z5SK2&^E^}Awl$>LQT9v^~(^#Mrp0SpaQ6u$z zAH--6h#c?x?%jrj+#rvKK9&AO76X5 zTpu4sNyrK7f0ggSxGqMjCTi;a|DRB)B&GcqkfI9+xR9>U00000NkvXXu0mjfCIgJv diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsServiceLevels.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsServiceLevels.ascx index ddf3f04f..a7b5d67b 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsServiceLevels.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsServiceLevels.ascx @@ -46,8 +46,8 @@ - - + + @@ -56,8 +56,9 @@ - - + + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsServiceLevels.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsServiceLevels.ascx.cs index d353f97f..be77f5e9 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsServiceLevels.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsServiceLevels.ascx.cs @@ -63,6 +63,13 @@ namespace WebsitePanel.Portal BindServiceLevels(); txtStatus.Visible = false; + + try + { + //Change container title + ((Label)this.Parent.Parent.Parent.Parent.Parent.FindControl(WebsitePanel.WebPortal.DefaultPage.MODULE_TITLE_CONTROL_ID)).Text = "Service Levels"; + } + catch { /*to do*/ } } From b8b62f71347db08fbbe2e17fe1df0f87453aa6de Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Mon, 15 Sep 2014 20:51:29 -0400 Subject: [PATCH 03/34] Added tag build-2.1.0.419 for changeset f50d982ab8c2 From 732f827e827c114b776890fbb01371fa900cb63f Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Tue, 16 Sep 2014 12:37:59 +0300 Subject: [PATCH 04/34] fix bug in SpaceQuotasControl. --- .../DesktopModules/WebsitePanel/SpaceQuotasControl.ascx | 2 +- .../WebsitePanel/SpaceQuotasControl.ascx.cs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotasControl.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotasControl.ascx index 2c94c5ff..004c1c4a 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotasControl.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotasControl.ascx @@ -13,7 +13,7 @@
- <%# GetQuotaTitle((string)Eval("QuotaName"), (string)Eval("QuotaDescription"))%>: + <%# GetQuotaTitle((string)Eval("QuotaName"), (object)Eval("QuotaDescription"))%>:
Date: Tue, 16 Sep 2014 16:02:32 +0300 Subject: [PATCH 05/34] fix issue with "Service Level" DropDownList on UserGeneralSetings page. --- .../WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx.cs | 3 +-- .../ExchangeServer/OrganizationUserGeneralSettings.ascx.cs | 7 ++++++- .../WebsitePanel/ExchangeServer/OrganizationUsers.ascx.cs | 3 +-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx.cs index 6473cd61..b3fa7da7 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx.cs @@ -204,7 +204,7 @@ namespace WebsitePanel.Portal.ExchangeServer bool enable = !string.IsNullOrEmpty(serviceLevel.LevelName); enable = enable ? cntx.Quotas.ContainsKey(Quotas.SERVICE_LEVELS + serviceLevel.LevelName) : false; - enable = enable ? cntx.Quotas[Quotas.SERVICE_LEVELS + serviceLevel.LevelName].QuotaAllocatedValue > 0 : false; + enable = enable ? cntx.Quotas[Quotas.SERVICE_LEVELS + serviceLevel.LevelName].QuotaAllocatedValue != 0 : false; if (!enable) { @@ -212,7 +212,6 @@ namespace WebsitePanel.Portal.ExchangeServer serviceLevel.LevelDescription = ""; } - //return ServiceLevels.Where(x => x.LevelId == levelId).DefaultIfEmpty(new ServiceLevel { LevelName = "", LevelDescription = "" }).FirstOrDefault(); return serviceLevel; } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserGeneralSettings.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserGeneralSettings.ascx.cs index 27a541d6..7fe1cae5 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserGeneralSettings.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserGeneralSettings.ascx.cs @@ -134,12 +134,17 @@ namespace WebsitePanel.Portal.HostedSolution addLevel = addLevel && cntx.Quotas.ContainsKey(Quotas.SERVICE_LEVELS + serviceLevel.LevelName); - addLevel = addLevel ? cntx.Quotas[Quotas.SERVICE_LEVELS + serviceLevel.LevelName].QuotaAllocatedValue > 0 : addLevel; + addLevel = addLevel ? cntx.Quotas[Quotas.SERVICE_LEVELS + serviceLevel.LevelName].QuotaAllocatedValue != 0 : addLevel; if (addLevel) { ddlServiceLevels.Items.Add(new ListItem(serviceLevel.LevelName, serviceLevel.LevelId.ToString())); + } + bool levelInDDL = ddlServiceLevels.Items.FindByValue(serviceLevel.LevelId.ToString()) != null; + + if (levelInDDL) + { ddlServiceLevels.Items.FindByValue(string.Empty).Selected = false; ddlServiceLevels.Items.FindByValue(serviceLevel.LevelId.ToString()).Selected = true; } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx.cs index ffe51701..1d9941bb 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx.cs @@ -317,7 +317,7 @@ namespace WebsitePanel.Portal.HostedSolution bool enable = !string.IsNullOrEmpty(serviceLevel.LevelName); enable = enable ? cntx.Quotas.ContainsKey(Quotas.SERVICE_LEVELS + serviceLevel.LevelName) : false; - enable = enable ? cntx.Quotas[Quotas.SERVICE_LEVELS + serviceLevel.LevelName].QuotaAllocatedValue > 0 : false; + enable = enable ? cntx.Quotas[Quotas.SERVICE_LEVELS + serviceLevel.LevelName].QuotaAllocatedValue != 0 : false; if (!enable) { @@ -325,7 +325,6 @@ namespace WebsitePanel.Portal.HostedSolution serviceLevel.LevelDescription = ""; } - //return ServiceLevels.Where(x => x.LevelId == levelId).DefaultIfEmpty(new ServiceLevel { LevelName = "", LevelDescription = "" }).FirstOrDefault(); return serviceLevel; } } From 07dc31c51ecd1085a2305cbd34d9c67138160ec5 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Tue, 16 Sep 2014 12:05:46 -0400 Subject: [PATCH 06/34] Added tag build-2.1.0.420 for changeset ff475e68c6ec From 9b57f040b94cfb2483423a60d5d7ddd77d469400 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Fri, 19 Sep 2014 17:55:39 -0400 Subject: [PATCH 07/34] User Principal name should not update when changing primary email address. Comment out. --- .../Exchange2013.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Exchange2013/Exchange2013.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Exchange2013/Exchange2013.cs index 730de2fa..95cf2a6f 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Exchange2013/Exchange2013.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Exchange2013/Exchange2013.cs @@ -2819,7 +2819,7 @@ namespace WebsitePanel.Providers.HostedSolution Command cmd = new Command("Set-Mailbox"); cmd.Parameters.Add("Identity", accountName); cmd.Parameters.Add("PrimarySmtpAddress", primaryEmail); - cmd.Parameters.Add("UserPrincipalName", primaryEmail); + //cmd.Parameters.Add("UserPrincipalName", primaryEmail); cmd.Parameters.Add("WindowsEmailAddress", primaryEmail); ExecuteShellCommand(runSpace, cmd); From bc39c195767ae04515d186a62adf9543f9650669 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Fri, 19 Sep 2014 21:07:56 -0400 Subject: [PATCH 08/34] Protect UPN from Deletion when it's not the primary email address --- .../ExchangeServer/ExchangeServerController.cs | 3 +++ .../ExchangeServer/ExchangeMailboxEmailAddresses.ascx | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs index cd3cb5d5..025f4c50 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs @@ -1347,11 +1347,14 @@ namespace WebsitePanel.EnterpriseServer if (String.Compare(account.PrimaryEmailAddress, email.EmailAddress, true) == 0) { email.IsPrimary = true; + email.ProtectDelete = true; } if (String.Compare(account.UserPrincipalName, email.EmailAddress, true) == 0) { email.IsUserPrincipalName = true; + email.ProtectDelete = true; + } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxEmailAddresses.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxEmailAddresses.ascx index a71c2fa0..d056906f 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxEmailAddresses.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxEmailAddresses.ascx @@ -67,7 +67,7 @@ - + From e8b620107a60412d3fd030918620abbd06c5e745 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Fri, 19 Sep 2014 21:15:24 -0400 Subject: [PATCH 09/34] Revert Last Changeset --- .../ExchangeServer/ExchangeServerController.cs | 3 --- .../ExchangeServer/ExchangeMailboxEmailAddresses.ascx | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs index 025f4c50..cd3cb5d5 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/ExchangeServer/ExchangeServerController.cs @@ -1347,14 +1347,11 @@ namespace WebsitePanel.EnterpriseServer if (String.Compare(account.PrimaryEmailAddress, email.EmailAddress, true) == 0) { email.IsPrimary = true; - email.ProtectDelete = true; } if (String.Compare(account.UserPrincipalName, email.EmailAddress, true) == 0) { email.IsUserPrincipalName = true; - email.ProtectDelete = true; - } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxEmailAddresses.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxEmailAddresses.ascx index d056906f..a71c2fa0 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxEmailAddresses.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxEmailAddresses.ascx @@ -67,7 +67,7 @@ - + From bfa7a05944dc85fbd2fa702fde71a12026e6b15e Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Fri, 19 Sep 2014 21:27:24 -0400 Subject: [PATCH 10/34] Added tag build-2.1.0.424 for changeset 405d564d78e3 From a99b5455cc29cd635e6121a9ffca603a07fff8dd Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Tue, 23 Sep 2014 08:54:02 -0400 Subject: [PATCH 11/34] Added tag build-2.1.0.425 for changeset e138869966a2 From b5444f10ec0f8f587124096f0c4ba9db9ee1c6bc Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Tue, 23 Sep 2014 18:15:36 +0300 Subject: [PATCH 12/34] Add service levels quota view to space stats & org stats pages. Change quota type. Expand collapsible panel when user have level id on user settings page. --- WebsitePanel/Database/update_db.sql | 169 ++++++++++++++++++ .../Packages/PackageController.cs | 1 + .../OrganizationHome.ascx.resx | 3 + .../ExchangeServer/OrganizationHome.ascx | 8 + .../ExchangeServer/OrganizationHome.ascx.cs | 45 +++++ .../OrganizationHome.ascx.designer.cs | 18 ++ .../OrganizationUserGeneralSettings.ascx.cs | 2 + .../WebsitePanel/SpaceQuotas.ascx | 10 +- .../WebsitePanel/SpaceQuotas.ascx.cs | 74 ++++++++ .../WebsitePanel/SpaceQuotas.ascx.designer.cs | 64 +------ 10 files changed, 334 insertions(+), 60 deletions(-) diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index 796722b9..bd6a1b00 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -5205,4 +5205,173 @@ FROM SupportServiceLevels AS SL INNER JOIN ExchangeAccounts AS EA ON SL.LevelID = EA.LevelID WHERE EA.LevelID = @LevelID RETURN +GO + +-- Service Level Quotas, change type +UPDATE Quotas +SET QuotaTypeID = 2 +WHERE QuotaName like 'ServiceLevel.%' +GO + +ALTER FUNCTION [dbo].[CalculateQuotaUsage] +( + @PackageID int, + @QuotaID int +) +RETURNS int +AS + BEGIN + + DECLARE @QuotaTypeID int + DECLARE @QuotaName nvarchar(50) + SELECT @QuotaTypeID = QuotaTypeID, @QuotaName = QuotaName FROM Quotas + WHERE QuotaID = @QuotaID + + IF @QuotaTypeID <> 2 + RETURN 0 + + DECLARE @Result int + + IF @QuotaID = 52 -- diskspace + SET @Result = dbo.CalculatePackageDiskspace(@PackageID) + ELSE IF @QuotaID = 51 -- bandwidth + SET @Result = dbo.CalculatePackageBandwidth(@PackageID) + ELSE IF @QuotaID = 53 -- domains + SET @Result = (SELECT COUNT(D.DomainID) FROM PackagesTreeCache AS PT + INNER JOIN Domains AS D ON D.PackageID = PT.PackageID + WHERE IsSubDomain = 0 AND IsInstantAlias = 0 AND IsDomainPointer = 0 AND PT.ParentPackageID = @PackageID) + ELSE IF @QuotaID = 54 -- sub-domains + SET @Result = (SELECT COUNT(D.DomainID) FROM PackagesTreeCache AS PT + INNER JOIN Domains AS D ON D.PackageID = PT.PackageID + WHERE IsSubDomain = 1 AND IsInstantAlias = 0 AND IsDomainPointer = 0 AND PT.ParentPackageID = @PackageID) + ELSE IF @QuotaID = 220 -- domain pointers + SET @Result = (SELECT COUNT(D.DomainID) FROM PackagesTreeCache AS PT + INNER JOIN Domains AS D ON D.PackageID = PT.PackageID + WHERE IsDomainPointer = 1 AND PT.ParentPackageID = @PackageID) + ELSE IF @QuotaID = 71 -- scheduled tasks + SET @Result = (SELECT COUNT(S.ScheduleID) FROM PackagesTreeCache AS PT + INNER JOIN Schedule AS S ON S.PackageID = PT.PackageID + WHERE PT.ParentPackageID = @PackageID) + ELSE IF @QuotaID = 305 -- RAM of VPS + SET @Result = (SELECT SUM(CAST(SIP.PropertyValue AS int)) FROM ServiceItemProperties AS SIP + INNER JOIN ServiceItems AS SI ON SIP.ItemID = SI.ItemID + INNER JOIN PackagesTreeCache AS PT ON SI.PackageID = PT.PackageID + WHERE SIP.PropertyName = 'RamSize' AND PT.ParentPackageID = @PackageID) + ELSE IF @QuotaID = 306 -- HDD of VPS + SET @Result = (SELECT SUM(CAST(SIP.PropertyValue AS int)) FROM ServiceItemProperties AS SIP + INNER JOIN ServiceItems AS SI ON SIP.ItemID = SI.ItemID + INNER JOIN PackagesTreeCache AS PT ON SI.PackageID = PT.PackageID + WHERE SIP.PropertyName = 'HddSize' AND PT.ParentPackageID = @PackageID) + ELSE IF @QuotaID = 309 -- External IP addresses of VPS + SET @Result = (SELECT COUNT(PIP.PackageAddressID) FROM PackageIPAddresses AS PIP + INNER JOIN IPAddresses AS IP ON PIP.AddressID = IP.AddressID + INNER JOIN PackagesTreeCache AS PT ON PIP.PackageID = PT.PackageID + WHERE PT.ParentPackageID = @PackageID AND IP.PoolID = 3) + ELSE IF @QuotaID = 100 -- Dedicated Web IP addresses + SET @Result = (SELECT COUNT(PIP.PackageAddressID) FROM PackageIPAddresses AS PIP + INNER JOIN IPAddresses AS IP ON PIP.AddressID = IP.AddressID + INNER JOIN PackagesTreeCache AS PT ON PIP.PackageID = PT.PackageID + WHERE PT.ParentPackageID = @PackageID AND IP.PoolID = 2) + ELSE IF @QuotaID = 350 -- RAM of VPSforPc + SET @Result = (SELECT SUM(CAST(SIP.PropertyValue AS int)) FROM ServiceItemProperties AS SIP + INNER JOIN ServiceItems AS SI ON SIP.ItemID = SI.ItemID + INNER JOIN PackagesTreeCache AS PT ON SI.PackageID = PT.PackageID + WHERE SIP.PropertyName = 'Memory' AND PT.ParentPackageID = @PackageID) + ELSE IF @QuotaID = 351 -- HDD of VPSforPc + SET @Result = (SELECT SUM(CAST(SIP.PropertyValue AS int)) FROM ServiceItemProperties AS SIP + INNER JOIN ServiceItems AS SI ON SIP.ItemID = SI.ItemID + INNER JOIN PackagesTreeCache AS PT ON SI.PackageID = PT.PackageID + WHERE SIP.PropertyName = 'HddSize' AND PT.ParentPackageID = @PackageID) + ELSE IF @QuotaID = 354 -- External IP addresses of VPSforPc + SET @Result = (SELECT COUNT(PIP.PackageAddressID) FROM PackageIPAddresses AS PIP + INNER JOIN IPAddresses AS IP ON PIP.AddressID = IP.AddressID + INNER JOIN PackagesTreeCache AS PT ON PIP.PackageID = PT.PackageID + WHERE PT.ParentPackageID = @PackageID AND IP.PoolID = 3) + ELSE IF @QuotaID = 319 -- BB Users + SET @Result = (SELECT COUNT(ea.AccountID) FROM ExchangeAccounts ea + INNER JOIN BlackBerryUsers bu ON ea.AccountID = bu.AccountID + INNER JOIN ServiceItems si ON ea.ItemID = si.ItemID + INNER JOIN PackagesTreeCache pt ON si.PackageID = pt.PackageID + WHERE pt.ParentPackageID = @PackageID) + ELSE IF @QuotaID = 320 -- OCS Users + SET @Result = (SELECT COUNT(ea.AccountID) FROM ExchangeAccounts ea + INNER JOIN OCSUsers ocs ON ea.AccountID = ocs.AccountID + INNER JOIN ServiceItems si ON ea.ItemID = si.ItemID + INNER JOIN PackagesTreeCache pt ON si.PackageID = pt.PackageID + WHERE pt.ParentPackageID = @PackageID) + ELSE IF @QuotaID = 206 -- HostedSolution.Users + SET @Result = (SELECT COUNT(ea.AccountID) FROM ExchangeAccounts AS ea + INNER JOIN ServiceItems si ON ea.ItemID = si.ItemID + INNER JOIN PackagesTreeCache pt ON si.PackageID = pt.PackageID + WHERE pt.ParentPackageID = @PackageID AND ea.AccountType IN (1,5,6,7)) + ELSE IF @QuotaID = 78 -- Exchange2007.Mailboxes + SET @Result = (SELECT COUNT(ea.AccountID) FROM ExchangeAccounts AS ea + INNER JOIN ServiceItems si ON ea.ItemID = si.ItemID + INNER JOIN PackagesTreeCache pt ON si.PackageID = pt.PackageID + WHERE pt.ParentPackageID = @PackageID + AND ea.AccountType IN (1) + AND ea.MailboxPlanId IS NOT NULL) + ELSE IF @QuotaID = 77 -- Exchange2007.DiskSpace + SET @Result = (SELECT SUM(B.MailboxSizeMB) FROM ExchangeAccounts AS ea + INNER JOIN ExchangeMailboxPlans AS B ON ea.MailboxPlanId = B.MailboxPlanId + INNER JOIN ServiceItems si ON ea.ItemID = si.ItemID + INNER JOIN PackagesTreeCache pt ON si.PackageID = pt.PackageID + WHERE pt.ParentPackageID = @PackageID) + ELSE IF @QuotaID = 370 -- Lync.Users + SET @Result = (SELECT COUNT(ea.AccountID) FROM ExchangeAccounts AS ea + INNER JOIN LyncUsers lu ON ea.AccountID = lu.AccountID + INNER JOIN ServiceItems si ON ea.ItemID = si.ItemID + INNER JOIN PackagesTreeCache pt ON si.PackageID = pt.PackageID + WHERE pt.ParentPackageID = @PackageID) + ELSE IF @QuotaID = 376 -- Lync.EVUsers + SET @Result = (SELECT COUNT(ea.AccountID) FROM ExchangeAccounts AS ea + INNER JOIN LyncUsers lu ON ea.AccountID = lu.AccountID + INNER JOIN LyncUserPlans lp ON lu.LyncUserPlanId = lp.LyncUserPlanId + INNER JOIN ServiceItems si ON ea.ItemID = si.ItemID + INNER JOIN PackagesTreeCache pt ON si.PackageID = pt.PackageID + WHERE pt.ParentPackageID = @PackageID AND lp.EnterpriseVoice = 1) + ELSE IF @QuotaID = 381 -- Dedicated Lync Phone Numbers + SET @Result = (SELECT COUNT(PIP.PackageAddressID) FROM PackageIPAddresses AS PIP + INNER JOIN IPAddresses AS IP ON PIP.AddressID = IP.AddressID + INNER JOIN PackagesTreeCache AS PT ON PIP.PackageID = PT.PackageID + WHERE PT.ParentPackageID = @PackageID AND IP.PoolID = 5) + ELSE IF @QuotaID = 430 -- Enterprise Storage + SET @Result = (SELECT SUM(ESF.FolderQuota) FROM EnterpriseFolders AS ESF + INNER JOIN ServiceItems SI ON ESF.ItemID = SI.ItemID + INNER JOIN PackagesTreeCache PT ON SI.PackageID = PT.PackageID + WHERE PT.ParentPackageID = @PackageID) + ELSE IF @QuotaID = 431 -- Enterprise Storage Folders + SET @Result = (SELECT COUNT(ESF.EnterpriseFolderID) FROM EnterpriseFolders AS ESF + INNER JOIN ServiceItems SI ON ESF.ItemID = SI.ItemID + INNER JOIN PackagesTreeCache PT ON SI.PackageID = PT.PackageID + WHERE PT.ParentPackageID = @PackageID) + ELSE IF @QuotaID = 423 -- HostedSolution.SecurityGroups + SET @Result = (SELECT COUNT(ea.AccountID) FROM ExchangeAccounts AS ea + INNER JOIN ServiceItems si ON ea.ItemID = si.ItemID + INNER JOIN PackagesTreeCache pt ON si.PackageID = pt.PackageID + WHERE pt.ParentPackageID = @PackageID AND ea.AccountType IN (8,9)) + ELSE IF @QuotaName like 'ServiceLevel.%' -- Support Service Level Quota + BEGIN + DECLARE @LevelID int + + SELECT @LevelID = LevelID FROM SupportServiceLevels + WHERE LevelName = REPLACE(@QuotaName,'ServiceLevel.','') + + IF (@LevelID IS NOT NULL) + SET @Result = (SELECT COUNT(EA.AccountID) + FROM SupportServiceLevels AS SL + INNER JOIN ExchangeAccounts AS EA ON SL.LevelID = EA.LevelID + INNER JOIN ServiceItems SI ON EA.ItemID = SI.ItemID + INNER JOIN PackagesTreeCache PT ON SI.PackageID = PT.PackageID + WHERE EA.LevelID = @LevelID AND PT.ParentPackageID = @PackageID) + ELSE SET @Result = 0 + END + ELSE + SET @Result = (SELECT COUNT(SI.ItemID) FROM Quotas AS Q + INNER JOIN ServiceItems AS SI ON SI.ItemTypeID = Q.ItemTypeID + INNER JOIN PackagesTreeCache AS PT ON SI.PackageID = PT.PackageID AND PT.ParentPackageID = @PackageID + WHERE Q.QuotaID = @QuotaID) + + RETURN @Result + END GO \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Packages/PackageController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Packages/PackageController.cs index 17bef13f..e9f2f848 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Packages/PackageController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Packages/PackageController.cs @@ -365,6 +365,7 @@ namespace WebsitePanel.EnterpriseServer quota.QuotaId = (int)dr["QuotaId"]; quota.GroupId = (int)dr["GroupId"]; quota.QuotaName = (string)dr["QuotaName"]; + quota.QuotaDescription = ((object)dr["QuotaDescription"]).GetType() == typeof(System.DBNull) ? string.Empty : (string)dr["QuotaDescription"]; quota.QuotaTypeId = (int)dr["QuotaTypeId"]; quota.QuotaAllocatedValue = (int)dr["QuotaValue"]; quota.QuotaUsedValue = (int)dr["QuotaUsedValue"]; diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/OrganizationHome.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/OrganizationHome.ascx.resx index 0fa1a42f..c6347b42 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/OrganizationHome.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/OrganizationHome.ascx.resx @@ -219,4 +219,7 @@ Enterprise Storage + + Service Levels + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx index 4d7fa525..9f9e8388 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx @@ -315,6 +315,14 @@ + + + + + + + +
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 cf461192..fdbf2648 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.cs @@ -27,6 +27,8 @@ // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. using System; +using System.Web.UI.HtmlControls; +using System.Web.UI.WebControls; using WebsitePanel.EnterpriseServer; using WebsitePanel.Providers.HostedSolution; @@ -279,6 +281,14 @@ namespace WebsitePanel.Portal.ExchangeServer } else enterpriseStorageStatsPanel.Visible = false; + + if (cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels)) + { + serviceLevelsStatsPanel.Visible = true; + BindServiceLevelsStats(cntx); + } + else + serviceLevelsStatsPanel.Visible = false; } private void BindCRMStats(OrganizationStatistics stats, OrganizationStatistics tenantStats) @@ -379,5 +389,40 @@ namespace WebsitePanel.Portal.ExchangeServer "SpaceID=" + PanelSecurity.PackageId.ToString()); } + private void BindServiceLevelsStats(PackageContext cntx) + { + foreach (var quota in Array.FindAll( + cntx.QuotasArray, x => x.QuotaName.Contains(Quotas.SERVICE_LEVELS))) + { + HtmlTableRow tr = new HtmlTableRow(); + tr.Attributes["class"] = "OrgStatsRow"; + HtmlTableCell col1 = new HtmlTableCell(); + col1.Attributes["class"] = "OrgStatsQuota"; + col1.Attributes["nowrap"] = "nowrap"; + HyperLink link = new HyperLink(); + link.ID = "lnk_" + quota.QuotaName.Replace(Quotas.SERVICE_LEVELS, "").Replace(" ", string.Empty).Trim(); + link.Text = quota.QuotaDescription; + + col1.Controls.Add(link); + + HtmlTableCell col2 = new HtmlTableCell(); + QuotaViewer quotaControl = (QuotaViewer)LoadControl("../UserControls/QuotaViewer.ascx"); + quotaControl.ID = quota.QuotaName.Replace(Quotas.SERVICE_LEVELS, "").Replace(" ", string.Empty).Trim() + "Stats"; + quotaControl.QuotaTypeId = quota.QuotaTypeId; + quotaControl.DisplayGauge = true; + quotaControl.QuotaValue = quota.QuotaAllocatedValue; + quotaControl.QuotaUsedValue = quota.QuotaUsedValue; + if (quota.QuotaAllocatedValue != -1) + quotaControl.QuotaAvailable = quota.QuotaAllocatedValue - quota.QuotaUsedValue; + + col2.Controls.Add(quotaControl); + + + tr.Controls.Add(col1); + tr.Controls.Add(col2); + serviceLevelsStatsPanel.Controls.Add(tr); + } + } + } } \ No newline at end of file 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 5c686b8e..062c57df 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 @@ -740,5 +740,23 @@ namespace WebsitePanel.Portal.ExchangeServer { /// To modify move field declaration from designer file to code-behind file. /// protected global::WebsitePanel.Portal.QuotaViewer enterpriseStorageFoldersStats; + + /// + /// serviceLevelsStatsPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel serviceLevelsStatsPanel; + + /// + /// locServiceLevels control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locServiceLevels; } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserGeneralSettings.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserGeneralSettings.ascx.cs index 7fe1cae5..ffc955e2 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserGeneralSettings.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserGeneralSettings.ascx.cs @@ -128,6 +128,8 @@ namespace WebsitePanel.Portal.HostedSolution if (user.LevelId > 0 && secServiceLevels.Visible) { + secServiceLevels.IsCollapsed = false; + ServiceLevel serviceLevel = ES.Services.Organizations.GetSupportServiceLevel(user.LevelId); bool addLevel = ddlServiceLevels.Items.FindByValue(serviceLevel.LevelId.ToString()) == null; diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx index 2507167b..dc5567f1 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx @@ -2,7 +2,7 @@ <%@ Register Src="UserControls/Quota.ascx" TagName="Quota" TagPrefix="wsp" %>
- +
- + --%> + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx.cs index 4ce4bc2f..c6a1b520 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx.cs @@ -131,6 +131,8 @@ namespace WebsitePanel.Portal protected override void OnPreRender(EventArgs e) { + // + AddServiceLevelsQuotas(); // SetVisibilityStatus4BriefQuotasBlock(); // @@ -175,5 +177,77 @@ namespace WebsitePanel.Portal } } } + + //private void AddServiceLevelsQuotas() + //{ + // foreach(var quota in Array.FindAll( + // cntx.QuotasArray, x => x.QuotaName.Contains(Quotas.SERVICE_LEVELS))) + // { + // HtmlGenericControl tr = new HtmlGenericControl(); + // tr.ID = "pnl_" + quota.QuotaName.Replace(Quotas.SERVICE_LEVELS, ""); + // tr.TagName = "tr"; + + // HtmlGenericControl col1 = new HtmlGenericControl(); + // col1.TagName = "td"; + // col1.Attributes["class"] = "SubHead"; + // col1.Attributes["nowrap"] = "nowrap"; + // Label lbl = new Label(); + // lbl.ID = "lbl_" + quota.QuotaName.Replace(Quotas.SERVICE_LEVELS, ""); + // lbl.Text = quota.QuotaDescription; + // col1.Controls.Add(lbl); + + // HtmlGenericControl col2 = new HtmlGenericControl(); + // col2.TagName = "td"; + // col2.Attributes["class"] = "Normal"; + // //Quota quotaControl = new Quota(); + // // quotaControl.ID = "quota_" + quota.QuotaName.Replace(Quotas.SERVICE_LEVELS, ""); + // // quotaControl.QuotaName = quota.QuotaName; + // // quotaControl.Viewer = new QuotaViewer(); + // // quotaControl.DisplayGauge = true; + // col2.InnerHtml = string.Format( + // "", + // "quota_" + quota.QuotaName.Replace(Quotas.SERVICE_LEVELS, ""), + // quota.QuotaName); + // //col2.Controls.Add(quotaControl); + + // tr.Controls.Add(col1); + // tr.Controls.Add(col2); + // tblQuotas.Controls.Add((Control)tr); + + // Control c1 = new Control(); + // } + //} + + private void AddServiceLevelsQuotas() + { + foreach (var quota in Array.FindAll( + cntx.QuotasArray, x => x.QuotaName.Contains(Quotas.SERVICE_LEVELS))) + { + HtmlTableRow tr = new HtmlTableRow(); + tr.ID = "pnl_" + quota.QuotaName.Replace(Quotas.SERVICE_LEVELS, "").Replace(" ", string.Empty).Trim(); + HtmlTableCell col1 = new HtmlTableCell(); + col1.Attributes["class"] = "SubHead"; + col1.Attributes["nowrap"] = "nowrap"; + Label lbl = new Label(); + lbl.ID = "lbl_" + quota.QuotaName.Replace(Quotas.SERVICE_LEVELS, "").Replace(" ", string.Empty).Trim(); + lbl.Text = quota.QuotaDescription; + + col1.Controls.Add(lbl); + + HtmlTableCell col2 = new HtmlTableCell(); + col2.Attributes["class"] = "Normal"; + Quota quotaControl = (Quota)LoadControl("UserControls/Quota.ascx"); + quotaControl.ID = "quota_" + quota.QuotaName.Replace(Quotas.SERVICE_LEVELS, "").Replace(" ", string.Empty).Trim(); + quotaControl.QuotaName = quota.QuotaName; + quotaControl.DisplayGauge = true; + + col2.Controls.Add(quotaControl); + + + tr.Controls.Add(col1); + tr.Controls.Add(col2); + tblQuotas.Controls.Add(tr); + } + } } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx.designer.cs index 6933af8b..e19a2d5f 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx.designer.cs @@ -1,31 +1,3 @@ -// Copyright (c) 2014, 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. @@ -40,6 +12,15 @@ namespace WebsitePanel.Portal { public partial class SpaceQuotas { + /// + /// tblQuotas control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTable tblQuotas; + /// /// pnlDiskspace control. /// @@ -148,33 +129,6 @@ namespace WebsitePanel.Portal { /// protected global::WebsitePanel.Portal.Quota quotaSubDomains; - /// - /// pnlDomainPointers control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.HtmlControls.HtmlTableRow pnlDomainPointers; - - /// - /// lblDomainPointers control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblDomainPointers; - - /// - /// quotaDomainPointers control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.Quota quotaDomainPointers; - /// /// pnlOrganizations control. /// From 4da84dc0f21093a4155a744a32f3a249512d78b9 Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Wed, 24 Sep 2014 10:17:50 +0300 Subject: [PATCH 13/34] change service level quota type when adding new service level --- WebsitePanel/Database/update_db.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index bd6a1b00..fe2f171b 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -4623,7 +4623,7 @@ BEGIN @QuotaOrderInGroup + 1, @CurQuotaName, @CurQuotaDescription, - 3, + 2, 0, NULL) END From 7f75a1e6bce084df85021a5e41089795d5d2be3e Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Wed, 24 Sep 2014 11:07:33 -0400 Subject: [PATCH 14/34] Added tag build-2.1.0.426 for changeset 0bb2462b74e2 From cc68a9bb4de893d1e66da8319e9390d3ca9be543 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Thu, 25 Sep 2014 00:57:58 -0400 Subject: [PATCH 15/34] Added tag build-2.1.0.427 for changeset cdd33807b16c From 715b2c79b699b9821cc13cdb7f3738362d3ee9ce Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Thu, 25 Sep 2014 13:23:35 +0300 Subject: [PATCH 16/34] last updates for service levels. --- .../Packages/ServiceLevelQuotaValueInfo.cs | 44 +++++++++++++++++ .../WebsitePanel.EnterpriseServer.Base.csproj | 1 + .../App_Themes/Default/Icons.skin | 1 + .../ExchangeMailboxGeneralSettings.ascx | 2 + .../ExchangeMailboxGeneralSettings.ascx.cs | 11 +++++ ...ngeMailboxGeneralSettings.ascx.designer.cs | 18 +++++++ .../ExchangeServer/ExchangeMailboxes.ascx | 24 ++++++++-- .../ExchangeServer/ExchangeMailboxes.ascx.cs | 34 ++++++++++++- .../ExchangeMailboxes.ascx.designer.cs | 9 ++++ .../ExchangeServer/OrganizationHome.ascx.cs | 12 ++++- .../OrganizationUserGeneralSettings.ascx | 2 + .../OrganizationUserGeneralSettings.ascx.cs | 22 +++++++-- ...zationUserGeneralSettings.ascx.designer.cs | 18 +++++++ .../ExchangeServer/OrganizationUsers.ascx | 23 +++++++-- .../ExchangeServer/OrganizationUsers.ascx.cs | 29 ++++++++++- .../OrganizationUsers.ascx.designer.cs | 9 ++++ .../WebsitePanel/Lync/LyncEditUser.ascx | 2 + .../WebsitePanel/Lync/LyncEditUser.ascx.cs | 16 +++++++ .../Lync/LyncEditUser.ascx.designer.cs | 48 ++++++++----------- .../WebsitePanel/SpaceQuotas.ascx.cs | 40 ---------------- 20 files changed, 282 insertions(+), 83 deletions(-) create mode 100644 WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Packages/ServiceLevelQuotaValueInfo.cs diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Packages/ServiceLevelQuotaValueInfo.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Packages/ServiceLevelQuotaValueInfo.cs new file mode 100644 index 00000000..02ef703a --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Packages/ServiceLevelQuotaValueInfo.cs @@ -0,0 +1,44 @@ +// Copyright (c) 2014, 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. + +using System; +using System.Collections.Generic; +using System.Text; + +namespace WebsitePanel.EnterpriseServer +{ + public class ServiceLevelQuotaValueInfo + { + public int QuotaValue { get; set; } + public string QuotaDescription { get; set; } + public string QuotaName { get; set; } + public int QuotaTypeId { get; set; } + public int QuotaUsedValue { get; set; } + public int QuotaAvailable { get; set; } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/WebsitePanel.EnterpriseServer.Base.csproj b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/WebsitePanel.EnterpriseServer.Base.csproj index 7ce9ade3..c4c1bc7a 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/WebsitePanel.EnterpriseServer.Base.csproj +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/WebsitePanel.EnterpriseServer.Base.csproj @@ -121,6 +121,7 @@ + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Icons.skin b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Icons.skin index 0559387a..a6c5e672 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Icons.skin +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Icons.skin @@ -36,6 +36,7 @@ Default skin template. The following skins are provided as examples only. + <%-- Exchange Icons --%> diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx index 225d2f8d..77f97218 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx @@ -21,6 +21,8 @@ - + +
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx.cs index b1b1b90d..aff1bcb7 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx.cs @@ -164,6 +164,17 @@ namespace WebsitePanel.Portal.ExchangeServer archivingQuotaViewer.QuotaValue = ArchivingMaxSize; rowArchiving.Visible = chkEnableArchiving.Checked; + if (account.LevelId > 0 && Cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels)) + { + WebsitePanel.EnterpriseServer.Base.HostedSolution.ServiceLevel serviceLevel = ES.Services.Organizations.GetSupportServiceLevel(account.LevelId); + + litServiceLevel.Visible = true; + litServiceLevel.Text = serviceLevel.LevelName; + litServiceLevel.ToolTip = serviceLevel.LevelDescription; + + } + imgVipUser.Visible = account.IsVIP && Cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels); + } catch (Exception ex) { diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx.designer.cs index d1b0530d..9f3029a2 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxGeneralSettings.ascx.designer.cs @@ -39,6 +39,24 @@ namespace WebsitePanel.Portal.ExchangeServer { /// protected global::System.Web.UI.WebControls.Literal litDisplayName; + /// + /// imgVipUser control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Image imgVipUser; + + /// + /// litServiceLevel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label litServiceLevel; + /// /// tabs control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx index ee7a1c81..bbeb8e4f 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx @@ -112,10 +112,26 @@
- -     - - +
+ +     + +
+ + + +
+
+ +     + +
+
+
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx.cs index b3fa7da7..1874f821 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx.cs @@ -32,6 +32,7 @@ using System.Web.UI.WebControls; using WebsitePanel.Providers.HostedSolution; using WebsitePanel.EnterpriseServer; using WebsitePanel.EnterpriseServer.Base.HostedSolution; +using System.Collections.Generic; namespace WebsitePanel.Portal.ExchangeServer { @@ -55,6 +56,8 @@ namespace WebsitePanel.Portal.ExchangeServer btnCreateMailbox.Visible = !ArchivingBoxes; + cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); + if (!IsPostBack) { BindStats(); @@ -62,7 +65,7 @@ namespace WebsitePanel.Portal.ExchangeServer BindServiceLevels(); - cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); + if (cntx.Quotas.ContainsKey(Quotas.EXCHANGE2007_ISCONSUMER)) { if (cntx.Quotas[Quotas.EXCHANGE2007_ISCONSUMER].QuotaAllocatedValue != 1) @@ -87,6 +90,35 @@ namespace WebsitePanel.Portal.ExchangeServer mailboxesQuota.QuotaUsedValue = stats.CreatedMailboxes; mailboxesQuota.QuotaValue = stats.AllocatedMailboxes; if (stats.AllocatedMailboxes != -1) mailboxesQuota.QuotaAvailable = tenantStats.AllocatedMailboxes - tenantStats.CreatedMailboxes; + + if (cntx != null && cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels)) BindServiceLevelsStats(); + } + + private void BindServiceLevelsStats() + { + ServiceLevels = ES.Services.Organizations.GetSupportServiceLevels(); + OrganizationUser[] accounts = ES.Services.Organizations.SearchAccounts(PanelRequest.ItemID, "", "", "", true); + + List serviceLevelQuotas = new List(); + foreach (var quota in Array.FindAll( + cntx.QuotasArray, x => x.QuotaName.Contains(Quotas.SERVICE_LEVELS))) + { + int levelId = ServiceLevels.Where(x => x.LevelName == quota.QuotaName.Replace(Quotas.SERVICE_LEVELS, "")).FirstOrDefault().LevelId; + int usedInOrgCount = accounts.Where(x => x.LevelId == levelId).Count(); + + serviceLevelQuotas.Add(new ServiceLevelQuotaValueInfo + { + QuotaName = quota.QuotaName, + QuotaDescription = quota.QuotaDescription + " in this Organization:", + QuotaTypeId = quota.QuotaTypeId, + QuotaValue = quota.QuotaAllocatedValue, + QuotaUsedValue = usedInOrgCount, + //QuotaUsedValue = quota.QuotaUsedValue, + QuotaAvailable = quota.QuotaAllocatedValue - quota.QuotaUsedValue + }); + } + dlServiceLevelQuotas.DataSource = serviceLevelQuotas; + dlServiceLevelQuotas.DataBind(); } protected void btnCreateMailbox_Click(object sender, EventArgs e) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx.designer.cs index e9cf4b0a..6e9b50b4 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx.designer.cs @@ -137,5 +137,14 @@ namespace WebsitePanel.Portal.ExchangeServer { /// To modify move field declaration from designer file to code-behind file. /// protected global::WebsitePanel.Portal.QuotaViewer mailboxesQuota; + + /// + /// dlServiceLevelQuotas control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Repeater dlServiceLevelQuotas; } } 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 fdbf2648..1bc84bc7 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.cs @@ -27,6 +27,7 @@ // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. using System; +using System.Linq; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using WebsitePanel.EnterpriseServer; @@ -391,6 +392,9 @@ namespace WebsitePanel.Portal.ExchangeServer private void BindServiceLevelsStats(PackageContext cntx) { + WebsitePanel.EnterpriseServer.Base.HostedSolution.ServiceLevel[] serviceLevels = ES.Services.Organizations.GetSupportServiceLevels(); + OrganizationUser[] accounts = ES.Services.Organizations.SearchAccounts(PanelRequest.ItemID, "", "", "", true); + foreach (var quota in Array.FindAll( cntx.QuotasArray, x => x.QuotaName.Contains(Quotas.SERVICE_LEVELS))) { @@ -401,17 +405,21 @@ namespace WebsitePanel.Portal.ExchangeServer col1.Attributes["nowrap"] = "nowrap"; HyperLink link = new HyperLink(); link.ID = "lnk_" + quota.QuotaName.Replace(Quotas.SERVICE_LEVELS, "").Replace(" ", string.Empty).Trim(); - link.Text = quota.QuotaDescription; + link.Text = quota.QuotaDescription.Replace(", users", " (users):"); col1.Controls.Add(link); + int levelId = serviceLevels.Where(x => x.LevelName == quota.QuotaName.Replace(Quotas.SERVICE_LEVELS, "")).FirstOrDefault().LevelId; + int usedInOrgCount = accounts.Where(x => x.LevelId == levelId).Count(); + HtmlTableCell col2 = new HtmlTableCell(); QuotaViewer quotaControl = (QuotaViewer)LoadControl("../UserControls/QuotaViewer.ascx"); quotaControl.ID = quota.QuotaName.Replace(Quotas.SERVICE_LEVELS, "").Replace(" ", string.Empty).Trim() + "Stats"; quotaControl.QuotaTypeId = quota.QuotaTypeId; quotaControl.DisplayGauge = true; quotaControl.QuotaValue = quota.QuotaAllocatedValue; - quotaControl.QuotaUsedValue = quota.QuotaUsedValue; + quotaControl.QuotaUsedValue = usedInOrgCount; + //quotaControl.QuotaUsedValue = quota.QuotaUsedValue; if (quota.QuotaAllocatedValue != -1) quotaControl.QuotaAvailable = quota.QuotaAllocatedValue - quota.QuotaUsedValue; diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserGeneralSettings.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserGeneralSettings.ascx index 626b45c7..cd770aea 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserGeneralSettings.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserGeneralSettings.ascx @@ -28,6 +28,8 @@ - + +
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserGeneralSettings.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserGeneralSettings.ascx.cs index ffc955e2..865e8665 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserGeneralSettings.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserGeneralSettings.ascx.cs @@ -132,6 +132,10 @@ namespace WebsitePanel.Portal.HostedSolution ServiceLevel serviceLevel = ES.Services.Organizations.GetSupportServiceLevel(user.LevelId); + litServiceLevel.Visible = true; + litServiceLevel.Text = serviceLevel.LevelName; + litServiceLevel.ToolTip = serviceLevel.LevelDescription; + bool addLevel = ddlServiceLevels.Items.FindByValue(serviceLevel.LevelId.ToString()) == null; addLevel = addLevel && cntx.Quotas.ContainsKey(Quotas.SERVICE_LEVELS + serviceLevel.LevelName); @@ -152,6 +156,7 @@ namespace WebsitePanel.Portal.HostedSolution } } chkVIP.Checked = user.IsVIP && secServiceLevels.Visible; + imgVipUser.Visible = user.IsVIP && secServiceLevels.Visible; if (cntx.Quotas.ContainsKey(Quotas.ORGANIZATION_ALLOWCHANGEUPN)) @@ -242,7 +247,7 @@ namespace WebsitePanel.Portal.HostedSolution { foreach (var serviceLevel in ES.Services.Organizations.GetSupportServiceLevels()) { - if (quota.Key.Replace(Quotas.SERVICE_LEVELS, "") == serviceLevel.LevelName && CheckServiceLevelQuota(quota.Value, serviceLevel.LevelId)) + if (quota.Key.Replace(Quotas.SERVICE_LEVELS, "") == serviceLevel.LevelName && CheckServiceLevelQuota(quota.Value)) { enabledServiceLevels.Add(serviceLevel); } @@ -263,9 +268,8 @@ namespace WebsitePanel.Portal.HostedSolution } - private bool CheckServiceLevelQuota(QuotaValueInfo quota, int levelID) + private bool CheckServiceLevelQuota(QuotaValueInfo quota) { - quota.QuotaUsedValue = ES.Services.Organizations.SearchAccounts(PanelRequest.ItemID, "", "", "", true).Where(x => x.LevelId == levelID).Count(); if (quota.QuotaAllocatedValue != -1) { @@ -329,6 +333,18 @@ namespace WebsitePanel.Portal.HostedSolution if (!chkLocked.Checked) chkLocked.Enabled = false; + litServiceLevel.Visible = !string.IsNullOrEmpty(ddlServiceLevels.SelectedValue) && secServiceLevels.Visible; + if (litServiceLevel.Visible) + { + ServiceLevel serviceLevel = ES.Services.Organizations.GetSupportServiceLevel(int.Parse(ddlServiceLevels.SelectedValue)); + + litServiceLevel.Text = serviceLevel.LevelName; + litServiceLevel.ToolTip = serviceLevel.LevelDescription; + } + + imgVipUser.Visible = chkVIP.Checked && secServiceLevels.Visible; + + messageBox.ShowSuccessMessage("ORGANIZATION_UPDATE_USER_SETTINGS"); } catch (Exception ex) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserGeneralSettings.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserGeneralSettings.ascx.designer.cs index a68bb55e..fef1a739 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserGeneralSettings.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserGeneralSettings.ascx.designer.cs @@ -48,6 +48,24 @@ namespace WebsitePanel.Portal.HostedSolution { /// protected global::System.Web.UI.WebControls.Literal litDisplayName; + /// + /// imgVipUser control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Image imgVipUser; + + /// + /// litServiceLevel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label litServiceLevel; + /// /// UserTabsId control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx index 6b8ba886..db8ee8fa 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx @@ -109,9 +109,26 @@
- -     - +
+ +     + +
+ + +
+
+ +     + +
+
+
+
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx.cs index 1d9941bb..6c15a98a 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx.cs @@ -43,6 +43,8 @@ namespace WebsitePanel.Portal.HostedSolution protected void Page_Load(object sender, EventArgs e) { + cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); + if (!IsPostBack) { BindStats(); @@ -50,7 +52,6 @@ namespace WebsitePanel.Portal.HostedSolution BindServiceLevels(); - cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); if (cntx.Quotas.ContainsKey(Quotas.EXCHANGE2007_ISCONSUMER)) { if (cntx.Quotas[Quotas.EXCHANGE2007_ISCONSUMER].QuotaAllocatedValue != 1) @@ -74,6 +75,32 @@ namespace WebsitePanel.Portal.HostedSolution usersQuota.QuotaUsedValue = stats.CreatedUsers; usersQuota.QuotaValue = stats.AllocatedUsers; if (stats.AllocatedUsers != -1) usersQuota.QuotaAvailable = tenantStats.AllocatedUsers - tenantStats.CreatedUsers; + + if(cntx != null && cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels)) BindServiceLevelsStats(); + } + + private void BindServiceLevelsStats() + { + ServiceLevels = ES.Services.Organizations.GetSupportServiceLevels(); + OrganizationUser[] accounts = ES.Services.Organizations.SearchAccounts(PanelRequest.ItemID, "", "", "", true); + + List serviceLevelQuotas = new List(); + foreach (var quota in Array.FindAll( + cntx.QuotasArray, x => x.QuotaName.Contains(Quotas.SERVICE_LEVELS))) + { + int levelId = ServiceLevels.Where(x => x.LevelName == quota.QuotaName.Replace(Quotas.SERVICE_LEVELS, "")).FirstOrDefault().LevelId; + int usedInOrgCount = accounts.Where(x => x.LevelId == levelId).Count(); + + serviceLevelQuotas.Add(new ServiceLevelQuotaValueInfo { QuotaName = quota.QuotaName, + QuotaDescription = quota.QuotaDescription + " in this Organization:", + QuotaTypeId = quota.QuotaTypeId, + QuotaValue = quota.QuotaAllocatedValue, + QuotaUsedValue = usedInOrgCount, + //QuotaUsedValue = quota.QuotaUsedValue, + QuotaAvailable = quota.QuotaAllocatedValue - quota.QuotaUsedValue }); + } + dlServiceLevelQuotas.DataSource = serviceLevelQuotas; + dlServiceLevelQuotas.DataBind(); } protected void btnCreateUser_Click(object sender, EventArgs e) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx.designer.cs index d23d75f5..e894471a 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx.designer.cs @@ -137,5 +137,14 @@ namespace WebsitePanel.Portal.HostedSolution { /// To modify move field declaration from designer file to code-behind file. /// protected global::WebsitePanel.Portal.QuotaViewer usersQuota; + + /// + /// dlServiceLevelQuotas control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Repeater dlServiceLevelQuotas; } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx index 4fe26b8b..53352de4 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx @@ -19,6 +19,8 @@ - + +
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx.cs index 35caed3c..71ea15d3 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx.cs @@ -118,6 +118,22 @@ namespace WebsitePanel.Portal.Lync lyncUserSettings.sipAddress = lyncUser.SipAddress; Utils.SelectListItem(ddlPhoneNumber, lyncUser.LineUri); + + PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); + + OrganizationUser user = ES.Services.Organizations.GetUserGeneralSettings(PanelRequest.ItemID, + PanelRequest.AccountID); + + if (user.LevelId > 0 && cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels)) + { + WebsitePanel.EnterpriseServer.Base.HostedSolution.ServiceLevel serviceLevel = ES.Services.Organizations.GetSupportServiceLevel(user.LevelId); + + litServiceLevel.Visible = true; + litServiceLevel.Text = serviceLevel.LevelName; + litServiceLevel.ToolTip = serviceLevel.LevelDescription; + + } + imgVipUser.Visible = user.IsVIP && cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels); } protected void btnSave_Click(object sender, EventArgs e) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx.designer.cs index ab351ec6..7b88f3a5 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx.designer.cs @@ -1,32 +1,4 @@ -// Copyright (c) 2014, 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. // @@ -76,6 +48,24 @@ namespace WebsitePanel.Portal.Lync { /// protected global::System.Web.UI.WebControls.Literal litDisplayName; + /// + /// imgVipUser control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Image imgVipUser; + + /// + /// litServiceLevel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label litServiceLevel; + /// /// messageBox control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx.cs index c6a1b520..c2e0dc9e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx.cs @@ -178,46 +178,6 @@ namespace WebsitePanel.Portal } } - //private void AddServiceLevelsQuotas() - //{ - // foreach(var quota in Array.FindAll( - // cntx.QuotasArray, x => x.QuotaName.Contains(Quotas.SERVICE_LEVELS))) - // { - // HtmlGenericControl tr = new HtmlGenericControl(); - // tr.ID = "pnl_" + quota.QuotaName.Replace(Quotas.SERVICE_LEVELS, ""); - // tr.TagName = "tr"; - - // HtmlGenericControl col1 = new HtmlGenericControl(); - // col1.TagName = "td"; - // col1.Attributes["class"] = "SubHead"; - // col1.Attributes["nowrap"] = "nowrap"; - // Label lbl = new Label(); - // lbl.ID = "lbl_" + quota.QuotaName.Replace(Quotas.SERVICE_LEVELS, ""); - // lbl.Text = quota.QuotaDescription; - // col1.Controls.Add(lbl); - - // HtmlGenericControl col2 = new HtmlGenericControl(); - // col2.TagName = "td"; - // col2.Attributes["class"] = "Normal"; - // //Quota quotaControl = new Quota(); - // // quotaControl.ID = "quota_" + quota.QuotaName.Replace(Quotas.SERVICE_LEVELS, ""); - // // quotaControl.QuotaName = quota.QuotaName; - // // quotaControl.Viewer = new QuotaViewer(); - // // quotaControl.DisplayGauge = true; - // col2.InnerHtml = string.Format( - // "", - // "quota_" + quota.QuotaName.Replace(Quotas.SERVICE_LEVELS, ""), - // quota.QuotaName); - // //col2.Controls.Add(quotaControl); - - // tr.Controls.Add(col1); - // tr.Controls.Add(col2); - // tblQuotas.Controls.Add((Control)tr); - - // Control c1 = new Control(); - // } - //} - private void AddServiceLevelsQuotas() { foreach (var quota in Array.FindAll( From f6c4fc8a9aead076032f4b023aaec54d53ed8309 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Thu, 25 Sep 2014 08:00:45 -0400 Subject: [PATCH 17/34] Added tag build-2.1.0.428 for changeset 8e97d6f5ffb5 From d2707aa974af07332c1bfcd86ff1de9d223d0894 Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Fri, 26 Sep 2014 11:08:00 +0300 Subject: [PATCH 18/34] GUI Fixes --- .../WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx | 1 - .../WebsitePanel/ExchangeServer/OrganizationUsers.ascx | 1 - .../DesktopModules/WebsitePanel/SpaceQuotas.ascx.cs | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx index bbeb8e4f..40852b11 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeMailboxes.ascx @@ -120,7 +120,6 @@ -
    diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx index db8ee8fa..0f3c717e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUsers.ascx @@ -116,7 +116,6 @@
-
    diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx.cs index c2e0dc9e..70f475c2 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx.cs @@ -190,7 +190,7 @@ namespace WebsitePanel.Portal col1.Attributes["nowrap"] = "nowrap"; Label lbl = new Label(); lbl.ID = "lbl_" + quota.QuotaName.Replace(Quotas.SERVICE_LEVELS, "").Replace(" ", string.Empty).Trim(); - lbl.Text = quota.QuotaDescription; + lbl.Text = quota.QuotaDescription + ":"; col1.Controls.Add(lbl); From a9a08e1088655cdc71a22a7d0f7f1147ff7416c1 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Fri, 26 Sep 2014 11:20:36 -0400 Subject: [PATCH 19/34] Added tag build-2.1.0.429 for changeset 3b103f842f67 From 2d48b7fb33b4d67d4610c0df8b9003038e65a04e Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Fri, 26 Sep 2014 16:14:27 -0400 Subject: [PATCH 20/34] Added tag build-2.1.0.430 for changeset fd7d64c21f4f From d7ac9fa36fd5434ee560b1f009e8757aed1894fc Mon Sep 17 00:00:00 2001 From: Olov Karlsson Date: Fri, 3 Oct 2014 10:18:33 +0200 Subject: [PATCH 21/34] Changes to IIS70 provider, etc for changing PHP versions among installed versions. Mimics the behaviour of IIS PHP Manager and works with it, i.e. changes made in PHP Manager is visible in WSP and vice versa. --- .../Web/PhpVersion.cs | 42 +++++ .../Web/WebVirtualDirectory.cs | 9 +- .../WebsitePanel.Providers.Base.csproj | 1 + .../Handlers/HandlersModuleService.cs | 68 +++++++- .../WebsitePanel.Providers.Web.IIS70/IIs70.cs | 162 ++++++++++++++---- .../WebSitesExtensionsControl.ascx | 2 - .../WebSitesExtensionsControl.ascx.cs | 23 ++- ...WebSitesExtensionsControl.ascx.designer.cs | 3 +- 8 files changed, 266 insertions(+), 44 deletions(-) create mode 100644 WebsitePanel/Sources/WebsitePanel.Providers.Base/Web/PhpVersion.cs diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Web/PhpVersion.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Web/PhpVersion.cs new file mode 100644 index 00000000..5648842e --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Web/PhpVersion.cs @@ -0,0 +1,42 @@ +// Copyright (c) 2014, 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. + +using System; +using System.Net; +using System.Text; +using System.Xml.Serialization; + +namespace WebsitePanel.Providers.Web +{ + public class PhpVersion + { + public string HandlerName { get; set; } + public string Version { get; set; } + public string ExecutionPath { get; set; } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Web/WebVirtualDirectory.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Web/WebVirtualDirectory.cs index 912d58f6..244b8940 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Web/WebVirtualDirectory.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Web/WebVirtualDirectory.cs @@ -81,6 +81,7 @@ namespace WebsitePanel.Providers.Web private bool sharePointInstalled; private bool iis7; private string consoleUrl; + private string php5VersionsInstalled; public string AnonymousUsername { @@ -285,7 +286,13 @@ namespace WebsitePanel.Providers.Web set { consoleUrl = value; } } - #region Web Deploy Publishing Properties + public string Php5VersionsInstalled + { + get { return php5VersionsInstalled; } + set { php5VersionsInstalled = value; } + } + + #region Web Deploy Publishing Properties /// /// Gets or sets Web Deploy publishing account name /// diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj b/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj index 2ab48c12..3f7049a0 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj @@ -329,6 +329,7 @@ + diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/Handlers/HandlersModuleService.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/Handlers/HandlersModuleService.cs index 12a7b902..d2a7c783 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/Handlers/HandlersModuleService.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/Handlers/HandlersModuleService.cs @@ -26,6 +26,8 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +using System.Linq; + namespace WebsitePanel.Providers.Web.Handlers { using System; @@ -178,7 +180,7 @@ namespace WebsitePanel.Providers.Web.Handlers } } - internal void InheritScriptMapsFromParent(string fqPath) + internal void InheritScriptMapsFromParent(string fqPath) { if (String.IsNullOrEmpty(fqPath)) return; @@ -241,5 +243,69 @@ namespace WebsitePanel.Providers.Web.Handlers // return null; } + + + internal void CopyInheritedHandlers(string siteName, string vDirPath) + { + if (string.IsNullOrEmpty(siteName)) + { + return; + } + + if (string.IsNullOrEmpty(vDirPath)) + { + vDirPath = "/"; + } + + using (var srvman = GetServerManager()) + { + var config = srvman.GetWebConfiguration(siteName, vDirPath); + + var handlersSection = (HandlersSection)config.GetSection(Constants.HandlersSection, typeof(HandlersSection)); + + var handlersCollection = handlersSection.Handlers; + + var list = new HandlerAction[handlersCollection.Count]; + ((System.Collections.ICollection) handlersCollection).CopyTo(list, 0); + + handlersCollection.Clear(); + + foreach (var handler in list) + { + handlersCollection.AddCopy(handler); + } + + srvman.CommitChanges(); + } + } + + internal void MoveHandlerToTop(string handlerName, string siteName, string vDirPath) + { + if (string.IsNullOrEmpty(siteName)) + { + return; + } + + if (string.IsNullOrEmpty(vDirPath)) + { + vDirPath = "/"; + } + + using (var srvman = GetServerManager()) + { + var config = srvman.GetWebConfiguration(siteName, vDirPath); + + var handlersSection = (HandlersSection)config.GetSection(Constants.HandlersSection, typeof(HandlersSection)); + + var handlersCollection = handlersSection.Handlers; + + var handlerElement = handlersCollection[handlerName]; + + handlersCollection.Remove(handlerElement); + handlersCollection.AddCopyAt(0, handlerElement); + + srvman.CommitChanges(); + } + } } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/IIs70.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/IIs70.cs index 22f33a5b..bb0376a4 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/IIs70.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/IIs70.cs @@ -28,6 +28,8 @@ using System; using System.Collections; +using System.Diagnostics; +using System.Linq; using System.Management; using System.DirectoryServices; using System.DirectoryServices.ActiveDirectory; @@ -280,7 +282,7 @@ namespace WebsitePanel.Providers.Web Name = settings[Constants.IntegratedAspNet40Pool].Trim() }); } - #endregion + #endregion #region Populate Dedicated Application Pools // ASP.NET 1.1 @@ -711,9 +713,9 @@ namespace WebsitePanel.Providers.Web if (!String.IsNullOrEmpty(AspPath) && String.Equals(AspPath, processor, StringComparison.InvariantCultureIgnoreCase)) virtualDir.AspInstalled = true; - // Detect whether PHP 5 scripting is enabled - if (!String.IsNullOrEmpty(PhpExecutablePath) && String.Equals(PhpExecutablePath, processor, StringComparison.InvariantCultureIgnoreCase)) - virtualDir.PhpInstalled = PHP_5; + //// Detect whether PHP 5 scripting is enabled (non fast_cgi) + if (PhpMode != Constants.PhpMode.FastCGI && !String.IsNullOrEmpty(PhpExecutablePath) && String.Equals(PhpExecutablePath, processor, StringComparison.InvariantCultureIgnoreCase)) + virtualDir.PhpInstalled = PHP_5; // Detect whether PHP 4 scripting is enabled if (!String.IsNullOrEmpty(Php4Path) && String.Equals(Php4Path, processor, StringComparison.InvariantCultureIgnoreCase)) @@ -727,7 +729,18 @@ namespace WebsitePanel.Providers.Web if (!String.IsNullOrEmpty(PerlPath) && String.Equals(PerlPath, processor, StringComparison.InvariantCultureIgnoreCase)) virtualDir.PerlInstalled = true; } - + + // Detect PHP 5 Fast_cgi version(s) + var activePhp5Handler = GetActivePhpHandlerName(srvman, virtualDir); + if (!string.IsNullOrEmpty(activePhp5Handler)) + { + virtualDir.PhpInstalled = PHP_5 + "|" + activePhp5Handler; + var versions = GetPhpVersions(srvman, virtualDir); + // This versionstring is used in UI to view and change php5 version. + var versionString = string.Join("|", versions.Select(v => v.HandlerName + ";" + v.Version).ToArray()); + virtualDir.Php5VersionsInstalled = versionString; + } + // string fqPath = virtualDir.FullQualifiedPath; if (!fqPath.EndsWith(@"/")) @@ -865,32 +878,63 @@ namespace WebsitePanel.Providers.Web #endregion #region PHP 5 script mappings - if (!String.IsNullOrEmpty(PhpExecutablePath) && File.Exists(PhpExecutablePath)) - { - if (virtualDir.PhpInstalled == PHP_5) - { - switch (PhpMode) - { - case Constants.PhpMode.FastCGI: - handlersSvc.AddScriptMaps(virtualDir, PHP_EXTENSIONS, - PhpExecutablePath, Constants.HandlerAlias.PHP_FASTCGI, Constants.FastCgiModule); - break; - case Constants.PhpMode.CGI: - handlersSvc.AddScriptMaps(virtualDir, PHP_EXTENSIONS, - PhpExecutablePath, Constants.HandlerAlias.PHP_CGI, Constants.CgiModule); - break; - case Constants.PhpMode.ISAPI: - handlersSvc.AddScriptMaps(virtualDir, PHP_EXTENSIONS, - PhpExecutablePath, Constants.HandlerAlias.PHP_ISAPI, Constants.IsapiModule); - break; - } - } - else - { - handlersSvc.RemoveScriptMaps(virtualDir, PHP_EXTENSIONS, PhpExecutablePath); - } - } - // + if (virtualDir.PhpInstalled.StartsWith(PHP_5)) + { + if (PhpMode == Constants.PhpMode.FastCGI && virtualDir.PhpInstalled.Contains('|')) + { + var path = PhpExecutablePath; + var args = virtualDir.PhpInstalled.Split('|'); + if (args.Count() > 1) + { + // Handler name is present, let us try to find the corresponding path to executable + var phpVersion = GetPhpVersions(virtualDir).SingleOrDefault(p => p.HandlerName == args[1]); + if (phpVersion != null) + { + path = phpVersion.ExecutionPath; + } + } + + if (!String.IsNullOrEmpty(path) && File.Exists(path)) + { + handlersSvc.CopyInheritedHandlers(((WebSite)virtualDir).SiteId, virtualDir.VirtualPath); + handlersSvc.MoveHandlerToTop(args[1], ((WebSite) virtualDir).SiteId, virtualDir.VirtualPath); + } + } + else + { + if (!String.IsNullOrEmpty(PhpExecutablePath) && File.Exists(PhpExecutablePath)) + { + switch (PhpMode) + { + case Constants.PhpMode.FastCGI: + handlersSvc.AddScriptMaps(virtualDir, PHP_EXTENSIONS, + PhpExecutablePath, Constants.HandlerAlias.PHP_FASTCGI, Constants.FastCgiModule); + break; + case Constants.PhpMode.CGI: + handlersSvc.AddScriptMaps(virtualDir, PHP_EXTENSIONS, + PhpExecutablePath, Constants.HandlerAlias.PHP_CGI, Constants.CgiModule); + break; + case Constants.PhpMode.ISAPI: + handlersSvc.AddScriptMaps(virtualDir, PHP_EXTENSIONS, + PhpExecutablePath, Constants.HandlerAlias.PHP_ISAPI, Constants.IsapiModule); + break; + } + } + } + } + else + { + if (PhpMode == Constants.PhpMode.FastCGI && GetPhpVersions(virtualDir).Any()) + { + // Don't erase handler mappings, if we do, the virtualDir cannot see and choose what version of PHP to run later + } + else + { + handlersSvc.RemoveScriptMaps(virtualDir, PHP_EXTENSIONS, PhpExecutablePath); + } + } + + // #endregion #region PHP 4 script mappings (IsapiModule only) @@ -4437,5 +4481,59 @@ namespace WebsitePanel.Providers.Web #endregion - } + + #region Php Management + + protected PhpVersion[] GetPhpVersions(ServerManager srvman, WebVirtualDirectory virtualDir) + { + var config = srvman.GetWebConfiguration(((WebSite)virtualDir).SiteId, virtualDir.VirtualPath); + //var config = srvman.GetApplicationHostConfiguration(); + var handlersSection = config.GetSection(Constants.HandlersSection); + + var result = new List(); + + // Loop through available maps and fill installed processors + foreach (var handler in handlersSection.GetCollection()) + { + if (string.Equals(handler["path"].ToString(), "*.php", StringComparison.OrdinalIgnoreCase)) + { + var executable = handler["ScriptProcessor"].ToString().Split('|')[0]; + if (string.Equals(handler["Modules"].ToString(), "FastCgiModule", StringComparison.OrdinalIgnoreCase) && File.Exists(executable)) + { + var handlerName = handler["Name"].ToString(); + result.Add(new PhpVersion() {HandlerName = handlerName, Version = GetPhpExecutableVersion(executable), ExecutionPath = handler["ScriptProcessor"].ToString()}); + } + } + } + + return result.ToArray(); + } + + protected PhpVersion[] GetPhpVersions(WebVirtualDirectory virtualDir) + { + using (var srvman = new ServerManager()) + { + return GetPhpVersions(srvman, virtualDir); + } + } + + protected string GetActivePhpHandlerName(ServerManager srvman, WebVirtualDirectory virtualDir) + { + var config = srvman.GetWebConfiguration(((WebSite)virtualDir).SiteId, virtualDir.VirtualPath); + var handlersSection = config.GetSection(Constants.HandlersSection); + + // Find first handler for *.php + return (from handler in handlersSection.GetCollection() + where string.Equals(handler["path"].ToString(), "*.php", StringComparison.OrdinalIgnoreCase) && string.Equals(handler["Modules"].ToString(), "FastCgiModule", StringComparison.OrdinalIgnoreCase) + select handler["name"].ToString() + ).FirstOrDefault(); + } + + private static string GetPhpExecutableVersion(string phpexePath) + { + return FileVersionInfo.GetVersionInfo(phpexePath).ProductVersion; + } + + #endregion + } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebSitesExtensionsControl.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebSitesExtensionsControl.ascx index fbf46c81..d725cd82 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebSitesExtensionsControl.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebSitesExtensionsControl.ascx @@ -30,8 +30,6 @@
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebSitesExtensionsControl.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebSitesExtensionsControl.ascx.cs index 74a074e5..6db36a40 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebSitesExtensionsControl.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebSitesExtensionsControl.ascx.cs @@ -30,6 +30,7 @@ using System; using System.Data; using System.Configuration; using System.Collections; +using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; @@ -98,13 +99,23 @@ namespace WebsitePanel.Portal if (!IIs7 || !PackagesHelper.CheckGroupQuotaEnabled(packageId, ResourceGroups.Web, Quotas.WEB_ASPNET40)) ddlAspNet.Items.Remove(ddlAspNet.Items.FindByValue("4I")); - rowAspNet.Visible = ddlAspNet.Items.Count > 1; - // php - if (!PackagesHelper.CheckGroupQuotaEnabled(packageId, ResourceGroups.Web, Quotas.WEB_PHP4)) - ddlPhp.Items.Remove(ddlPhp.Items.FindByValue("4")); - if (!PackagesHelper.CheckGroupQuotaEnabled(packageId, ResourceGroups.Web, Quotas.WEB_PHP5)) - ddlPhp.Items.Remove(ddlPhp.Items.FindByValue("5")); + if (PackagesHelper.CheckGroupQuotaEnabled(packageId, ResourceGroups.Web, Quotas.WEB_PHP4)) + ddlPhp.Items.Add("4"); + if (PackagesHelper.CheckGroupQuotaEnabled(packageId, ResourceGroups.Web, Quotas.WEB_PHP5)) + { + if (!string.IsNullOrEmpty(item.Php5VersionsInstalled)) + { + // Add items from list + ddlPhp.Items.Remove(ddlPhp.Items.FindByValue("")); + ddlPhp.Items.AddRange(item.Php5VersionsInstalled.Split('|').Select(v => new ListItem(v.Split(';')[1], "5|" + v.Split(';')[0])).OrderBy(i => i.Text).ToArray()); + } + else + { + ddlPhp.Items.Add("5"); + } + } + Utils.SelectListItem(ddlPhp, item.PhpInstalled); rowPhp.Visible = ddlPhp.Items.Count > 1; rowPerl.Visible = PackagesHelper.CheckGroupQuotaEnabled(packageId, ResourceGroups.Web, Quotas.WEB_PERL); diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebSitesExtensionsControl.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebSitesExtensionsControl.ascx.designer.cs index a9216e87..48e610df 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebSitesExtensionsControl.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebSitesExtensionsControl.ascx.designer.cs @@ -1,10 +1,9 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:2.0.50727.3053 // // Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// the code is regenerated. // //------------------------------------------------------------------------------ From 170b4da51d67efd30d2cd50b3ba4e261e9916483 Mon Sep 17 00:00:00 2001 From: Olov Karlsson Date: Thu, 9 Oct 2014 11:14:45 +0200 Subject: [PATCH 22/34] Some refactoring and small changes: - Use webObjectsSvc.GetServerManager() - Do not make any changes if the PHP5 handler is not changed in the UI - Added text on IIS70_Settings page to inform that the PHP5 Executable Path can be ignored --- .../Handlers/HandlersModuleService.cs | 29 ---------- .../WebsitePanel.Providers.Web.IIS70/IIs70.cs | 57 ++++++++++++++----- .../IIS70_Settings.ascx.resx | 7 ++- .../ProviderControls/IIS70_Settings.ascx | 5 ++ .../IIS70_Settings.ascx.designer.cs | 9 +++ 5 files changed, 62 insertions(+), 45 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/Handlers/HandlersModuleService.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/Handlers/HandlersModuleService.cs index d2a7c783..bf283e54 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/Handlers/HandlersModuleService.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/Handlers/HandlersModuleService.cs @@ -278,34 +278,5 @@ namespace WebsitePanel.Providers.Web.Handlers srvman.CommitChanges(); } } - - internal void MoveHandlerToTop(string handlerName, string siteName, string vDirPath) - { - if (string.IsNullOrEmpty(siteName)) - { - return; - } - - if (string.IsNullOrEmpty(vDirPath)) - { - vDirPath = "/"; - } - - using (var srvman = GetServerManager()) - { - var config = srvman.GetWebConfiguration(siteName, vDirPath); - - var handlersSection = (HandlersSection)config.GetSection(Constants.HandlersSection, typeof(HandlersSection)); - - var handlersCollection = handlersSection.Handlers; - - var handlerElement = handlersCollection[handlerName]; - - handlersCollection.Remove(handlerElement); - handlersCollection.AddCopyAt(0, handlerElement); - - srvman.CommitChanges(); - } - } } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/IIs70.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/IIs70.cs index bb0376a4..cdfbcf8c 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/IIs70.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIS70/IIs70.cs @@ -882,22 +882,19 @@ namespace WebsitePanel.Providers.Web { if (PhpMode == Constants.PhpMode.FastCGI && virtualDir.PhpInstalled.Contains('|')) { - var path = PhpExecutablePath; var args = virtualDir.PhpInstalled.Split('|'); + if (args.Count() > 1) { - // Handler name is present, let us try to find the corresponding path to executable - var phpVersion = GetPhpVersions(virtualDir).SingleOrDefault(p => p.HandlerName == args[1]); - if (phpVersion != null) - { - path = phpVersion.ExecutionPath; - } - } + // Handler name is present, use it to set choosen version + var handlerName = args[1]; - if (!String.IsNullOrEmpty(path) && File.Exists(path)) - { - handlersSvc.CopyInheritedHandlers(((WebSite)virtualDir).SiteId, virtualDir.VirtualPath); - handlersSvc.MoveHandlerToTop(args[1], ((WebSite) virtualDir).SiteId, virtualDir.VirtualPath); + if (handlerName != GetActivePhpHandlerName(virtualDir)) + { + // Only change handler if it is different from the current one + handlersSvc.CopyInheritedHandlers(((WebSite)virtualDir).SiteId, virtualDir.VirtualPath); + MakeHandlerActive(handlerName, virtualDir); + } } } else @@ -4511,12 +4508,21 @@ namespace WebsitePanel.Providers.Web protected PhpVersion[] GetPhpVersions(WebVirtualDirectory virtualDir) { - using (var srvman = new ServerManager()) + using (var srvman = webObjectsSvc.GetServerManager()) { return GetPhpVersions(srvman, virtualDir); } } + protected string GetActivePhpHandlerName(WebVirtualDirectory virtualDir) + { + using (var srvman = webObjectsSvc.GetServerManager()) + { + return GetActivePhpHandlerName(srvman, virtualDir); + } + } + + protected string GetActivePhpHandlerName(ServerManager srvman, WebVirtualDirectory virtualDir) { var config = srvman.GetWebConfiguration(((WebSite)virtualDir).SiteId, virtualDir.VirtualPath); @@ -4529,11 +4535,34 @@ namespace WebsitePanel.Providers.Web ).FirstOrDefault(); } - private static string GetPhpExecutableVersion(string phpexePath) + protected static string GetPhpExecutableVersion(string phpexePath) { return FileVersionInfo.GetVersionInfo(phpexePath).ProductVersion; } + protected void MakeHandlerActive(string handlerName, WebVirtualDirectory virtualDir) + { + using (var srvman = webObjectsSvc.GetServerManager()) + { + var config = srvman.GetWebConfiguration(((WebSite)virtualDir).SiteId, virtualDir.VirtualPath); + + var handlersSection = (HandlersSection)config.GetSection(Constants.HandlersSection, typeof(HandlersSection)); + + var handlersCollection = handlersSection.Handlers; + + var handlerElement = handlersCollection[handlerName]; + var activeHandlerElement = handlersCollection[GetActivePhpHandlerName(srvman, virtualDir)]; + + var activeHandlerIndex = handlersCollection.IndexOf(activeHandlerElement); + + handlersCollection.Remove(handlerElement); + + handlersCollection.AddCopyAt(activeHandlerIndex, handlerElement); + + srvman.CommitChanges(); + } + } + #endregion } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/IIS70_Settings.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/IIS70_Settings.ascx.resx index 8c517294..377a2135 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/IIS70_Settings.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/IIS70_Settings.ascx.resx @@ -256,7 +256,10 @@ Web Sites Public Shared Address: - - Register Helicon Ape module globally: + + Register Helicon Ape module globally: + + + If any PHP5 FastCGI handlers are present on the server, the PHP 5.x Executable Path given above will be ignored and not used. \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IIS70_Settings.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IIS70_Settings.ascx index 3c44ec57..d3942659 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IIS70_Settings.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IIS70_Settings.ascx @@ -291,6 +291,11 @@ + + +
  (
None - 4 - 5
+ +
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IIS70_Settings.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IIS70_Settings.ascx.designer.cs index 5bba0914..b2bd278a 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IIS70_Settings.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IIS70_Settings.ascx.designer.cs @@ -490,6 +490,15 @@ namespace WebsitePanel.Portal.ProviderControls { /// protected global::System.Web.UI.WebControls.DropDownList ddlPhpMode; + /// + /// litPHP5Info control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litPHP5Info; + /// /// perlPath control. /// From 262d040575b84b463b1a38efc5a67527fa46e81b Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Fri, 10 Oct 2014 19:36:51 -0400 Subject: [PATCH 23/34] Added tag build-2.1.0.431 for changeset b54b3d6d052a From 0c8f8024ddfa6c8a69a378457893d5a123cf9d4c Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Fri, 10 Oct 2014 19:44:20 -0400 Subject: [PATCH 24/34] Added tag build-2.1.0.432 for changeset cf9aec09a754 From bb67d603e23bbe93441143717585d1223b07875a Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Fri, 10 Oct 2014 19:51:42 -0400 Subject: [PATCH 25/34] Added tag build-2.1.0.433 for changeset a8b445030dd5 From 40aa4702ed0fb4f94e8dea84390e58118f10929a Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Sat, 18 Oct 2014 12:28:51 -0400 Subject: [PATCH 26/34] Added tag build-2.1.0.434 for changeset d26a8bbdf0c0 From cbfd27e279e069ba7f5815cbc379a991d70f7723 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Sat, 18 Oct 2014 12:34:27 -0400 Subject: [PATCH 27/34] Added tag build-2.1.0.435 for changeset 3d522dda1376 From 1dbaca969812c2a874b055b4245e6e02e1980190 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Sat, 18 Oct 2014 12:40:08 -0400 Subject: [PATCH 28/34] Added tag build-2.1.0.436 for changeset 7b5efda6774e From 22d6736d29c3ad019a8b435584f038834b2ce0ca Mon Sep 17 00:00:00 2001 From: Olov Karlsson Date: Sun, 19 Oct 2014 17:08:14 +0200 Subject: [PATCH 29/34] Fix how the IP is selected in the MSFTP70 Settings page --- .../WebsitePanel/ProviderControls/MSFTP70_Settings.ascx.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/MSFTP70_Settings.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/MSFTP70_Settings.ascx.cs index 71c18d09..3c4767a5 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/MSFTP70_Settings.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/MSFTP70_Settings.ascx.cs @@ -90,6 +90,11 @@ namespace WebsitePanel.Portal.ProviderControls private int FindAddressByText(string address) { + if (string.IsNullOrEmpty(address)) + { + return 0; + } + foreach (IPAddressInfo addressInfo in ES.Services.Servers.GetIPAddresses(IPAddressPool.General, PanelRequest.ServerId)) { if (addressInfo.InternalIP == address || addressInfo.ExternalIP == address) From 795aff66a7c1734bf484ba995ea66f03d20a3e98 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Sun, 19 Oct 2014 15:24:26 -0400 Subject: [PATCH 30/34] Added tag build-2.1.0.437 for changeset af919c4fcd54 From 38473ebb0d48330a9983cbc29081275748079caa Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Mon, 20 Oct 2014 11:55:29 -0400 Subject: [PATCH 31/34] Update Release Configuration to Output to the correct folder for Icewarp Provider. --- .../WebsitePanel.Providers.Mail.IceWarp.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Mail.IceWarp/WebsitePanel.Providers.Mail.IceWarp.csproj b/WebsitePanel/Sources/WebsitePanel.Providers.Mail.IceWarp/WebsitePanel.Providers.Mail.IceWarp.csproj index ea74db0f..f6df0ed1 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Mail.IceWarp/WebsitePanel.Providers.Mail.IceWarp.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Mail.IceWarp/WebsitePanel.Providers.Mail.IceWarp.csproj @@ -25,7 +25,7 @@ pdbonly true - bin\Release\ + ..\WebsitePanel.Server\bin\ TRACE prompt 4 From 113386e07074b26cc059c25dc02ef713e24770e5 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Mon, 20 Oct 2014 12:14:53 -0400 Subject: [PATCH 32/34] Added tag build-2.1.0.438 for changeset 7e0e45378b77 From cc12d9d7ab5d64bdaa0b79e29368fd17c85f0e3d Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Tue, 21 Oct 2014 14:29:39 -0400 Subject: [PATCH 33/34] Add support for SQL 2014 in Installer --- .../Actions/StandaloneServerActionManager.cs | 4 ++++ .../Sources/WebsitePanel.Setup/Wizard/DatabasePage.cs | 4 ++-- .../Sources/WebsitePanel.Setup/Wizard/ExpressInstallPage.cs | 4 ++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Actions/StandaloneServerActionManager.cs b/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Actions/StandaloneServerActionManager.cs index f4485b20..fe63798b 100644 --- a/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Actions/StandaloneServerActionManager.cs +++ b/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Actions/StandaloneServerActionManager.cs @@ -514,6 +514,10 @@ namespace WebsitePanel.Setup.Actions { serviceInfo.ProviderId = 209; } + else if (sqlVersion.StartsWith("12.")) + { + serviceInfo.ProviderId = 1203; + } serviceId = ES.Services.Servers.AddService(serviceInfo); } else diff --git a/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Wizard/DatabasePage.cs b/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Wizard/DatabasePage.cs index 933c0201..cc6399ff 100644 --- a/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Wizard/DatabasePage.cs +++ b/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Wizard/DatabasePage.cs @@ -124,11 +124,11 @@ namespace WebsitePanel.Setup { // check SQL server version string sqlVersion = GetSqlServerVersion(connectionString); - if (!sqlVersion.StartsWith("9.") && !sqlVersion.StartsWith("10.") && !sqlVersion.StartsWith("11.")) + if (!sqlVersion.StartsWith("9.") && !sqlVersion.StartsWith("10.") && !sqlVersion.StartsWith("11.") && !sqlVersion.StartsWith("12.")) { // SQL Server 2005 engine required e.Cancel = true; - ShowWarning("This program can be installed on SQL Server 2005/2008/2012 only."); + ShowWarning("This program can be installed on SQL Server 2005/2008/2012/2014 only."); return; } int securityMode = GetSqlServerSecurityMode(connectionString); diff --git a/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Wizard/ExpressInstallPage.cs b/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Wizard/ExpressInstallPage.cs index bb0c5e24..2d0a1a09 100644 --- a/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Wizard/ExpressInstallPage.cs +++ b/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Wizard/ExpressInstallPage.cs @@ -954,6 +954,10 @@ namespace WebsitePanel.Setup { serviceInfo.ProviderId = 209; } + else if (sqlVersion.StartsWith("12.")) + { + serviceInfo.ProviderId = 1203; + } serviceId = ES.Services.Servers.AddService(serviceInfo); } else From aebb2841ca5be7d987c5d65f5f72d56e2bbbce3e Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Tue, 21 Oct 2014 14:41:32 -0400 Subject: [PATCH 34/34] Added tag build-2.1.0.439 for changeset f1ae1c1226a7