From 58b6b89ab06cc519165dcd5661d4965d29cee952 Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Tue, 30 Dec 2014 04:04:27 -0800 Subject: [PATCH] Web.config section fix --- .../App_Data/SiteSettings.config | 2 +- .../Entities/ConnectionStringsCollection.cs | 39 ------------------- .../Config/IWebDavAppConfig.cs | 1 - .../Config/WebDavAppConfigManager.cs | 2 - .../Controllers/AccountController.cs | 2 +- .../WebsitePanel.WebDavPortal/Web.config | 6 +-- .../AppConnectionStringsElement.cs | 27 ------------- .../AppConnectionStringsElementCollection.cs | 18 --------- ...DavExplorerConfigurationSettingsSection.cs | 7 ---- .../WebsitePanel.WebDavPortal.csproj | 3 -- 10 files changed, 3 insertions(+), 104 deletions(-) delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebDavPortal/Config/Entities/ConnectionStringsCollection.cs delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebDavPortal/WebConfigSections/AppConnectionStringsElement.cs delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebDavPortal/WebConfigSections/AppConnectionStringsElementCollection.cs diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Data/SiteSettings.config b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Data/SiteSettings.config index 4fc71ff6..91a5447b 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Data/SiteSettings.config +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/App_Data/SiteSettings.config @@ -3,7 +3,7 @@ WebsitePanel - http://localhost:9002 + http://127.0.0.1:9555 UserCulture UserTheme diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Config/Entities/ConnectionStringsCollection.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Config/Entities/ConnectionStringsCollection.cs deleted file mode 100644 index 2b8a50de..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Config/Entities/ConnectionStringsCollection.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System.Collections.Generic; -using System.Configuration; -using System.Linq; -using WebsitePanel.WebDavPortal.WebConfigSections; - -namespace WebsitePanel.WebDavPortal.Config.Entities -{ - public class ConnectionStringsCollection : AbstractConfigCollection - { - private readonly IEnumerable _appConnectionStringsElements; - - public ConnectionStringsCollection() - { - _appConnectionStringsElements = ConfigSection.ConnectionStrings.Cast(); - } - - public string WebDavServer - { - get - { - AppConnectionStringsElement connectionStr = - _appConnectionStringsElements.FirstOrDefault( - x => x.Key == AppConnectionStringsElement.WebdavConnectionStringKey); - return connectionStr != null ? connectionStr.ConnectionString : null; - } - } - - public string LdapServer - { - get - { - AppConnectionStringsElement connectionStr = - _appConnectionStringsElements.FirstOrDefault( - x => x.Key == AppConnectionStringsElement.LdapConnectionStringKey); - return connectionStr != null ? connectionStr.ConnectionString : null; - } - } - } -} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Config/IWebDavAppConfig.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Config/IWebDavAppConfig.cs index 1d326f6a..efed85e9 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Config/IWebDavAppConfig.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Config/IWebDavAppConfig.cs @@ -8,7 +8,6 @@ namespace WebsitePanel.WebDavPortal.Config string ApplicationName { get; } ElementsRendering ElementsRendering { get; } WebsitePanelConstantUserParameters WebsitePanelConstantUserParameters { get; } - ConnectionStringsCollection ConnectionStrings { get; } SessionKeysCollection SessionKeys { get; } FileIconsDictionary FileIcons { get; } HttpErrorsCollection HttpErrors { get; } diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Config/WebDavAppConfigManager.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Config/WebDavAppConfigManager.cs index c7471a78..31e9d2b9 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Config/WebDavAppConfigManager.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Config/WebDavAppConfigManager.cs @@ -14,7 +14,6 @@ namespace WebsitePanel.WebDavPortal.Config _configSection = ((WebDavExplorerConfigurationSettingsSection) ConfigurationManager.GetSection(WebDavExplorerConfigurationSettingsSection.SectionName)); WebsitePanelConstantUserParameters = new WebsitePanelConstantUserParameters(); ElementsRendering = new ElementsRendering(); - ConnectionStrings = new ConnectionStringsCollection(); SessionKeys = new SessionKeysCollection(); FileIcons = new FileIconsDictionary(); HttpErrors = new HttpErrorsCollection(); @@ -38,7 +37,6 @@ namespace WebsitePanel.WebDavPortal.Config public ElementsRendering ElementsRendering { get; private set; } public WebsitePanelConstantUserParameters WebsitePanelConstantUserParameters { get; private set; } - public ConnectionStringsCollection ConnectionStrings { get; private set; } public SessionKeysCollection SessionKeys { get; private set; } public FileIconsDictionary FileIcons { get; private set; } public HttpErrorsCollection HttpErrors { get; private set; } diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/AccountController.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/AccountController.cs index 6c824d15..242cd617 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/AccountController.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Controllers/AccountController.cs @@ -68,7 +68,7 @@ namespace WebsitePanel.WebDavPortal.Controllers private void AutheticationToServicesUsingWebsitePanelUser() { var crypto = _kernel.Get(); - var websitePanelLogin = crypto.Decrypt(WebDavAppConfigManager.Instance.WebsitePanelConstantUserParameters.Login); + var websitePanelLogin = WebDavAppConfigManager.Instance.WebsitePanelConstantUserParameters.Login; var websitePanelPassword = crypto.Decrypt(WebDavAppConfigManager.Instance.WebsitePanelConstantUserParameters.Password); var authTicket = new FormsAuthenticationTicket(1, websitePanelLogin, DateTime.Now, DateTime.Now.Add(FormsAuthentication.Timeout), FormsAuthentication.SlidingExpiration, websitePanelPassword + Environment.NewLine); diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Web.config b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Web.config index c8907459..8fdb594d 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Web.config +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Web.config @@ -25,11 +25,7 @@ - - - - - + diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/WebConfigSections/AppConnectionStringsElement.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/WebConfigSections/AppConnectionStringsElement.cs deleted file mode 100644 index 996b3ef9..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/WebConfigSections/AppConnectionStringsElement.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Configuration; - -namespace WebsitePanel.WebDavPortal.WebConfigSections -{ - public class AppConnectionStringsElement : ConfigurationElement - { - private const string ConnectionStringKey = "key"; - private const string ConnectionStringValue = "connectionString"; - - public const string WebdavConnectionStringKey = "WebDavServerConnectionString"; - public const string LdapConnectionStringKey = "LdapServerConnectionString"; - - [ConfigurationProperty(ConnectionStringKey, IsKey = true, IsRequired = true)] - public string Key - { - get { return (string) this[ConnectionStringKey]; } - set { this[ConnectionStringKey] = value; } - } - - [ConfigurationProperty(ConnectionStringValue, IsKey = true, IsRequired = true)] - public string ConnectionString - { - get { return (string) this[ConnectionStringValue]; } - set { this[ConnectionStringValue] = value; } - } - } -} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/WebConfigSections/AppConnectionStringsElementCollection.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/WebConfigSections/AppConnectionStringsElementCollection.cs deleted file mode 100644 index 1ebfbb41..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/WebConfigSections/AppConnectionStringsElementCollection.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Configuration; - -namespace WebsitePanel.WebDavPortal.WebConfigSections -{ - [ConfigurationCollection(typeof (AppConnectionStringsElement))] - public class AppConnectionStringsElementCollection : ConfigurationElementCollection - { - protected override ConfigurationElement CreateNewElement() - { - return new AppConnectionStringsElement(); - } - - protected override object GetElementKey(ConfigurationElement element) - { - return ((AppConnectionStringsElement) element).Key; - } - } -} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/WebConfigSections/WebDavExplorerConfigurationSettingsSection.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/WebConfigSections/WebDavExplorerConfigurationSettingsSection.cs index fabd4b67..e84491ab 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/WebConfigSections/WebDavExplorerConfigurationSettingsSection.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/WebConfigSections/WebDavExplorerConfigurationSettingsSection.cs @@ -44,13 +44,6 @@ namespace WebsitePanel.WebDavPortal.WebConfigSections set { this[ElementsRenderingKey] = value; } } - [ConfigurationProperty(ConnectionStringsKey, IsDefaultCollection = false)] - public AppConnectionStringsElementCollection ConnectionStrings - { - get { return (AppConnectionStringsElementCollection) this[ConnectionStringsKey]; } - set { this[ConnectionStringsKey] = value; } - } - [ConfigurationProperty(SessionKeysKey, IsDefaultCollection = false)] public SessionKeysElementCollection SessionKeys { diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/WebsitePanel.WebDavPortal.csproj b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/WebsitePanel.WebDavPortal.csproj index f80d20ca..2fe34b9f 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/WebsitePanel.WebDavPortal.csproj +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/WebsitePanel.WebDavPortal.csproj @@ -143,7 +143,6 @@ - @@ -180,8 +179,6 @@ - -