Released windows auth, connect to ES.Services.
This commit is contained in:
parent
2569e55609
commit
d29c347ff4
294 changed files with 329583 additions and 2315 deletions
|
@ -0,0 +1,17 @@
|
|||
using System.Configuration;
|
||||
using WebsitePanel.WebDavPortal.WebConfigSections;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.Config.Entities
|
||||
{
|
||||
public abstract class AbstractConfigCollection
|
||||
{
|
||||
protected WebDavExplorerConfigurationSettingsSection ConfigSection;
|
||||
|
||||
protected AbstractConfigCollection()
|
||||
{
|
||||
ConfigSection =
|
||||
(WebDavExplorerConfigurationSettingsSection)
|
||||
ConfigurationManager.GetSection(WebDavExplorerConfigurationSettingsSection.SectionName);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
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<AppConnectionStringsElement> _appConnectionStringsElements;
|
||||
|
||||
public ConnectionStringsCollection()
|
||||
{
|
||||
_appConnectionStringsElements = ConfigSection.ConnectionStrings.Cast<AppConnectionStringsElement>();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
namespace WebsitePanel.WebDavPortal.Config.Entities
|
||||
{
|
||||
public class ElementsRendering : AbstractConfigCollection
|
||||
{
|
||||
public int DefaultCount { get; private set; }
|
||||
public int AddElementsCount { get; private set; }
|
||||
|
||||
public ElementsRendering()
|
||||
{
|
||||
DefaultCount = ConfigSection.ElementsRendering.DefaultCount;
|
||||
AddElementsCount = ConfigSection.ElementsRendering.AddElementsCount;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using WebsitePanel.WebDavPortal.WebConfigSections;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.Config.Entities
|
||||
{
|
||||
public class FileIconsDictionary : AbstractConfigCollection, IReadOnlyDictionary<string, string>
|
||||
{
|
||||
private readonly IDictionary<string, string> _fileIcons;
|
||||
|
||||
public FileIconsDictionary()
|
||||
{
|
||||
DefaultPath = ConfigSection.FileIcons.DefaultPath;
|
||||
_fileIcons = ConfigSection.FileIcons.Cast<FileIconsElement>().ToDictionary(x => x.Extension, y => y.Path);
|
||||
}
|
||||
|
||||
public string DefaultPath { get; private set; }
|
||||
|
||||
public IEnumerator<KeyValuePair<string, string>> GetEnumerator()
|
||||
{
|
||||
return _fileIcons.GetEnumerator();
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
|
||||
public int Count
|
||||
{
|
||||
get { return _fileIcons.Count; }
|
||||
}
|
||||
|
||||
public bool ContainsKey(string extension)
|
||||
{
|
||||
return _fileIcons.ContainsKey(extension);
|
||||
}
|
||||
|
||||
public bool TryGetValue(string extension, out string path)
|
||||
{
|
||||
return _fileIcons.TryGetValue(extension, out path);
|
||||
}
|
||||
|
||||
public string this[string extension]
|
||||
{
|
||||
get { return ContainsKey(extension) ? _fileIcons[extension] : DefaultPath; }
|
||||
}
|
||||
|
||||
public IEnumerable<string> Keys
|
||||
{
|
||||
get { return _fileIcons.Keys; }
|
||||
}
|
||||
|
||||
public IEnumerable<string> Values
|
||||
{
|
||||
get { return _fileIcons.Values; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
using System.Globalization;
|
||||
using Resources.Resource;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.Config.Entities
|
||||
{
|
||||
public class HttpErrorsCollection
|
||||
{
|
||||
public string this[int statusCode]
|
||||
{
|
||||
get
|
||||
{
|
||||
var message = errors.ResourceManager.GetString("_" + statusCode.ToString(CultureInfo.InvariantCulture));
|
||||
return message ?? Default;
|
||||
}
|
||||
}
|
||||
|
||||
public string Default
|
||||
{
|
||||
get { return errors.Default; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using WebsitePanel.WebDavPortal.WebConfigSections;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.Config.Entities
|
||||
{
|
||||
public class OfficeOnlineCollection : AbstractConfigCollection, IReadOnlyCollection<string>
|
||||
{
|
||||
private readonly IList<string> _officeExtensions;
|
||||
|
||||
public OfficeOnlineCollection()
|
||||
{
|
||||
IsEnabled = ConfigSection.OfficeOnline.IsEnabled;
|
||||
Url = ConfigSection.OfficeOnline.Url;
|
||||
_officeExtensions = ConfigSection.OfficeOnline.Cast<OfficeOnlineElement>().Select(x => x.Extension).ToList();
|
||||
}
|
||||
|
||||
public bool IsEnabled { get; private set; }
|
||||
public string Url { get; private set; }
|
||||
|
||||
public IEnumerator<string> GetEnumerator()
|
||||
{
|
||||
return _officeExtensions.GetEnumerator();
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
|
||||
public int Count
|
||||
{
|
||||
get { return _officeExtensions.Count; }
|
||||
}
|
||||
|
||||
public bool Contains(string extension)
|
||||
{
|
||||
return _officeExtensions.Contains(extension);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
namespace WebsitePanel.WebDavPortal.Config.Entities
|
||||
{
|
||||
public class Rfc2898CryptographyParameters : AbstractConfigCollection
|
||||
{
|
||||
public string PasswordHash { get; private set; }
|
||||
public string SaltKey { get; private set; }
|
||||
public string VIKey { get; private set; }
|
||||
|
||||
public Rfc2898CryptographyParameters()
|
||||
{
|
||||
PasswordHash = ConfigSection.Rfc2898Cryptography.PasswordHash;
|
||||
SaltKey = ConfigSection.Rfc2898Cryptography.SaltKey;
|
||||
VIKey = ConfigSection.Rfc2898Cryptography.VIKey;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using WebsitePanel.WebDavPortal.WebConfigSections;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.Config.Entities
|
||||
{
|
||||
public class SessionKeysCollection : AbstractConfigCollection
|
||||
{
|
||||
private readonly IEnumerable<SessionKeysElement> _sessionKeys;
|
||||
|
||||
public SessionKeysCollection()
|
||||
{
|
||||
_sessionKeys = ConfigSection.SessionKeys.Cast<SessionKeysElement>();
|
||||
}
|
||||
|
||||
public string AccountInfo
|
||||
{
|
||||
get
|
||||
{
|
||||
SessionKeysElement sessionKey =
|
||||
_sessionKeys.FirstOrDefault(x => x.Key == SessionKeysElement.AccountInfoKey);
|
||||
return sessionKey != null ? sessionKey.Value : null;
|
||||
}
|
||||
}
|
||||
|
||||
public string WebDavManager
|
||||
{
|
||||
get
|
||||
{
|
||||
SessionKeysElement sessionKey =
|
||||
_sessionKeys.FirstOrDefault(x => x.Key == SessionKeysElement.WebDavManagerKey);
|
||||
return sessionKey != null ? sessionKey.Value : null;
|
||||
}
|
||||
}
|
||||
|
||||
public string ResourseRenderCount
|
||||
{
|
||||
get
|
||||
{
|
||||
SessionKeysElement sessionKey = _sessionKeys.FirstOrDefault(x => x.Key == SessionKeysElement.ResourseRenderCountKey);
|
||||
return sessionKey != null ? sessionKey.Value : null;
|
||||
}
|
||||
}
|
||||
|
||||
public string ItemId
|
||||
{
|
||||
get
|
||||
{
|
||||
SessionKeysElement sessionKey = _sessionKeys.FirstOrDefault(x => x.Key == SessionKeysElement.ItemIdSessionKey);
|
||||
return sessionKey != null ? sessionKey.Value : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
namespace WebsitePanel.WebDavPortal.Config.Entities
|
||||
{
|
||||
public class WebsitePanelConstantUserParameters : AbstractConfigCollection
|
||||
{
|
||||
public string Login { get; private set; }
|
||||
public string Password { get; private set; }
|
||||
|
||||
public WebsitePanelConstantUserParameters()
|
||||
{
|
||||
Login = ConfigSection.WebsitePanelConstantUser.Login;
|
||||
Password = ConfigSection.WebsitePanelConstantUser.Password;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
using WebsitePanel.WebDavPortal.Config.Entities;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.Config
|
||||
{
|
||||
public interface IWebDavAppConfig
|
||||
{
|
||||
string UserDomain { get; }
|
||||
string ApplicationName { get; }
|
||||
ElementsRendering ElementsRendering { get; }
|
||||
WebsitePanelConstantUserParameters WebsitePanelConstantUserParameters { get; }
|
||||
Rfc2898CryptographyParameters Rfc2898CryptographyParameters { get; }
|
||||
ConnectionStringsCollection ConnectionStrings { get; }
|
||||
SessionKeysCollection SessionKeys { get; }
|
||||
FileIconsDictionary FileIcons { get; }
|
||||
HttpErrorsCollection HttpErrors { get; }
|
||||
OfficeOnlineCollection OfficeOnline { get; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
using System.Configuration;
|
||||
using WebsitePanel.WebDavPortal.Config.Entities;
|
||||
using WebsitePanel.WebDavPortal.WebConfigSections;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.Config
|
||||
{
|
||||
public class WebDavAppConfigManager : IWebDavAppConfig
|
||||
{
|
||||
private static WebDavAppConfigManager _instance;
|
||||
private readonly WebDavExplorerConfigurationSettingsSection _configSection;
|
||||
|
||||
private WebDavAppConfigManager()
|
||||
{
|
||||
_configSection = ((WebDavExplorerConfigurationSettingsSection) ConfigurationManager.GetSection(WebDavExplorerConfigurationSettingsSection.SectionName));
|
||||
Rfc2898CryptographyParameters = new Rfc2898CryptographyParameters();
|
||||
WebsitePanelConstantUserParameters = new WebsitePanelConstantUserParameters();
|
||||
ElementsRendering = new ElementsRendering();
|
||||
ConnectionStrings = new ConnectionStringsCollection();
|
||||
SessionKeys = new SessionKeysCollection();
|
||||
FileIcons = new FileIconsDictionary();
|
||||
HttpErrors = new HttpErrorsCollection();
|
||||
OfficeOnline = new OfficeOnlineCollection();
|
||||
}
|
||||
|
||||
public static WebDavAppConfigManager Instance
|
||||
{
|
||||
get { return _instance ?? (_instance = new WebDavAppConfigManager()); }
|
||||
}
|
||||
|
||||
public string UserDomain
|
||||
{
|
||||
get { return _configSection.UserDomain.Value; }
|
||||
}
|
||||
|
||||
public string ApplicationName
|
||||
{
|
||||
get { return _configSection.ApplicationName.Value; }
|
||||
}
|
||||
|
||||
public ElementsRendering ElementsRendering { get; private set; }
|
||||
public WebsitePanelConstantUserParameters WebsitePanelConstantUserParameters { get; private set; }
|
||||
public Rfc2898CryptographyParameters Rfc2898CryptographyParameters { 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; }
|
||||
public OfficeOnlineCollection OfficeOnline { get; private set; }
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue