diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/System/SystemSettings.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/System/SystemSettings.cs index d3edc7ee..7af8b4f3 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/System/SystemSettings.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/System/SystemSettings.cs @@ -47,7 +47,7 @@ namespace WebsitePanel.EnterpriseServer public const string PACKAGE_DISPLAY_SETTINGS = "PackageDisplaySettings"; public const string RDS_SETTINGS = "RdsSettings"; public const string WEBDAV_PORTAL_SETTINGS = "WebdavPortalSettings"; - public const string WEBDAV_PASSWORD_RESET_ENABLED_KEY = "WebdavPasswordResetEnabled"; + public const string WEBDAV_PASSWORD_RESET_ENABLED_KEY = "WebdavPswResetEnabled"; // key to access to wpi main & custom feed in wpi settings public const string WPI_MAIN_FEED_KEY = "WpiMainFeedUrl"; diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/OrganizationProxy.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/OrganizationProxy.cs index 6efafb0d..2976bfe4 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/OrganizationProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/OrganizationProxy.cs @@ -50,6 +50,8 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution { private System.Threading.SendOrPostCallback UpdateOrganizationPasswordSettingsOperationCompleted; + private System.Threading.SendOrPostCallback GetWebDavSystemSettingsOperationCompleted; + private System.Threading.SendOrPostCallback GetOrganizationPasswordSettingsOperationCompleted; private System.Threading.SendOrPostCallback CheckOrgIdExistsOperationCompleted; @@ -182,6 +184,9 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution { /// public event UpdateOrganizationPasswordSettingsCompletedEventHandler UpdateOrganizationPasswordSettingsCompleted; + /// + public event GetWebDavSystemSettingsCompletedEventHandler GetWebDavSystemSettingsCompleted; + /// public event GetOrganizationPasswordSettingsCompletedEventHandler GetOrganizationPasswordSettingsCompleted; @@ -635,6 +640,44 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution { } } + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/GetWebDavSystemSettings", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public SystemSettings GetWebDavSystemSettings() { + object[] results = this.Invoke("GetWebDavSystemSettings", new object[0]); + return ((SystemSettings)(results[0])); + } + + /// + public System.IAsyncResult BeginGetWebDavSystemSettings(System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("GetWebDavSystemSettings", new object[0], callback, asyncState); + } + + /// + public SystemSettings EndGetWebDavSystemSettings(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((SystemSettings)(results[0])); + } + + /// + public void GetWebDavSystemSettingsAsync() { + this.GetWebDavSystemSettingsAsync(null); + } + + /// + public void GetWebDavSystemSettingsAsync(object userState) { + if ((this.GetWebDavSystemSettingsOperationCompleted == null)) { + this.GetWebDavSystemSettingsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetWebDavSystemSettingsOperationCompleted); + } + this.InvokeAsync("GetWebDavSystemSettings", new object[0], this.GetWebDavSystemSettingsOperationCompleted, userState); + } + + private void OnGetWebDavSystemSettingsOperationCompleted(object arg) { + if ((this.GetWebDavSystemSettingsCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetWebDavSystemSettingsCompleted(this, new GetWebDavSystemSettingsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/GetOrganizationPasswordSettings", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public OrganizationPasswordSettings GetOrganizationPasswordSettings(int itemId) { @@ -3405,6 +3448,32 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution { [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] public delegate void UpdateOrganizationPasswordSettingsCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void GetWebDavSystemSettingsCompletedEventHandler(object sender, GetWebDavSystemSettingsCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetWebDavSystemSettingsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal GetWebDavSystemSettingsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public SystemSettings Result { + get { + this.RaiseExceptionIfNecessary(); + return ((SystemSettings)(this.results[0])); + } + } + } + /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] public delegate void GetOrganizationPasswordSettingsCompletedEventHandler(object sender, GetOrganizationPasswordSettingsCompletedEventArgs e); diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs index 0a0cd978..2622e03f 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs @@ -1673,18 +1673,18 @@ namespace WebsitePanel.EnterpriseServer DataProvider.DeleteExpiredAccessTokens(); } + public static SystemSettings GetWebDavSystemSettings() + { + return SystemController.GetSystemSettingsInternal(SystemSettings.WEBDAV_PORTAL_SETTINGS, false); + } + public static string GenerateUserPasswordResetLink(int itemId, int accountId) { string passwordResetUrlFormat = "account/password-reset/step-2"; - var settings = SystemController.GetSystemSettings(SystemSettings.WEBDAV_PORTAL_SETTINGS); + var settings = GetWebDavSystemSettings(); - if (settings == null) - { - throw new Exception("Webdav portal system settings are not set"); - } - - if (!settings.GetValueOrDefault(SystemSettings.WEBDAV_PASSWORD_RESET_ENABLED_KEY, false) ||!settings.Contains("WebdavPortalUrl")) + if (settings == null || !settings.GetValueOrDefault(SystemSettings.WEBDAV_PASSWORD_RESET_ENABLED_KEY, false) ||!settings.Contains("WebdavPortalUrl")) { return string.Empty; } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esOrganizations.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esOrganizations.asmx.cs index 43624f44..b261da3f 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esOrganizations.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esOrganizations.asmx.cs @@ -90,6 +90,12 @@ namespace WebsitePanel.EnterpriseServer OrganizationController.UpdateOrganizationPasswordSettings(itemId, settings); } + [WebMethod] + public SystemSettings GetWebDavSystemSettings() + { + return OrganizationController.GetWebDavSystemSettings(); + } + [WebMethod] public OrganizationPasswordSettings GetOrganizationPasswordSettings(int itemId) { 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 44d738df..913c2b72 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserGeneralSettings.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationUserGeneralSettings.ascx.cs @@ -221,13 +221,9 @@ namespace WebsitePanel.Portal.HostedSolution password.ValidationEnabled = true; password.Password = string.Empty; - var settings = ES.Services.System.GetSystemSettings(EnterpriseServer.SystemSettings.WEBDAV_PORTAL_SETTINGS); + var settings = ES.Services.Organizations.GetWebDavSystemSettings(); - if (settings != null) - { - btnResetUserPassword.Visible = Utils.ParseBool(settings[EnterpriseServer.SystemSettings.WEBDAV_PASSWORD_RESET_ENABLED_KEY], false); - - } + btnResetUserPassword.Visible = settings != null && Utils.ParseBool(settings[EnterpriseServer.SystemSettings.WEBDAV_PASSWORD_RESET_ENABLED_KEY], false); chkUserMustChangePassword.Checked = user.UserMustChangePassword; } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SystemSettings.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SystemSettings.ascx.cs index 3ce2ef5e..24fe72d0 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SystemSettings.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SystemSettings.ascx.cs @@ -164,7 +164,7 @@ namespace WebsitePanel.Portal if (settings != null) { - chkEnablePasswordReset.Checked = Utils.ParseBool(settings[WEBDAV_PASSWORD_RESET_ENABLED], false); + chkEnablePasswordReset.Checked = Utils.ParseBool(settings[WSP.SystemSettings.WEBDAV_PASSWORD_RESET_ENABLED_KEY], false); txtWebdavPortalUrl.Text = settings[WEBDAV_PORTAL_URL]; } } @@ -250,7 +250,7 @@ namespace WebsitePanel.Portal settings = new WSP.SystemSettings(); settings[WEBDAV_PORTAL_URL] = txtWebdavPortalUrl.Text; - settings[WEBDAV_PASSWORD_RESET_ENABLED] = chkEnablePasswordReset.Checked.ToString(); + settings[WSP.SystemSettings.WEBDAV_PASSWORD_RESET_ENABLED_KEY] = chkEnablePasswordReset.Checked.ToString(); result = ES.Services.System.SetSystemSettings(WSP.SystemSettings.WEBDAV_PORTAL_SETTINGS, settings); if (result < 0)