webdav portal auth via ad
This commit is contained in:
parent
05d9fddb5d
commit
7dd090820b
56 changed files with 927 additions and 281 deletions
|
@ -1,90 +0,0 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.18449
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Resources.Resource {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option or rebuild the Visual Studio project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Web.Application.StronglyTypedResourceProxyBuilder", "12.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class errors {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal errors() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Resources.Resource.errors", global::System.Reflection.Assembly.Load("App_GlobalResources"));
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Fatal error.
|
||||
/// </summary>
|
||||
internal static string Default {
|
||||
get {
|
||||
return ResourceManager.GetString("Default", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to The requested content was not found.
|
||||
/// </summary>
|
||||
internal static string _404 {
|
||||
get {
|
||||
return ResourceManager.GetString("_404", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to The following server error was encountered.
|
||||
/// </summary>
|
||||
internal static string _500 {
|
||||
get {
|
||||
return ResourceManager.GetString("_500", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,129 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Default" xml:space="preserve">
|
||||
<value>Fatal error</value>
|
||||
</data>
|
||||
<data name="_404" xml:space="preserve">
|
||||
<value>The requested content was not found</value>
|
||||
</data>
|
||||
<data name="_500" xml:space="preserve">
|
||||
<value>The following server error was encountered</value>
|
||||
</data>
|
||||
</root>
|
|
@ -8,7 +8,8 @@ namespace WebsitePanel.WebDavPortal
|
|||
public static void RegisterBundles(BundleCollection bundles)
|
||||
{
|
||||
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
|
||||
"~/Scripts/jquery-{version}.js"));
|
||||
"~/Scripts/jquery-{version}.js",
|
||||
"~/Scripts/jquery.cookie.js"));
|
||||
|
||||
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
|
||||
"~/Scripts/jquery.validate*"));
|
||||
|
@ -24,7 +25,11 @@ namespace WebsitePanel.WebDavPortal
|
|||
|
||||
bundles.Add(new ScriptBundle("~/bundles/appScripts").Include(
|
||||
"~/Scripts/appScripts/recalculateResourseHeight.js",
|
||||
"~/Scripts/appScripts/uploadingData2.js"));
|
||||
"~/Scripts/appScripts/uploadingData2.js",
|
||||
"~/Scripts/appScripts/authentication.js"));
|
||||
|
||||
bundles.Add(new ScriptBundle("~/bundles/authScripts").Include(
|
||||
"~/Scripts/appScripts/authentication.js"));
|
||||
|
||||
bundles.Add(new StyleBundle("~/Content/css").Include(
|
||||
"~/Content/bootstrap.css",
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace WebsitePanel.WebDavPortal
|
|||
name: FileSystemRouteNames.FilePath,
|
||||
url: "{org}/{*pathPart}",
|
||||
defaults: new { controller = "FileSystem", action = "ShowContent", pathPart = UrlParameter.Optional },
|
||||
constraints: new { org = new WebsitePanel.WebDavPortal.Constraints.OrganizationRouteConstraint() }
|
||||
constraints: new { org = new Constraints.OrganizationRouteConstraint() }
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.Config.Entities
|
||||
{
|
||||
public class ElementsRendering : AbstractConfigCollection
|
||||
{
|
||||
public int DefaultCount { get; private set; }
|
||||
public int AddElementsCount { get; private set; }
|
||||
public List<string> ElementsToIgnore { get; private set; }
|
||||
|
||||
public ElementsRendering()
|
||||
{
|
||||
DefaultCount = ConfigSection.ElementsRendering.DefaultCount;
|
||||
AddElementsCount = ConfigSection.ElementsRendering.AddElementsCount;
|
||||
ElementsToIgnore = ConfigSection.ElementsRendering.ElementsToIgnore.Split(',').ToList();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
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; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
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; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
using WebsitePanel.WebDavPortal.Config.Entities;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.Config
|
||||
{
|
||||
public interface IWebDavAppConfig
|
||||
{
|
||||
string UserDomain { get; }
|
||||
string ApplicationName { get; }
|
||||
ElementsRendering ElementsRendering { get; }
|
||||
WebsitePanelConstantUserParameters WebsitePanelConstantUserParameters { get; }
|
||||
SessionKeysCollection SessionKeys { get; }
|
||||
FileIconsDictionary FileIcons { get; }
|
||||
HttpErrorsCollection HttpErrors { get; }
|
||||
OfficeOnlineCollection OfficeOnline { get; }
|
||||
}
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
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));
|
||||
WebsitePanelConstantUserParameters = new WebsitePanelConstantUserParameters();
|
||||
ElementsRendering = new ElementsRendering();
|
||||
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 SessionKeysCollection SessionKeys { get; private set; }
|
||||
public FileIconsDictionary FileIcons { get; private set; }
|
||||
public HttpErrorsCollection HttpErrors { get; private set; }
|
||||
public OfficeOnlineCollection OfficeOnline { get; private set; }
|
||||
}
|
||||
}
|
|
@ -5,7 +5,7 @@ using System.Linq;
|
|||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Routing;
|
||||
using WebsitePanel.WebDavPortal.Config;
|
||||
using WebsitePanel.WebDav.Core;
|
||||
using WebsitePanel.WebDavPortal.DependencyInjection;
|
||||
using WebsitePanel.WebDavPortal.Models;
|
||||
|
||||
|
@ -13,33 +13,22 @@ namespace WebsitePanel.WebDavPortal.Constraints
|
|||
{
|
||||
public class OrganizationRouteConstraint : IRouteConstraint
|
||||
{
|
||||
private static string actualOrgName;
|
||||
|
||||
public bool Match(HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection)
|
||||
{
|
||||
var webdavManager = DependencyResolver.Current.GetService<IWebDavManager>();
|
||||
if (WspContext.User == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
object value;
|
||||
if (!values.TryGetValue(parameterName, out value))
|
||||
if (!values.TryGetValue(parameterName, out value))
|
||||
return false;
|
||||
|
||||
var str = value as string;
|
||||
if (str == null)
|
||||
return false;
|
||||
|
||||
if (routeDirection == RouteDirection.IncomingRequest)
|
||||
return actualOrgName == str;
|
||||
|
||||
if (httpContext.Session == null)
|
||||
if (str == null)
|
||||
return false;
|
||||
|
||||
if (webdavManager != null && str == webdavManager.OrganizationName)
|
||||
{
|
||||
actualOrgName = str;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return WspContext.User.OrganizationId == str;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,112 +1,60 @@
|
|||
using System;
|
||||
using System.Configuration;
|
||||
using System.DirectoryServices;
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Security;
|
||||
using Microsoft.Win32;
|
||||
using Ninject;
|
||||
using WebsitePanel.EnterpriseServer;
|
||||
using WebsitePanel.Portal;
|
||||
using WebsitePanel.Providers.HostedSolution;
|
||||
using WebsitePanel.WebDavPortal.Config;
|
||||
using WebsitePanel.WebDavPortal.Cryptography;
|
||||
using WebsitePanel.WebDavPortal.DependencyInjection;
|
||||
using System.Web.Routing;
|
||||
using WebsitePanel.WebDav.Core.Config;
|
||||
using WebsitePanel.WebDav.Core.Security.Cryptography;
|
||||
using WebsitePanel.WebDavPortal.Exceptions;
|
||||
using WebsitePanel.WebDavPortal.Models;
|
||||
using System.Collections.Generic;
|
||||
using WebsitePanel.Providers.OS;
|
||||
using WebDAV;
|
||||
using WebsitePanel.WebDavPortal.UI.Routes;
|
||||
using WebsitePanel.WebDav.Core.Interfaces.Security;
|
||||
using WebsitePanel.WebDav.Core;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.Controllers
|
||||
{
|
||||
public class AccountController : Controller
|
||||
{
|
||||
private readonly AccountModel _accountModel;
|
||||
private readonly IWebDavManager _webdavManager;
|
||||
private readonly ICryptography _cryptography;
|
||||
private readonly IAuthenticationService _authenticationService;
|
||||
|
||||
public AccountController(AccountModel accountModel, IWebDavManager webdavManager, ICryptography cryptography)
|
||||
public AccountController(ICryptography cryptography, IAuthenticationService authenticationService)
|
||||
{
|
||||
_accountModel = accountModel;
|
||||
_webdavManager = webdavManager;
|
||||
_cryptography = cryptography;
|
||||
_authenticationService = authenticationService;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ActionResult Login()
|
||||
{
|
||||
if (_accountModel != null)
|
||||
return RedirectToAction("ShowContent", "FileSystem");
|
||||
if (WspContext.User != null && WspContext.User.Identity.IsAuthenticated)
|
||||
{
|
||||
return RedirectToRoute(FileSystemRouteNames.FilePath, new { org = WspContext.User.OrganizationId });
|
||||
}
|
||||
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult Login(AccountModel model)
|
||||
{
|
||||
AutheticationToServicesUsingWebsitePanelUser();
|
||||
var exchangeAccount = ES.Services.ExchangeServer.GetAccountByAccountNameWithoutItemId(model.Login);
|
||||
var isAuthenticated = exchangeAccount != null && exchangeAccount.AccountPassword == model.Password;
|
||||
|
||||
ViewBag.LdapIsAuthentication = isAuthenticated;
|
||||
var user = _authenticationService.LogIn(model.Login, model.Password);
|
||||
|
||||
if (isAuthenticated)
|
||||
ViewBag.LdapIsAuthentication = user.Identity.IsAuthenticated;
|
||||
|
||||
if (user.Identity.IsAuthenticated)
|
||||
{
|
||||
Session[WebDavAppConfigManager.Instance.SessionKeys.ItemId] = exchangeAccount.ItemId;
|
||||
|
||||
model.Groups = ES.Services.Organizations.GetSecurityGroupsByMember(exchangeAccount.ItemId, exchangeAccount.AccountId);
|
||||
model.DisplayName = exchangeAccount.DisplayName;
|
||||
|
||||
WebDavManager manager = null;
|
||||
|
||||
try
|
||||
{
|
||||
Session[WebDavAppConfigManager.Instance.SessionKeys.AccountInfo] = model;
|
||||
|
||||
manager = new WebDavManager(new NetworkCredential(model.Login, model.Password, WebDavAppConfigManager.Instance.UserDomain), exchangeAccount.ItemId);
|
||||
|
||||
Session[WebDavAppConfigManager.Instance.SessionKeys.WebDavManager] = manager;
|
||||
}
|
||||
catch (ConnectToWebDavServerException exception)
|
||||
{
|
||||
return View(new AccountModel { LdapError = exception.Message });
|
||||
}
|
||||
|
||||
return RedirectToAction("ShowContent", "FileSystem", new { org = manager.OrganizationName });
|
||||
return RedirectToRoute(FileSystemRouteNames.FilePath, new { org = WspContext.User.OrganizationId });
|
||||
}
|
||||
|
||||
return View(new AccountModel { LdapError = "The user name or password is incorrect" });
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ActionResult Logout()
|
||||
{
|
||||
Session[WebDavAppConfigManager.Instance.SessionKeys.AccountInfo] = null;
|
||||
_authenticationService.LogOut();
|
||||
|
||||
return RedirectToRoute(AccountRouteNames.Login);
|
||||
}
|
||||
|
||||
private void AutheticationToServicesUsingWebsitePanelUser()
|
||||
{
|
||||
var websitePanelLogin = WebDavAppConfigManager.Instance.WebsitePanelConstantUserParameters.Login;
|
||||
var websitePanelPassword = _cryptography.Decrypt(WebDavAppConfigManager.Instance.WebsitePanelConstantUserParameters.Password);
|
||||
|
||||
var authTicket = new FormsAuthenticationTicket(1, websitePanelLogin, DateTime.Now, DateTime.Now.Add(FormsAuthentication.Timeout),
|
||||
FormsAuthentication.SlidingExpiration, websitePanelPassword + Environment.NewLine);
|
||||
var encryptedTicket = FormsAuthentication.Encrypt(authTicket);
|
||||
var authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
|
||||
|
||||
if (FormsAuthentication.SlidingExpiration)
|
||||
{
|
||||
authCookie.Expires = authTicket.Expiration;
|
||||
}
|
||||
|
||||
Response.Cookies.Add(authCookie);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
using System.Web.Mvc;
|
||||
using WebsitePanel.WebDavPortal.Config;
|
||||
using WebsitePanel.WebDav.Core.Config;
|
||||
using WebsitePanel.WebDavPortal.Models;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.Controllers
|
||||
|
|
|
@ -4,16 +4,13 @@ using System.Linq;
|
|||
using System.Net.Mime;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using Ninject;
|
||||
using WebsitePanel.WebDav.Core;
|
||||
using WebsitePanel.WebDav.Core.Client;
|
||||
using WebsitePanel.WebDav.Core.Config;
|
||||
using WebsitePanel.WebDav.Core.Exceptions;
|
||||
using WebsitePanel.WebDavPortal.Config;
|
||||
using WebsitePanel.WebDavPortal.CustomAttributes;
|
||||
using WebsitePanel.WebDavPortal.DependencyInjection;
|
||||
using WebsitePanel.WebDavPortal.Extensions;
|
||||
using WebsitePanel.WebDavPortal.Models;
|
||||
using WebsitePanel.Portal;
|
||||
using WebsitePanel.Providers.OS;
|
||||
using System.Net;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.Controllers
|
||||
|
@ -33,7 +30,7 @@ namespace WebsitePanel.WebDavPortal.Controllers
|
|||
[HttpGet]
|
||||
public ActionResult ShowContent(string org, string pathPart = "")
|
||||
{
|
||||
if (org != _webdavManager.OrganizationName)
|
||||
if (org != WspContext.User.OrganizationId)
|
||||
return new HttpStatusCodeResult(HttpStatusCode.NoContent);
|
||||
|
||||
string fileName = pathPart.Split('/').Last();
|
||||
|
|
|
@ -1,198 +0,0 @@
|
|||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.Cryptography
|
||||
{
|
||||
public class CryptoUtils : ICryptography
|
||||
{
|
||||
private string EnterpriseServerRegistryPath = "SOFTWARE\\WebsitePanel\\EnterpriseServer";
|
||||
|
||||
private string CryptoKey
|
||||
{
|
||||
get
|
||||
{
|
||||
string Key = ConfigurationManager.AppSettings["WebsitePanel.AltCryptoKey"];
|
||||
string value = string.Empty;
|
||||
|
||||
if (!string.IsNullOrEmpty(Key))
|
||||
{
|
||||
RegistryKey root = Registry.LocalMachine;
|
||||
RegistryKey rk = root.OpenSubKey(EnterpriseServerRegistryPath);
|
||||
if (rk != null)
|
||||
{
|
||||
value = (string)rk.GetValue(Key, null);
|
||||
rk.Close();
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(value))
|
||||
return value;
|
||||
else
|
||||
return ConfigurationManager.AppSettings["WebsitePanel.CryptoKey"];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private bool EncryptionEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
return (ConfigurationManager.AppSettings["WebsitePanel.EncryptionEnabled"] != null)
|
||||
? Boolean.Parse(ConfigurationManager.AppSettings["WebsitePanel.EncryptionEnabled"]) : true;
|
||||
}
|
||||
}
|
||||
|
||||
public string Encrypt(string InputText)
|
||||
{
|
||||
string Password = CryptoKey;
|
||||
|
||||
if (!EncryptionEnabled)
|
||||
return InputText;
|
||||
|
||||
if (InputText == null)
|
||||
return InputText;
|
||||
|
||||
// We are now going to create an instance of the
|
||||
// Rihndael class.
|
||||
RijndaelManaged RijndaelCipher = new RijndaelManaged();
|
||||
|
||||
// First we need to turn the input strings into a byte array.
|
||||
byte[] PlainText = System.Text.Encoding.Unicode.GetBytes(InputText);
|
||||
|
||||
|
||||
// We are using salt to make it harder to guess our key
|
||||
// using a dictionary attack.
|
||||
byte[] Salt = Encoding.ASCII.GetBytes(Password.Length.ToString());
|
||||
|
||||
|
||||
// The (Secret Key) will be generated from the specified
|
||||
// password and salt.
|
||||
PasswordDeriveBytes SecretKey = new PasswordDeriveBytes(Password, Salt);
|
||||
|
||||
|
||||
// Create a encryptor from the existing SecretKey bytes.
|
||||
// We use 32 bytes for the secret key
|
||||
// (the default Rijndael key length is 256 bit = 32 bytes) and
|
||||
// then 16 bytes for the IV (initialization vector),
|
||||
// (the default Rijndael IV length is 128 bit = 16 bytes)
|
||||
ICryptoTransform Encryptor = RijndaelCipher.CreateEncryptor(SecretKey.GetBytes(32), SecretKey.GetBytes(16));
|
||||
|
||||
|
||||
// Create a MemoryStream that is going to hold the encrypted bytes
|
||||
MemoryStream memoryStream = new MemoryStream();
|
||||
|
||||
|
||||
// Create a CryptoStream through which we are going to be processing our data.
|
||||
// CryptoStreamMode.Write means that we are going to be writing data
|
||||
// to the stream and the output will be written in the MemoryStream
|
||||
// we have provided. (always use write mode for encryption)
|
||||
CryptoStream cryptoStream = new CryptoStream(memoryStream, Encryptor, CryptoStreamMode.Write);
|
||||
|
||||
// Start the encryption process.
|
||||
cryptoStream.Write(PlainText, 0, PlainText.Length);
|
||||
|
||||
|
||||
// Finish encrypting.
|
||||
cryptoStream.FlushFinalBlock();
|
||||
|
||||
// Convert our encrypted data from a memoryStream into a byte array.
|
||||
byte[] CipherBytes = memoryStream.ToArray();
|
||||
|
||||
|
||||
|
||||
// Close both streams.
|
||||
memoryStream.Close();
|
||||
cryptoStream.Close();
|
||||
|
||||
|
||||
|
||||
// Convert encrypted data into a base64-encoded string.
|
||||
// A common mistake would be to use an Encoding class for that.
|
||||
// It does not work, because not all byte values can be
|
||||
// represented by characters. We are going to be using Base64 encoding
|
||||
// That is designed exactly for what we are trying to do.
|
||||
string EncryptedData = Convert.ToBase64String(CipherBytes);
|
||||
|
||||
|
||||
|
||||
// Return encrypted string.
|
||||
return EncryptedData;
|
||||
}
|
||||
|
||||
public string Decrypt(string InputText)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!EncryptionEnabled)
|
||||
return InputText;
|
||||
|
||||
if (InputText == null || InputText == "")
|
||||
return InputText;
|
||||
|
||||
string Password = CryptoKey;
|
||||
RijndaelManaged RijndaelCipher = new RijndaelManaged();
|
||||
|
||||
|
||||
byte[] EncryptedData = Convert.FromBase64String(InputText);
|
||||
byte[] Salt = Encoding.ASCII.GetBytes(Password.Length.ToString());
|
||||
|
||||
|
||||
PasswordDeriveBytes SecretKey = new PasswordDeriveBytes(Password, Salt);
|
||||
|
||||
// Create a decryptor from the existing SecretKey bytes.
|
||||
ICryptoTransform Decryptor = RijndaelCipher.CreateDecryptor(SecretKey.GetBytes(32), SecretKey.GetBytes(16));
|
||||
|
||||
|
||||
MemoryStream memoryStream = new MemoryStream(EncryptedData);
|
||||
|
||||
// Create a CryptoStream. (always use Read mode for decryption).
|
||||
CryptoStream cryptoStream = new CryptoStream(memoryStream, Decryptor, CryptoStreamMode.Read);
|
||||
|
||||
|
||||
// Since at this point we don't know what the size of decrypted data
|
||||
// will be, allocate the buffer long enough to hold EncryptedData;
|
||||
// DecryptedData is never longer than EncryptedData.
|
||||
byte[] PlainText = new byte[EncryptedData.Length];
|
||||
|
||||
// Start decrypting.
|
||||
int DecryptedCount = cryptoStream.Read(PlainText, 0, PlainText.Length);
|
||||
|
||||
|
||||
memoryStream.Close();
|
||||
cryptoStream.Close();
|
||||
|
||||
// Convert decrypted data into a string.
|
||||
string DecryptedData = Encoding.Unicode.GetString(PlainText, 0, DecryptedCount);
|
||||
|
||||
|
||||
// Return decrypted string.
|
||||
return DecryptedData;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
private string SHA1(string plainText)
|
||||
{
|
||||
// Convert plain text into a byte array.
|
||||
byte[] plainTextBytes = Encoding.UTF8.GetBytes(plainText);
|
||||
|
||||
HashAlgorithm hash = new SHA1Managed(); ;
|
||||
|
||||
// Compute hash value of our plain text with appended salt.
|
||||
byte[] hashBytes = hash.ComputeHash(plainTextBytes);
|
||||
|
||||
// Return the result.
|
||||
return Convert.ToBase64String(hashBytes);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
namespace WebsitePanel.WebDavPortal.Cryptography
|
||||
{
|
||||
public interface ICryptography
|
||||
{
|
||||
string Encrypt(string plainText);
|
||||
string Decrypt(string encryptedText);
|
||||
}
|
||||
}
|
|
@ -10,18 +10,6 @@ namespace WebsitePanel.WebDavPortal.CustomAttributes
|
|||
{
|
||||
public class LdapAuthorizationAttribute : AuthorizeAttribute
|
||||
{
|
||||
protected override bool AuthorizeCore(HttpContextBase httpContext)
|
||||
{
|
||||
var accountInfo = DependencyResolver.Current.GetService<AccountModel>();
|
||||
|
||||
if (accountInfo == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext)
|
||||
{
|
||||
filterContext.Result = new RedirectToRouteResult(AccountRouteNames.Login, null);
|
||||
|
|
|
@ -4,7 +4,10 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.SessionState;
|
||||
using WebsitePanel.WebDavPortal.Cryptography;
|
||||
using WebsitePanel.WebDav.Core.Interfaces.Security;
|
||||
using WebsitePanel.WebDav.Core.Security;
|
||||
using WebsitePanel.WebDav.Core.Security.Authentication;
|
||||
using WebsitePanel.WebDav.Core.Security.Cryptography;
|
||||
using WebsitePanel.WebDavPortal.DependencyInjection.Providers;
|
||||
using WebsitePanel.WebDavPortal.Models;
|
||||
|
||||
|
@ -12,12 +15,12 @@ namespace WebsitePanel.WebDavPortal.DependencyInjection
|
|||
{
|
||||
public class PortalDependencies
|
||||
{
|
||||
public static void Configure(IKernel kernerl)
|
||||
public static void Configure(IKernel kernel)
|
||||
{
|
||||
kernerl.Bind<HttpSessionState>().ToProvider<HttpSessionStateProvider>();
|
||||
kernerl.Bind<IWebDavManager>().ToProvider<WebDavManagerProvider>();
|
||||
kernerl.Bind<AccountModel>().ToProvider<AccountInfoProvider>();
|
||||
kernerl.Bind<ICryptography>().To<CryptoUtils>();
|
||||
kernel.Bind<HttpSessionState>().ToProvider<HttpSessionStateProvider>();
|
||||
kernel.Bind<ICryptography>().To<CryptoUtils>();
|
||||
kernel.Bind<IAuthenticationService>().To<FormsAuthenticationService>();
|
||||
kernel.Bind<IWebDavManager>().ToProvider<WebDavManagerProvider>();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
using System.Web.SessionState;
|
||||
using Ninject;
|
||||
using Ninject.Activation;
|
||||
using WebsitePanel.WebDavPortal.Config;
|
||||
using WebsitePanel.WebDavPortal.Models;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.DependencyInjection.Providers
|
||||
{
|
||||
public class AccountInfoProvider : Provider<AccountModel>
|
||||
{
|
||||
protected override AccountModel CreateInstance(IContext context)
|
||||
{
|
||||
var session = context.Kernel.Get<HttpSessionState>();
|
||||
|
||||
AccountModel accountInfo = null;
|
||||
|
||||
if (session != null)
|
||||
{
|
||||
accountInfo = session[WebDavAppConfigManager.Instance.SessionKeys.AccountInfo] as AccountModel;
|
||||
}
|
||||
|
||||
return accountInfo;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,11 @@
|
|||
using System.Web.SessionState;
|
||||
using System.Net;
|
||||
using System.Web.SessionState;
|
||||
using Ninject;
|
||||
using Ninject.Activation;
|
||||
using WebsitePanel.WebDavPortal.Config;
|
||||
using WebsitePanel.WebDav.Core;
|
||||
using WebsitePanel.WebDav.Core.Config;
|
||||
using WebsitePanel.WebDav.Core.Security.Cryptography;
|
||||
using WebsitePanel.WebDavPortal.Exceptions;
|
||||
using WebsitePanel.WebDavPortal.Models;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.DependencyInjection.Providers
|
||||
|
@ -17,6 +21,15 @@ namespace WebsitePanel.WebDavPortal.DependencyInjection.Providers
|
|||
if (session != null)
|
||||
{
|
||||
webDavManager = session[WebDavAppConfigManager.Instance.SessionKeys.WebDavManager] as WebDavManager;
|
||||
|
||||
if (webDavManager == null)
|
||||
{
|
||||
var cryptography = context.Kernel.Get<ICryptography>();
|
||||
|
||||
webDavManager = new WebDavManager(cryptography);
|
||||
|
||||
session[WebDavAppConfigManager.Instance.SessionKeys.WebDavManager] = webDavManager;
|
||||
}
|
||||
}
|
||||
|
||||
return webDavManager;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using WebsitePanel.WebDavPortal.Config;
|
||||
using WebsitePanel.WebDav.Core.Config;
|
||||
using WebsitePanel.WebDavPortal.Extensions;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.FileOperations
|
||||
|
|
|
@ -3,6 +3,10 @@ using System.Web;
|
|||
using System.Web.Mvc;
|
||||
using System.Web.Optimization;
|
||||
using System.Web.Routing;
|
||||
using System.Web.Script.Serialization;
|
||||
using System.Web.Security;
|
||||
using WebsitePanel.WebDav.Core.Config;
|
||||
using WebsitePanel.WebDav.Core.Security.Authentication.Principals;
|
||||
using WebsitePanel.WebDavPortal.Controllers;
|
||||
using WebsitePanel.WebDavPortal.DependencyInjection;
|
||||
|
||||
|
@ -48,5 +52,47 @@ namespace WebsitePanel.WebDavPortal
|
|||
controller.Execute(requestContext);
|
||||
Response.End();
|
||||
}
|
||||
|
||||
protected void Application_PostAuthenticateRequest(Object sender, EventArgs e)
|
||||
{
|
||||
HttpCookie authCookie = Request.Cookies[FormsAuthentication.FormsCookieName];
|
||||
var contextWrapper = new HttpContextWrapper(Context);
|
||||
|
||||
if (authCookie != null)
|
||||
{
|
||||
FormsAuthenticationTicket authTicket = FormsAuthentication.Decrypt(authCookie.Value);
|
||||
|
||||
var serializer = new JavaScriptSerializer();
|
||||
|
||||
var principalSerialized = serializer.Deserialize<WspPrincipal>(authTicket.UserData);
|
||||
|
||||
var principal = new WspPrincipal(principalSerialized.Login);
|
||||
|
||||
principal.AccountId = principalSerialized.AccountId;
|
||||
principal.ItemId = principalSerialized.ItemId;
|
||||
principal.OrganizationId = principalSerialized.OrganizationId;
|
||||
principal.DisplayName = principalSerialized.DisplayName;
|
||||
principal.EncryptedPassword = principalSerialized.EncryptedPassword;
|
||||
|
||||
HttpContext.Current.User = principal;
|
||||
|
||||
if (!contextWrapper.Request.IsAjaxRequest())
|
||||
{
|
||||
SetAuthenticationExpirationTicket();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetAuthenticationExpirationTicket()
|
||||
{
|
||||
var expirationDateTimeInUtc = DateTime.UtcNow.AddMinutes(FormsAuthentication.Timeout.TotalMinutes).AddSeconds(1);
|
||||
var authenticationExpirationTicketCookie = new HttpCookie(WebDavAppConfigManager.Instance.AuthTimeoutCookieName);
|
||||
|
||||
authenticationExpirationTicketCookie.Value = expirationDateTimeInUtc.Subtract(new DateTime(1970, 1, 1)).TotalMilliseconds.ToString("F0");
|
||||
authenticationExpirationTicketCookie.HttpOnly = false;
|
||||
authenticationExpirationTicketCookie.Secure = FormsAuthentication.RequireSSL;
|
||||
|
||||
HttpContext.Current.Response.Cookies.Add(authenticationExpirationTicketCookie);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -15,18 +15,6 @@ namespace WebsitePanel.WebDavPortal.Models
|
|||
[Display(Name = @"Password")]
|
||||
public string Password { get; set; }
|
||||
|
||||
public string UserName
|
||||
{
|
||||
get
|
||||
{
|
||||
return !string.IsNullOrEmpty(Login) ? Login.Split('@')[0] : string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public string DisplayName { get; set; }
|
||||
|
||||
public IEnumerable<ExchangeAccount> Groups { get; set; }
|
||||
|
||||
public string LdapError { get; set; }
|
||||
}
|
||||
}
|
|
@ -6,7 +6,6 @@ namespace WebsitePanel.WebDavPortal.Models
|
|||
public interface IWebDavManager
|
||||
{
|
||||
string RootPath { get; }
|
||||
string OrganizationName { get; }
|
||||
void OpenFolder(string pathPart);
|
||||
IEnumerable<IHierarchyItem> GetChildren();
|
||||
bool IsFile(string fileName);
|
||||
|
|
|
@ -4,10 +4,12 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text.RegularExpressions;
|
||||
using WebsitePanel.WebDav.Core;
|
||||
using WebsitePanel.WebDav.Core.Client;
|
||||
using WebsitePanel.WebDavPortal.Config;
|
||||
using WebsitePanel.WebDav.Core.Config;
|
||||
using WebsitePanel.WebDav.Core.Security.Cryptography;
|
||||
using WebsitePanel.WebDav.Core.Wsp.Framework;
|
||||
using WebsitePanel.WebDavPortal.Exceptions;
|
||||
using WebsitePanel.Portal;
|
||||
using WebsitePanel.Providers.OS;
|
||||
using Ninject;
|
||||
using WebsitePanel.WebDavPortal.DependencyInjection;
|
||||
|
@ -18,15 +20,14 @@ namespace WebsitePanel.WebDavPortal.Models
|
|||
{
|
||||
public class WebDavManager : IWebDavManager
|
||||
{
|
||||
private readonly WebDavSession _webDavSession = new WebDavSession();
|
||||
private readonly ICryptography _cryptography;
|
||||
private readonly WebDavSession _webDavSession;
|
||||
|
||||
private readonly AccountModel _accountModel;
|
||||
private readonly ILog Log;
|
||||
|
||||
private IList<SystemFile> _rootFolders;
|
||||
private int _itemId;
|
||||
private IFolder _currentFolder;
|
||||
private string _organizationName;
|
||||
private string _webDavRootPath;
|
||||
private bool _isRoot = true;
|
||||
|
||||
|
@ -35,26 +36,24 @@ namespace WebsitePanel.WebDavPortal.Models
|
|||
get { return _webDavRootPath; }
|
||||
}
|
||||
|
||||
public string OrganizationName
|
||||
public WebDavManager(ICryptography cryptography)
|
||||
{
|
||||
get { return _organizationName; }
|
||||
}
|
||||
|
||||
public WebDavManager(NetworkCredential credential, int itemId)
|
||||
{
|
||||
_accountModel = DependencyResolver.Current.GetService<AccountModel>();
|
||||
_cryptography = cryptography;
|
||||
Log = LogManager.GetLogger(this.GetType());
|
||||
|
||||
var credential = new NetworkCredential(WspContext.User.Login, _cryptography.Decrypt(WspContext.User.EncryptedPassword), WebDavAppConfigManager.Instance.UserDomain);
|
||||
|
||||
_webDavSession = new WebDavSession();
|
||||
|
||||
_webDavSession.Credentials = credential;
|
||||
_itemId = itemId;
|
||||
_rootFolders = ConnectToWebDavServer(_accountModel);
|
||||
_itemId = WspContext.User.ItemId;
|
||||
_rootFolders = ConnectToWebDavServer();
|
||||
|
||||
if (_rootFolders.Any())
|
||||
{
|
||||
var folder = _rootFolders.First();
|
||||
var uri = new Uri(folder.Url);
|
||||
_webDavRootPath = uri.Scheme + "://" + uri.Host + uri.Segments[0] + uri.Segments[1];
|
||||
_organizationName = uri.Segments[1].Trim('/');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,19 +132,22 @@ namespace WebsitePanel.WebDavPortal.Models
|
|||
}
|
||||
}
|
||||
|
||||
private IList<SystemFile> ConnectToWebDavServer(AccountModel user)
|
||||
private IList<SystemFile> ConnectToWebDavServer()
|
||||
{
|
||||
var rootFolders = new List<SystemFile>();
|
||||
var user = WspContext.User;
|
||||
|
||||
foreach (var folder in ES.Services.EnterpriseStorage.GetEnterpriseFolders(_itemId))
|
||||
var userGroups = WSP.Services.Organizations.GetSecurityGroupsByMember(user.ItemId, user.AccountId);
|
||||
|
||||
foreach (var folder in WSP.Services.EnterpriseStorage.GetEnterpriseFolders(_itemId))
|
||||
{
|
||||
var permissions = ES.Services.EnterpriseStorage.GetEnterpriseFolderPermissions(_itemId, folder.Name);
|
||||
var permissions = WSP.Services.EnterpriseStorage.GetEnterpriseFolderPermissions(_itemId, folder.Name);
|
||||
|
||||
foreach (var permission in permissions)
|
||||
{
|
||||
if ((!permission.IsGroup
|
||||
&& (permission.DisplayName == user.UserName || permission.DisplayName == user.DisplayName))
|
||||
|| (permission.IsGroup && user.Groups.Any(x=> x.DisplayName == permission.DisplayName)))
|
||||
|| (permission.IsGroup && userGroups.Any(x => x.DisplayName == permission.DisplayName)))
|
||||
{
|
||||
rootFolders.Add(folder);
|
||||
break;
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
function CheckAuthenticationExpiration(authcookieName, logoutUrl) {
|
||||
var c = $.cookie(authcookieName);
|
||||
|
||||
if (c != null && c != "" && !isNaN(c)) {
|
||||
var now = new Date();
|
||||
var ms = parseInt(c, 10);
|
||||
var expiration = new Date().setTime(ms);
|
||||
if (now > expiration) {
|
||||
window.location.replace(logoutUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function StartAuthExpirationCheckTimer(authcookieName, logoutUrl) {
|
||||
setInterval(function() {
|
||||
CheckAuthenticationExpiration(authcookieName, logoutUrl);
|
||||
}, 20000);
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
/*!
|
||||
* jQuery Cookie Plugin v1.4.0
|
||||
* https://github.com/carhartl/jquery-cookie
|
||||
*
|
||||
* Copyright 2013 Klaus Hartl
|
||||
* Released under the MIT license
|
||||
*/
|
||||
(function (factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as anonymous module.
|
||||
define(['jquery'], factory);
|
||||
} else {
|
||||
// Browser globals.
|
||||
factory(jQuery);
|
||||
}
|
||||
}(function ($) {
|
||||
|
||||
var pluses = /\+/g;
|
||||
|
||||
function encode(s) {
|
||||
return config.raw ? s : encodeURIComponent(s);
|
||||
}
|
||||
|
||||
function decode(s) {
|
||||
return config.raw ? s : decodeURIComponent(s);
|
||||
}
|
||||
|
||||
function stringifyCookieValue(value) {
|
||||
return encode(config.json ? JSON.stringify(value) : String(value));
|
||||
}
|
||||
|
||||
function parseCookieValue(s) {
|
||||
if (s.indexOf('"') === 0) {
|
||||
// This is a quoted cookie as according to RFC2068, unescape...
|
||||
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
|
||||
}
|
||||
|
||||
try {
|
||||
// Replace server-side written pluses with spaces.
|
||||
// If we can't decode the cookie, ignore it, it's unusable.
|
||||
s = decodeURIComponent(s.replace(pluses, ' '));
|
||||
} catch(e) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
// If we can't parse the cookie, ignore it, it's unusable.
|
||||
return config.json ? JSON.parse(s) : s;
|
||||
} catch(e) {}
|
||||
}
|
||||
|
||||
function read(s, converter) {
|
||||
var value = config.raw ? s : parseCookieValue(s);
|
||||
return $.isFunction(converter) ? converter(value) : value;
|
||||
}
|
||||
|
||||
var config = $.cookie = function (key, value, options) {
|
||||
|
||||
// Write
|
||||
if (value !== undefined && !$.isFunction(value)) {
|
||||
options = $.extend({}, config.defaults, options);
|
||||
|
||||
if (typeof options.expires === 'number') {
|
||||
var days = options.expires, t = options.expires = new Date();
|
||||
t.setDate(t.getDate() + days);
|
||||
}
|
||||
|
||||
return (document.cookie = [
|
||||
encode(key), '=', stringifyCookieValue(value),
|
||||
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
|
||||
options.path ? '; path=' + options.path : '',
|
||||
options.domain ? '; domain=' + options.domain : '',
|
||||
options.secure ? '; secure' : ''
|
||||
].join(''));
|
||||
}
|
||||
|
||||
// Read
|
||||
|
||||
var result = key ? undefined : {};
|
||||
|
||||
// To prevent the for loop in the first place assign an empty array
|
||||
// in case there are no cookies at all. Also prevents odd result when
|
||||
// calling $.cookie().
|
||||
var cookies = document.cookie ? document.cookie.split('; ') : [];
|
||||
|
||||
for (var i = 0, l = cookies.length; i < l; i++) {
|
||||
var parts = cookies[i].split('=');
|
||||
var name = decode(parts.shift());
|
||||
var cookie = parts.join('=');
|
||||
|
||||
if (key && key === name) {
|
||||
// If second argument (value) is a function it's a converter...
|
||||
result = read(cookie, value);
|
||||
break;
|
||||
}
|
||||
|
||||
// Prevent storing a cookie that we couldn't decode.
|
||||
if (!key && (cookie = read(cookie)) !== undefined) {
|
||||
result[name] = cookie;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
config.defaults = {};
|
||||
|
||||
$.removeCookie = function (key, options) {
|
||||
if ($.cookie(key) !== undefined) {
|
||||
// Must not alter options, thus extending a fresh object...
|
||||
$.cookie(key, '', $.extend({}, options, { expires: -1 }));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
}));
|
|
@ -5,4 +5,6 @@
|
|||
<br/>
|
||||
<h4 id="errorMessage">
|
||||
@Html.Raw(Model.Message)
|
||||
|
||||
@Html.Raw(Model.Exception)
|
||||
</h4>
|
|
@ -1,6 +1,7 @@
|
|||
@using WebsitePanel.WebDav.Core.Client
|
||||
@using WebsitePanel.WebDav.Core
|
||||
@using WebsitePanel.WebDav.Core.Client
|
||||
@using Ninject
|
||||
@using WebsitePanel.WebDavPortal.Config
|
||||
@using WebsitePanel.WebDav.Core.Config
|
||||
|
||||
@model WebsitePanel.WebDavPortal.Models.ModelForWebDav
|
||||
@{
|
||||
|
@ -24,7 +25,7 @@ else
|
|||
<div class="container">
|
||||
@if (Model != null)
|
||||
{
|
||||
string header = webDavManager.OrganizationName;
|
||||
string header = WspContext.User.OrganizationId;
|
||||
<a href="/@header/" class="btn btn-primary btn-sm active" role="button">@header</a>
|
||||
string[] elements = Model.UrlSuffix.Split(new[] {"/"}, StringSplitOptions.RemoveEmptyEntries);
|
||||
for (int i = 0; i < elements.Length; i++)
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
@using WebsitePanel.WebDav.Core.Client
|
||||
@using WebsitePanel.WebDavPortal.Config
|
||||
@using WebsitePanel.WebDav.Core.Config
|
||||
@using WebsitePanel.WebDavPortal.FileOperations
|
||||
@using Ninject;
|
||||
@model IHierarchyItem
|
||||
|
||||
@{
|
||||
string actualPath = Model.ItemType == ItemType.Folder ? "~/Content/Images/folder_100x100.png" : WebDavAppConfigManager.Instance.FileIcons[Path.GetExtension(Model.DisplayName.Trim('/'))];
|
||||
string name = Model.ItemType == ItemType.Folder ? Model.DisplayName.Trim('/') : Model.DisplayName;
|
||||
string name = Model.DisplayName.Trim('/');
|
||||
var opener = new FileOpenerManager()[Path.GetExtension(Model.DisplayName)];
|
||||
bool isTargetBlank;
|
||||
string href = "/";
|
||||
|
@ -23,7 +23,7 @@
|
|||
}
|
||||
}
|
||||
<div class="col-sm-2 element-container">
|
||||
<a href="@href" @Html.Raw(isTargetBlank ? "target=\"_blank\"" : string.Empty) title="@Model.DisplayName.Trim('/')">
|
||||
<a href="@href" @Html.Raw(isTargetBlank ? "target=\"_blank\"" : string.Empty) title="@name">
|
||||
<img class="icon-size" src="@Url.Content(actualPath)" />
|
||||
<p style="word-wrap: break-word;">@name</p>
|
||||
</a>
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
@using Ninject
|
||||
@using WebsitePanel.WebDavPortal.Config
|
||||
@using WebsitePanel.WebDav.Core
|
||||
@using WebsitePanel.WebDav.Core.Config
|
||||
@using WebsitePanel.WebDavPortal.DependencyInjection
|
||||
@using WebsitePanel.WebDavPortal.Models
|
||||
@using WebsitePanel.WebDavPortal.UI.Routes;
|
||||
|
||||
@{
|
||||
var account = DependencyResolver.Current.GetService<AccountModel>();
|
||||
}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
|
@ -30,10 +27,10 @@
|
|||
</div>
|
||||
<div class="navbar-collapse collapse">
|
||||
@{
|
||||
if (account != null)
|
||||
if (WspContext.User != null)
|
||||
{
|
||||
<a id="logout" class="nav navbar-text navbar-right" href="@Url.RouteUrl(AccountRouteNames.Logout)" title="Log out"><i class="glyphicon glyphicon-log-out"></i></a>
|
||||
<h4 id="username" class="nav navbar-text navbar-right">@account.Login</h4>
|
||||
<h4 id="username" class="nav navbar-text navbar-right">@WspContext.User.Login</h4>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
|
@ -45,6 +42,18 @@
|
|||
|
||||
@Scripts.Render("~/bundles/jquery")
|
||||
@Scripts.Render("~/bundles/bootstrap")
|
||||
|
||||
@if (WspContext.User != null)
|
||||
{
|
||||
@Scripts.Render("~/bundles/authScripts")
|
||||
|
||||
<script>
|
||||
StartAuthExpirationCheckTimer("@WebDavAppConfigManager.Instance.AuthTimeoutCookieName", "@Url.RouteUrl(AccountRouteNames.Logout)");
|
||||
</script>
|
||||
}
|
||||
|
||||
@RenderSection("scripts", required: false)
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
<webDavExplorerConfigurationSettings>
|
||||
<!--<userDomain value=""/>-->
|
||||
<applicationName value="WebDAV Explorer" />
|
||||
<authTimeoutCookieName value=".auth-logout-timeout" />
|
||||
<elementsRendering defaultCount="20" addElementsCount="20" elementsToIgnoreKey="web.config" />
|
||||
<websitePanelConstantUser login="serveradmin" password="HtR7J8dtBhovYLigXNtVutxqpvaE48Z+FBIokWZlR/g=" />
|
||||
<sessionKeys>
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
using System.Configuration;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.WebConfigSections
|
||||
{
|
||||
public class ApplicationNameElement : ConfigurationElement
|
||||
{
|
||||
private const string ValueKey = "value";
|
||||
|
||||
[ConfigurationProperty(ValueKey, IsKey = true, IsRequired = true)]
|
||||
public string Value
|
||||
{
|
||||
get { return (string)this[ValueKey]; }
|
||||
set { this[ValueKey] = value; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
using System.Configuration;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.WebConfigSections
|
||||
{
|
||||
public class ElementsRenderingElement : ConfigurationElement
|
||||
{
|
||||
private const string DefaultCountKey = "defaultCount";
|
||||
private const string AddElementsCountKey = "addElementsCount";
|
||||
private const string ElementsToIgnoreKey = "elementsToIgnoreKey";
|
||||
|
||||
[ConfigurationProperty(DefaultCountKey, IsKey = true, IsRequired = true, DefaultValue = 30)]
|
||||
public int DefaultCount
|
||||
{
|
||||
get { return (int)this[DefaultCountKey]; }
|
||||
set { this[DefaultCountKey] = value; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty(AddElementsCountKey, IsKey = true, IsRequired = true, DefaultValue = 20)]
|
||||
public int AddElementsCount
|
||||
{
|
||||
get { return (int)this[AddElementsCountKey]; }
|
||||
set { this[AddElementsCountKey] = value; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty(ElementsToIgnoreKey, IsKey = true, IsRequired = true, DefaultValue = "")]
|
||||
public string ElementsToIgnore
|
||||
{
|
||||
get { return (string)this[ElementsToIgnoreKey]; }
|
||||
set { this[ElementsToIgnoreKey] = value; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
using System.Configuration;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.WebConfigSections
|
||||
{
|
||||
public class FileIconsElement : ConfigurationElement
|
||||
{
|
||||
private const string ExtensionKey = "extension";
|
||||
private const string PathKey = "path";
|
||||
|
||||
[ConfigurationProperty(ExtensionKey, IsKey = true, IsRequired = true)]
|
||||
public string Extension
|
||||
{
|
||||
get { return (string) this[ExtensionKey]; }
|
||||
set { this[ExtensionKey] = value; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty(PathKey, IsKey = true, IsRequired = true)]
|
||||
public string Path
|
||||
{
|
||||
get { return (string) this[PathKey]; }
|
||||
set { this[PathKey] = value; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
using System.Configuration;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.WebConfigSections
|
||||
{
|
||||
[ConfigurationCollection(typeof (FileIconsElement))]
|
||||
public class FileIconsElementCollection : ConfigurationElementCollection
|
||||
{
|
||||
private const string DefaultPathKey = "defaultPath";
|
||||
|
||||
[ConfigurationProperty(DefaultPathKey, IsRequired = false, DefaultValue = "/")]
|
||||
public string DefaultPath
|
||||
{
|
||||
get { return (string) this[DefaultPathKey]; }
|
||||
set { this[DefaultPathKey] = value; }
|
||||
}
|
||||
|
||||
protected override ConfigurationElement CreateNewElement()
|
||||
{
|
||||
return new FileIconsElement();
|
||||
}
|
||||
|
||||
protected override object GetElementKey(ConfigurationElement element)
|
||||
{
|
||||
return ((FileIconsElement) element).Extension;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
using System.Configuration;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.WebConfigSections
|
||||
{
|
||||
public class OfficeOnlineElement : ConfigurationElement
|
||||
{
|
||||
private const string ExtensionKey = "extension";
|
||||
|
||||
[ConfigurationProperty(ExtensionKey, IsKey = true, IsRequired = true)]
|
||||
public string Extension
|
||||
{
|
||||
get { return this[ExtensionKey].ToString(); }
|
||||
set { this[ExtensionKey] = value; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
using System;
|
||||
using System.Configuration;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.WebConfigSections
|
||||
{
|
||||
[ConfigurationCollection(typeof(OfficeOnlineElement))]
|
||||
public class OfficeOnlineElementCollection : ConfigurationElementCollection
|
||||
{
|
||||
private const string UrlKey = "url";
|
||||
private const string IsEnabledKey = "isEnabled";
|
||||
|
||||
[ConfigurationProperty(UrlKey, IsKey = true, IsRequired = true)]
|
||||
public string Url
|
||||
{
|
||||
get { return this[UrlKey].ToString(); }
|
||||
set { this[UrlKey] = value; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty(IsEnabledKey, IsKey = true, IsRequired = true, DefaultValue = false)]
|
||||
public bool IsEnabled
|
||||
{
|
||||
get { return Boolean.Parse(this[IsEnabledKey].ToString()); }
|
||||
set { this[IsEnabledKey] = value; }
|
||||
}
|
||||
|
||||
protected override ConfigurationElement CreateNewElement()
|
||||
{
|
||||
return new OfficeOnlineElement();
|
||||
}
|
||||
|
||||
protected override object GetElementKey(ConfigurationElement element)
|
||||
{
|
||||
return ((OfficeOnlineElement)element).Extension;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
using System.Configuration;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.WebConfigSections
|
||||
{
|
||||
public class SessionKeysElement : ConfigurationElement
|
||||
{
|
||||
private const string KeyKey = "key";
|
||||
private const string ValueKey = "value";
|
||||
|
||||
public const string AccountInfoKey = "AccountInfoSessionKey";
|
||||
public const string WebDavManagerKey = "WebDavManagerSessionKey";
|
||||
public const string ResourseRenderCountKey = "ResourseRenderCountSessionKey";
|
||||
public const string ItemIdSessionKey = "ItemId";
|
||||
|
||||
[ConfigurationProperty(KeyKey, IsKey = true, IsRequired = true)]
|
||||
public string Key
|
||||
{
|
||||
get { return (string) this[KeyKey]; }
|
||||
set { this[KeyKey] = value; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty(ValueKey, IsKey = true, IsRequired = true)]
|
||||
public string Value
|
||||
{
|
||||
get { return (string) this[ValueKey]; }
|
||||
set { this[ValueKey] = value; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
using System.Configuration;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.WebConfigSections
|
||||
{
|
||||
[ConfigurationCollection(typeof (SessionKeysElement))]
|
||||
public class SessionKeysElementCollection : ConfigurationElementCollection
|
||||
{
|
||||
protected override ConfigurationElement CreateNewElement()
|
||||
{
|
||||
return new SessionKeysElement();
|
||||
}
|
||||
|
||||
protected override object GetElementKey(ConfigurationElement element)
|
||||
{
|
||||
return ((SessionKeysElement) element).Key;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
using System.Configuration;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.WebConfigSections
|
||||
{
|
||||
public class UserDomainElement : ConfigurationElement
|
||||
{
|
||||
private const string ValueKey = "value";
|
||||
|
||||
[ConfigurationProperty(ValueKey, IsKey = true, IsRequired = true)]
|
||||
public string Value
|
||||
{
|
||||
get { return (string) this[ValueKey]; }
|
||||
set { this[ValueKey] = value; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,68 +0,0 @@
|
|||
using System.Configuration;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.WebConfigSections
|
||||
{
|
||||
public class WebDavExplorerConfigurationSettingsSection : ConfigurationSection
|
||||
{
|
||||
private const string UserDomainKey = "userDomain";
|
||||
private const string AppName = "applicationName";
|
||||
private const string WebsitePanelConstantUserKey = "websitePanelConstantUser";
|
||||
private const string ElementsRenderingKey = "elementsRendering";
|
||||
private const string Rfc2898CryptographyKey = "rfc2898Cryptography";
|
||||
private const string ConnectionStringsKey = "appConnectionStrings";
|
||||
private const string SessionKeysKey = "sessionKeys";
|
||||
private const string FileIconsKey = "fileIcons";
|
||||
private const string OfficeOnlineKey = "officeOnline";
|
||||
|
||||
public const string SectionName = "webDavExplorerConfigurationSettings";
|
||||
|
||||
[ConfigurationProperty(UserDomainKey, IsRequired = true)]
|
||||
public UserDomainElement UserDomain
|
||||
{
|
||||
get { return (UserDomainElement) this[UserDomainKey]; }
|
||||
set { this[UserDomainKey] = value; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty(AppName, IsRequired = true)]
|
||||
public ApplicationNameElement ApplicationName
|
||||
{
|
||||
get { return (ApplicationNameElement)this[AppName]; }
|
||||
set { this[AppName] = value; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty(WebsitePanelConstantUserKey, IsRequired = true)]
|
||||
public WebsitePanelConstantUserElement WebsitePanelConstantUser
|
||||
{
|
||||
get { return (WebsitePanelConstantUserElement)this[WebsitePanelConstantUserKey]; }
|
||||
set { this[WebsitePanelConstantUserKey] = value; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty(ElementsRenderingKey, IsRequired = true)]
|
||||
public ElementsRenderingElement ElementsRendering
|
||||
{
|
||||
get { return (ElementsRenderingElement)this[ElementsRenderingKey]; }
|
||||
set { this[ElementsRenderingKey] = value; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty(SessionKeysKey, IsDefaultCollection = false)]
|
||||
public SessionKeysElementCollection SessionKeys
|
||||
{
|
||||
get { return (SessionKeysElementCollection) this[SessionKeysKey]; }
|
||||
set { this[SessionKeysKey] = value; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty(FileIconsKey, IsDefaultCollection = false)]
|
||||
public FileIconsElementCollection FileIcons
|
||||
{
|
||||
get { return (FileIconsElementCollection) this[FileIconsKey]; }
|
||||
set { this[FileIconsKey] = value; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty(OfficeOnlineKey, IsDefaultCollection = false)]
|
||||
public OfficeOnlineElementCollection OfficeOnline
|
||||
{
|
||||
get { return (OfficeOnlineElementCollection)this[OfficeOnlineKey]; }
|
||||
set { this[OfficeOnlineKey] = value; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
using System.Configuration;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.WebConfigSections
|
||||
{
|
||||
public class WebsitePanelConstantUserElement : ConfigurationElement
|
||||
{
|
||||
private const string LoginKey = "login";
|
||||
private const string PasswordKey = "password";
|
||||
|
||||
[ConfigurationProperty(LoginKey, IsKey = true, IsRequired = true)]
|
||||
public string Login
|
||||
{
|
||||
get { return this[LoginKey].ToString(); }
|
||||
set { this[LoginKey] = value; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty(PasswordKey, IsKey = true, IsRequired = true)]
|
||||
public string Password
|
||||
{
|
||||
get { return this[PasswordKey].ToString(); }
|
||||
set { this[PasswordKey] = value; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -137,31 +137,14 @@
|
|||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="App_GlobalResources\Resource.errors.designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resource.errors.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="App_Start\BundleConfig.cs" />
|
||||
<Compile Include="App_Start\FilterConfig.cs" />
|
||||
<Compile Include="App_Start\RouteConfig.cs" />
|
||||
<Compile Include="Config\Entities\AbstractConfigCollection.cs" />
|
||||
<Compile Include="Config\Entities\ElementsRendering.cs" />
|
||||
<Compile Include="Config\Entities\FileIconsDictionary.cs" />
|
||||
<Compile Include="Config\Entities\HttpErrorsCollection.cs" />
|
||||
<Compile Include="Config\Entities\OfficeOnlineCollection.cs" />
|
||||
<Compile Include="Config\Entities\SessionKeysCollection.cs" />
|
||||
<Compile Include="Config\Entities\WebsitePanelConstantUserParameters.cs" />
|
||||
<Compile Include="Config\IWebDavAppConfig.cs" />
|
||||
<Compile Include="Config\WebDavAppConfigManager.cs" />
|
||||
<Compile Include="Constraints\OrganizationRouteConstraint.cs" />
|
||||
<Compile Include="Controllers\AccountController.cs" />
|
||||
<Compile Include="Controllers\ErrorController.cs" />
|
||||
<Compile Include="Controllers\FileSystemController.cs" />
|
||||
<Compile Include="Cryptography\CryptoUtils.cs" />
|
||||
<Compile Include="Cryptography\ICryptography.cs" />
|
||||
<Compile Include="CustomAttributes\LdapAuthorizationAttribute.cs" />
|
||||
<Compile Include="DependencyInjection\Providers\AccountInfoProvider.cs" />
|
||||
<Compile Include="DependencyInjection\NinjectDependecyResolver.cs" />
|
||||
<Compile Include="DependencyInjection\PortalDependencies.cs" />
|
||||
<Compile Include="DependencyInjection\Providers\HttpSessionStateProvider.cs" />
|
||||
|
@ -186,17 +169,6 @@
|
|||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="UI\Routes\AccountRouteNames.cs" />
|
||||
<Compile Include="UI\Routes\FileSystemRouteNames.cs" />
|
||||
<Compile Include="WebConfigSections\ApplicationNameElement.cs" />
|
||||
<Compile Include="WebConfigSections\ElementsRenderingElement.cs" />
|
||||
<Compile Include="WebConfigSections\FileIconsElement.cs" />
|
||||
<Compile Include="WebConfigSections\FileIconsElementCollection.cs" />
|
||||
<Compile Include="WebConfigSections\OfficeOnlineElement.cs" />
|
||||
<Compile Include="WebConfigSections\OfficeOnlineElementCollection.cs" />
|
||||
<Compile Include="WebConfigSections\SessionKeysElement.cs" />
|
||||
<Compile Include="WebConfigSections\SessionKeysElementCollection.cs" />
|
||||
<Compile Include="WebConfigSections\UserDomainElement.cs" />
|
||||
<Compile Include="WebConfigSections\WebDavExplorerConfigurationSettingsSection.cs" />
|
||||
<Compile Include="WebConfigSections\WebsitePanelConstantUserElement.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Content\bootstrap-theme.css" />
|
||||
|
@ -248,6 +220,7 @@
|
|||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
<None Include="Scripts\jquery-2.1.1.intellisense.js" />
|
||||
<Content Include="Scripts\appScripts\authentication.js" />
|
||||
<Content Include="Scripts\appScripts\recalculateResourseHeight.js" />
|
||||
<Content Include="Scripts\appScripts\uploadingData2.js" />
|
||||
<Content Include="Scripts\bootstrap.js" />
|
||||
|
@ -256,6 +229,7 @@
|
|||
<Content Include="Scripts\jquery-2.1.1.min.js" />
|
||||
<Content Include="Scripts\jquery-2.1.1.min.map" />
|
||||
<None Include="Scripts\jquery.validate-vsdoc.js" />
|
||||
<Content Include="Scripts\jquery.cookie.js" />
|
||||
<Content Include="Scripts\jquery.validate.js" />
|
||||
<Content Include="Scripts\jquery.validate.min.js" />
|
||||
<Content Include="Scripts\jquery.validate.unobtrusive.js" />
|
||||
|
@ -292,22 +266,11 @@
|
|||
<Content Include="packages.config" />
|
||||
<None Include="Project_Readme.html" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="App_GlobalResources\Resource.errors.resx">
|
||||
<Generator>GlobalResourceProxyGenerator</Generator>
|
||||
<LastGenOutput>Resource.errors.designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\WebsitePanel.WebDav.Core\WebsitePanel.WebDav.Core.csproj">
|
||||
<Project>{BA147805-9EF1-45F2-BF32-A5825D4E950D}</Project>
|
||||
<Name>WebsitePanel.WebDav.Core</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\WebsitePanel.WebPortal\DesktopModules\WebsitePanel\WebsitePanel.Portal.Modules.csproj">
|
||||
<Project>{12232731-5C45-4ED6-98F8-D47ABE728280}</Project>
|
||||
<Name>WebsitePanel.Portal.Modules</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
<package id="Antlr" version="3.5.0.2" targetFramework="net45" />
|
||||
<package id="bootstrap" version="3.3.0" targetFramework="net45" />
|
||||
<package id="jQuery" version="2.1.1" targetFramework="net45" />
|
||||
<package id="jQuery.Cookie" version="1.4.0" targetFramework="net45" />
|
||||
<package id="jQuery.Validation" version="1.13.1" targetFramework="net45" />
|
||||
<package id="log4net" version="2.0.0" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.Mvc" version="5.2.2" targetFramework="net45" />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue