Merge commit
This commit is contained in:
commit
a79809bef3
81 changed files with 1489 additions and 392 deletions
|
@ -30,3 +30,4 @@ WebsitePanel/Sources/UpgradeLog.XML
|
||||||
WebsitePanel/Sources/UpgradeLog.htm
|
WebsitePanel/Sources/UpgradeLog.htm
|
||||||
WebsitePanel/Sources/_UpgradeReport_Files/UpgradeReport_Information.png
|
WebsitePanel/Sources/_UpgradeReport_Files/UpgradeReport_Information.png
|
||||||
WebsitePanel/Sources/_UpgradeReport_Files/UpgradeReport_Success.png
|
WebsitePanel/Sources/_UpgradeReport_Files/UpgradeReport_Success.png
|
||||||
|
WebsitePanel/Sources/packages
|
||||||
|
|
|
@ -543,8 +543,9 @@ namespace WebsitePanel.EnterpriseServer {
|
||||||
|
|
||||||
/// <remarks/>
|
/// <remarks/>
|
||||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetFreeRdsServersPaged", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
|
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetFreeRdsServersPaged", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
|
||||||
public RdsServersPaged GetFreeRdsServersPaged(string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) {
|
public RdsServersPaged GetFreeRdsServersPaged(int packageId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) {
|
||||||
object[] results = this.Invoke("GetFreeRdsServersPaged", new object[] {
|
object[] results = this.Invoke("GetFreeRdsServersPaged", new object[] {
|
||||||
|
packageId,
|
||||||
filterColumn,
|
filterColumn,
|
||||||
filterValue,
|
filterValue,
|
||||||
sortColumn,
|
sortColumn,
|
||||||
|
@ -554,8 +555,9 @@ namespace WebsitePanel.EnterpriseServer {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <remarks/>
|
/// <remarks/>
|
||||||
public System.IAsyncResult BeginGetFreeRdsServersPaged(string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, System.AsyncCallback callback, object asyncState) {
|
public System.IAsyncResult BeginGetFreeRdsServersPaged(int packageId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, System.AsyncCallback callback, object asyncState) {
|
||||||
return this.BeginInvoke("GetFreeRdsServersPaged", new object[] {
|
return this.BeginInvoke("GetFreeRdsServersPaged", new object[] {
|
||||||
|
packageId,
|
||||||
filterColumn,
|
filterColumn,
|
||||||
filterValue,
|
filterValue,
|
||||||
sortColumn,
|
sortColumn,
|
||||||
|
@ -570,16 +572,17 @@ namespace WebsitePanel.EnterpriseServer {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <remarks/>
|
/// <remarks/>
|
||||||
public void GetFreeRdsServersPagedAsync(string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) {
|
public void GetFreeRdsServersPagedAsync(int packageId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) {
|
||||||
this.GetFreeRdsServersPagedAsync(filterColumn, filterValue, sortColumn, startRow, maximumRows, null);
|
this.GetFreeRdsServersPagedAsync(packageId, filterColumn, filterValue, sortColumn, startRow, maximumRows, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <remarks/>
|
/// <remarks/>
|
||||||
public void GetFreeRdsServersPagedAsync(string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, object userState) {
|
public void GetFreeRdsServersPagedAsync(int packageId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, object userState) {
|
||||||
if ((this.GetFreeRdsServersPagedOperationCompleted == null)) {
|
if ((this.GetFreeRdsServersPagedOperationCompleted == null)) {
|
||||||
this.GetFreeRdsServersPagedOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetFreeRdsServersPagedOperationCompleted);
|
this.GetFreeRdsServersPagedOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetFreeRdsServersPagedOperationCompleted);
|
||||||
}
|
}
|
||||||
this.InvokeAsync("GetFreeRdsServersPaged", new object[] {
|
this.InvokeAsync("GetFreeRdsServersPaged", new object[] {
|
||||||
|
packageId,
|
||||||
filterColumn,
|
filterColumn,
|
||||||
filterValue,
|
filterValue,
|
||||||
sortColumn,
|
sortColumn,
|
||||||
|
|
|
@ -93,9 +93,9 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
return GetRdsServersPagedInternal(filterColumn, filterValue, sortColumn, startRow, maximumRows);
|
return GetRdsServersPagedInternal(filterColumn, filterValue, sortColumn, startRow, maximumRows);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RdsServersPaged GetFreeRdsServersPaged(string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows)
|
public static RdsServersPaged GetFreeRdsServersPaged(int packageId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows)
|
||||||
{
|
{
|
||||||
return GetFreeRdsServersPagedInternal(filterColumn, filterValue, sortColumn, startRow, maximumRows);
|
return GetFreeRdsServersPagedInternal(packageId, filterColumn, filterValue, sortColumn, startRow, maximumRows);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RdsServersPaged GetOrganizationRdsServersPaged(int itemId, int? collectionId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows)
|
public static RdsServersPaged GetOrganizationRdsServersPaged(int itemId, int? collectionId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows)
|
||||||
|
@ -477,17 +477,26 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static RdsServersPaged GetFreeRdsServersPagedInternal(string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows)
|
private static RdsServersPaged GetFreeRdsServersPagedInternal(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows)
|
||||||
{
|
{
|
||||||
DataSet ds = DataProvider.GetRDSServersPaged(null, null, filterColumn, filterValue, sortColumn, startRow, maximumRows);
|
|
||||||
|
|
||||||
RdsServersPaged result = new RdsServersPaged();
|
RdsServersPaged result = new RdsServersPaged();
|
||||||
|
Organization org = OrganizationController.GetOrganization(itemId);
|
||||||
|
|
||||||
|
if (org == null)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId));
|
||||||
|
var existingServers = rds.GetServersExistingInCollections();
|
||||||
|
|
||||||
|
DataSet ds = DataProvider.GetRDSServersPaged(null, null, filterColumn, filterValue, sortColumn, startRow, maximumRows);
|
||||||
result.RecordsCount = (int)ds.Tables[0].Rows[0][0];
|
result.RecordsCount = (int)ds.Tables[0].Rows[0][0];
|
||||||
|
|
||||||
List<RdsServer> tmpServers = new List<RdsServer>();
|
List<RdsServer> tmpServers = new List<RdsServer>();
|
||||||
|
|
||||||
ObjectUtils.FillCollectionFromDataView(tmpServers, ds.Tables[1].DefaultView);
|
ObjectUtils.FillCollectionFromDataView(tmpServers, ds.Tables[1].DefaultView);
|
||||||
|
tmpServers = tmpServers.Where(x => !existingServers.Select(y => y.ToUpper()).Contains(x.FqdName.ToUpper())).ToList();
|
||||||
result.Servers = tmpServers.ToArray();
|
result.Servers = tmpServers.ToArray();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2015, Outercurve Foundation.
|
// Copyright (c) 2015, Outercurve Foundation.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without modification,
|
// Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
@ -57,7 +57,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
{
|
{
|
||||||
BackgroundTask topTask = TaskManager.TopTask;
|
BackgroundTask topTask = TaskManager.TopTask;
|
||||||
var domainUsers = new Dictionary<int, UserInfo>();
|
var domainUsers = new Dictionary<int, UserInfo>();
|
||||||
var checkedDomains = new List<int>();
|
var checkedDomains = new List<DomainInfo>();
|
||||||
var expiredDomains = new List<DomainInfo>();
|
var expiredDomains = new List<DomainInfo>();
|
||||||
var nonExistenDomains = new List<DomainInfo>();
|
var nonExistenDomains = new List<DomainInfo>();
|
||||||
var allDomains = new List<DomainInfo>();
|
var allDomains = new List<DomainInfo>();
|
||||||
|
@ -101,12 +101,12 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
|
|
||||||
foreach (var domain in domains)
|
foreach (var domain in domains)
|
||||||
{
|
{
|
||||||
if (checkedDomains.Contains(domain.DomainId))
|
if (checkedDomains.Any(x=> x.DomainId == domain.DomainId))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
checkedDomains.Add(domain.DomainId);
|
checkedDomains.Add(domain);
|
||||||
|
|
||||||
ServerController.UpdateDomainWhoisData(domain);
|
ServerController.UpdateDomainWhoisData(domain);
|
||||||
|
|
||||||
|
@ -124,12 +124,11 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var subDomains = allDomains.Where(x => x.ExpirationDate == null || CheckDomainExpiration(x.ExpirationDate, daysBeforeNotify)).GroupBy(p => p.DomainId).Select(g => g.First()).ToList();
|
var subDomains = allDomains.Where(x => !checkedDomains.Any(z => z.DomainId == x.DomainId && z.ExpirationDate != null)).GroupBy(p => p.DomainId).Select(g => g.First()).ToList();
|
||||||
allTopLevelDomains = allTopLevelDomains.GroupBy(p => p.DomainId).Select(g => g.First()).ToList();
|
|
||||||
|
|
||||||
foreach (var subDomain in subDomains)
|
foreach (var subDomain in subDomains)
|
||||||
{
|
{
|
||||||
var mainDomain = allTopLevelDomains.Where(x => subDomain.DomainId != x.DomainId && subDomain.DomainName.ToLowerInvariant().Contains(x.DomainName.ToLowerInvariant())).OrderByDescending(s => s.DomainName.Length).FirstOrDefault(); ;
|
var mainDomain = checkedDomains.Where(x => subDomain.DomainId != x.DomainId && subDomain.DomainName.ToLowerInvariant().Contains(x.DomainName.ToLowerInvariant())).OrderByDescending(s => s.DomainName.Length).FirstOrDefault(); ;
|
||||||
|
|
||||||
if (mainDomain != null)
|
if (mainDomain != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2709,6 +2709,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
domain.CreationDate = ParseDate(creationDateString);
|
domain.CreationDate = ParseDate(creationDateString);
|
||||||
domain.ExpirationDate = ParseDate(expirationDateString);
|
domain.ExpirationDate = ParseDate(expirationDateString);
|
||||||
domain.RegistrarName = ParseWhoisDomainInfo(whoisResult.Raw, _registrarNamePatterns);
|
domain.RegistrarName = ParseWhoisDomainInfo(whoisResult.Raw, _registrarNamePatterns);
|
||||||
|
domain.LastUpdateDate = DateTime.Now;
|
||||||
|
|
||||||
DataProvider.UpdateWhoisDomainInfo(domain.DomainId, domain.CreationDate, domain.ExpirationDate, DateTime.Now, domain.RegistrarName);
|
DataProvider.UpdateWhoisDomainInfo(domain.DomainId, domain.CreationDate, domain.ExpirationDate, DateTime.Now, domain.RegistrarName);
|
||||||
}
|
}
|
||||||
|
@ -2727,6 +2728,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
domain.CreationDate = creationDate;
|
domain.CreationDate = creationDate;
|
||||||
domain.ExpirationDate = expirationDate;
|
domain.ExpirationDate = expirationDate;
|
||||||
domain.RegistrarName = registrarName;
|
domain.RegistrarName = registrarName;
|
||||||
|
domain.LastUpdateDate = DateTime.Now;
|
||||||
|
|
||||||
return domain;
|
return domain;
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,10 +99,10 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
}
|
}
|
||||||
|
|
||||||
[WebMethod]
|
[WebMethod]
|
||||||
public RdsServersPaged GetFreeRdsServersPaged(string filterColumn, string filterValue,
|
public RdsServersPaged GetFreeRdsServersPaged(int packageId, string filterColumn, string filterValue,
|
||||||
string sortColumn, int startRow, int maximumRows)
|
string sortColumn, int startRow, int maximumRows)
|
||||||
{
|
{
|
||||||
return RemoteDesktopServicesController.GetFreeRdsServersPaged(filterColumn, filterValue,
|
return RemoteDesktopServicesController.GetFreeRdsServersPaged(packageId, filterColumn, filterValue,
|
||||||
sortColumn, startRow, maximumRows);
|
sortColumn, startRow, maximumRows);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,5 +64,6 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
|
||||||
string[] GetApplicationUsers(string collectionName, string applicationName);
|
string[] GetApplicationUsers(string collectionName, string applicationName);
|
||||||
bool SetApplicationUsers(string collectionName, RemoteApplication remoteApp, string[] users);
|
bool SetApplicationUsers(string collectionName, RemoteApplication remoteApp, string[] users);
|
||||||
bool CheckRDSServerAvaliable(string hostname);
|
bool CheckRDSServerAvaliable(string hostname);
|
||||||
|
List<string> GetServersExistingInCollections();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -477,7 +477,7 @@ namespace WebsitePanel.Providers.Mail
|
||||||
Log.WriteStart(String.Format("Calculating mail account '{0}' size", item.Name));
|
Log.WriteStart(String.Format("Calculating mail account '{0}' size", item.Name));
|
||||||
// calculate disk space
|
// calculate disk space
|
||||||
var accountObject = GetAccountObject(item.Name);
|
var accountObject = GetAccountObject(item.Name);
|
||||||
var size = Convert.ToInt64((object)accountObject.GetProperty("U_MailboxSize"));
|
var size = Convert.ToInt64((object)accountObject.GetProperty("U_MailboxSize")) * 1024;
|
||||||
|
|
||||||
var diskspace = new ServiceProviderItemDiskSpace {ItemId = item.Id, DiskSpace = size};
|
var diskspace = new ServiceProviderItemDiskSpace {ItemId = item.Id, DiskSpace = size};
|
||||||
itemsDiskspace.Add(diskspace);
|
itemsDiskspace.Add(diskspace);
|
||||||
|
@ -564,8 +564,8 @@ namespace WebsitePanel.Providers.Mail
|
||||||
Year = date.Year,
|
Year = date.Year,
|
||||||
Month = date.Month,
|
Month = date.Month,
|
||||||
Day = date.Day,
|
Day = date.Day,
|
||||||
BytesSent = line[mailSentField],
|
BytesSent = Convert.ToInt64(fields[mailSentField])*1024,
|
||||||
BytesReceived = line[mailReceivedField]
|
BytesReceived = Convert.ToInt64(fields[mailReceivedField])*1024
|
||||||
};
|
};
|
||||||
days.Add(dailyStats);
|
days.Add(dailyStats);
|
||||||
continue;
|
continue;
|
||||||
|
@ -1035,7 +1035,7 @@ namespace WebsitePanel.Providers.Mail
|
||||||
{
|
{
|
||||||
var forwardTo = GetForwardToAddressFromAccountObject(accountObject);
|
var forwardTo = GetForwardToAddressFromAccountObject(accountObject);
|
||||||
var aliases = GetAliasListFromAccountObject(accountObject) as IEnumerable<string>;
|
var aliases = GetAliasListFromAccountObject(accountObject) as IEnumerable<string>;
|
||||||
aliasList.AddRange(aliases.Where(a => a != forwardTo).Select(alias => new MailAlias {Name = alias + "@" + domainName, ForwardTo = forwardTo + "@" + domainName}));
|
aliasList.AddRange(aliases.Where(a => a + "@" + domainName != forwardTo).Select(alias => new MailAlias {Name = alias + "@" + domainName, ForwardTo = forwardTo}));
|
||||||
}
|
}
|
||||||
|
|
||||||
accountObject.FindDone();
|
accountObject.FindDone();
|
||||||
|
|
|
@ -222,6 +222,14 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
|
||||||
{
|
{
|
||||||
runSpace = OpenRunspace();
|
runSpace = OpenRunspace();
|
||||||
|
|
||||||
|
var existingServers = GetServersExistingInCollections(runSpace);
|
||||||
|
existingServers = existingServers.Select(x => x.ToUpper()).Intersect(collection.Servers.Select(x => x.FqdName.ToUpper())).ToList();
|
||||||
|
|
||||||
|
if (existingServers.Any())
|
||||||
|
{
|
||||||
|
throw new Exception(string.Format("Server{0} {1} already added to another collection", existingServers.Count == 1 ? "" : "s", string.Join(" ,", existingServers.ToArray())));
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var server in collection.Servers)
|
foreach (var server in collection.Servers)
|
||||||
{
|
{
|
||||||
//If server will restart it will not be added to collection
|
//If server will restart it will not be added to collection
|
||||||
|
@ -302,6 +310,24 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<string> GetServersExistingInCollections()
|
||||||
|
{
|
||||||
|
Runspace runSpace = null;
|
||||||
|
List<string> existingServers = new List<string>();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
runSpace = OpenRunspace();
|
||||||
|
existingServers = GetServersExistingInCollections(runSpace);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
CloseRunspace(runSpace);
|
||||||
|
}
|
||||||
|
|
||||||
|
return existingServers;
|
||||||
|
}
|
||||||
|
|
||||||
public RdsCollection GetCollection(string collectionName)
|
public RdsCollection GetCollection(string collectionName)
|
||||||
{
|
{
|
||||||
RdsCollection collection =null;
|
RdsCollection collection =null;
|
||||||
|
@ -1380,6 +1406,23 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
|
||||||
return ExecuteShellCommand(runSpace, invokeCommand, false);
|
return ExecuteShellCommand(runSpace, invokeCommand, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal Collection<PSObject> ExecuteRemoteShellCommand(Runspace runSpace, string hostName, List<string> scripts, params string[] moduleImports)
|
||||||
|
{
|
||||||
|
Command invokeCommand = new Command("Invoke-Command");
|
||||||
|
invokeCommand.Parameters.Add("ComputerName", hostName);
|
||||||
|
|
||||||
|
RunspaceInvoke invoke = new RunspaceInvoke();
|
||||||
|
string commandString = moduleImports.Any() ? string.Format("import-module {0};", string.Join(",", moduleImports)) : string.Empty;
|
||||||
|
|
||||||
|
commandString = string.Format("{0};{1}", commandString, string.Join(";", scripts.ToArray()));
|
||||||
|
|
||||||
|
ScriptBlock sb = invoke.Invoke(string.Format("{{{0}}}", commandString))[0].BaseObject as ScriptBlock;
|
||||||
|
|
||||||
|
invokeCommand.Parameters.Add("ScriptBlock", sb);
|
||||||
|
|
||||||
|
return ExecuteShellCommand(runSpace, invokeCommand, false);
|
||||||
|
}
|
||||||
|
|
||||||
internal Collection<PSObject> ExecuteShellCommand(Runspace runSpace, Command cmd)
|
internal Collection<PSObject> ExecuteShellCommand(Runspace runSpace, Command cmd)
|
||||||
{
|
{
|
||||||
return ExecuteShellCommand(runSpace, cmd, true);
|
return ExecuteShellCommand(runSpace, cmd, true);
|
||||||
|
@ -1396,6 +1439,38 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
|
||||||
return ExecuteShellCommand(runSpace, cmd, true, out errors);
|
return ExecuteShellCommand(runSpace, cmd, true, out errors);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal Collection<PSObject> ExecuteShellCommand(Runspace runspace, List<string> scripts, out object[] errors)
|
||||||
|
{
|
||||||
|
Log.WriteStart("ExecuteShellCommand");
|
||||||
|
var errorList = new List<object>();
|
||||||
|
Collection<PSObject> results;
|
||||||
|
|
||||||
|
using (Pipeline pipeLine = runspace.CreatePipeline())
|
||||||
|
{
|
||||||
|
foreach (string script in scripts)
|
||||||
|
{
|
||||||
|
pipeLine.Commands.AddScript(script);
|
||||||
|
}
|
||||||
|
|
||||||
|
results = pipeLine.Invoke();
|
||||||
|
|
||||||
|
if (pipeLine.Error != null && pipeLine.Error.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (object item in pipeLine.Error.ReadToEnd())
|
||||||
|
{
|
||||||
|
errorList.Add(item);
|
||||||
|
string errorMessage = string.Format("Invoke error: {0}", item);
|
||||||
|
Log.WriteWarning(errorMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
errors = errorList.ToArray();
|
||||||
|
Log.WriteEnd("ExecuteShellCommand");
|
||||||
|
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
internal Collection<PSObject> ExecuteShellCommand(Runspace runSpace, Command cmd, bool useDomainController,
|
internal Collection<PSObject> ExecuteShellCommand(Runspace runSpace, Command cmd, bool useDomainController,
|
||||||
out object[] errors)
|
out object[] errors)
|
||||||
{
|
{
|
||||||
|
@ -1517,6 +1592,29 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal List<string> GetServersExistingInCollections(Runspace runSpace)
|
||||||
|
{
|
||||||
|
var existingHosts = new List<string>();
|
||||||
|
var scripts = new List<string>();
|
||||||
|
scripts.Add(string.Format("$sessions = Get-RDSessionCollection -ConnectionBroker {0}", ConnectionBroker));
|
||||||
|
scripts.Add(string.Format("foreach($session in $sessions){{Get-RDSessionHost $session.CollectionName -ConnectionBroker {0}|Select SessionHost}}", ConnectionBroker));
|
||||||
|
object[] errors;
|
||||||
|
|
||||||
|
var sessionHosts = ExecuteShellCommand(runSpace, scripts, out errors);
|
||||||
|
|
||||||
|
foreach(var host in sessionHosts)
|
||||||
|
{
|
||||||
|
var sessionHost = GetPSObjectProperty(host, "SessionHost");
|
||||||
|
|
||||||
|
if (sessionHost != null)
|
||||||
|
{
|
||||||
|
existingHosts.Add(sessionHost.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return existingHosts;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,6 +99,8 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
|
||||||
|
|
||||||
private System.Threading.SendOrPostCallback CheckRDSServerAvaliableOperationCompleted;
|
private System.Threading.SendOrPostCallback CheckRDSServerAvaliableOperationCompleted;
|
||||||
|
|
||||||
|
private System.Threading.SendOrPostCallback GetServersExistingInCollectionsOperationCompleted;
|
||||||
|
|
||||||
/// <remarks/>
|
/// <remarks/>
|
||||||
public RemoteDesktopServices() {
|
public RemoteDesktopServices() {
|
||||||
this.Url = "http://localhost:9003/RemoteDesktopServices.asmx";
|
this.Url = "http://localhost:9003/RemoteDesktopServices.asmx";
|
||||||
|
@ -167,6 +169,9 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
|
||||||
/// <remarks/>
|
/// <remarks/>
|
||||||
public event CheckRDSServerAvaliableCompletedEventHandler CheckRDSServerAvaliableCompleted;
|
public event CheckRDSServerAvaliableCompletedEventHandler CheckRDSServerAvaliableCompleted;
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public event GetServersExistingInCollectionsCompletedEventHandler GetServersExistingInCollectionsCompleted;
|
||||||
|
|
||||||
/// <remarks/>
|
/// <remarks/>
|
||||||
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
|
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
|
||||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/CreateCollection", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
|
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/CreateCollection", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
|
||||||
|
@ -1096,6 +1101,45 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
|
||||||
|
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/GetServersExistingInCollections", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
|
||||||
|
public string[] GetServersExistingInCollections() {
|
||||||
|
object[] results = this.Invoke("GetServersExistingInCollections", new object[0]);
|
||||||
|
return ((string[])(results[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public System.IAsyncResult BeginGetServersExistingInCollections(System.AsyncCallback callback, object asyncState) {
|
||||||
|
return this.BeginInvoke("GetServersExistingInCollections", new object[0], callback, asyncState);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public string[] EndGetServersExistingInCollections(System.IAsyncResult asyncResult) {
|
||||||
|
object[] results = this.EndInvoke(asyncResult);
|
||||||
|
return ((string[])(results[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public void GetServersExistingInCollectionsAsync() {
|
||||||
|
this.GetServersExistingInCollectionsAsync(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public void GetServersExistingInCollectionsAsync(object userState) {
|
||||||
|
if ((this.GetServersExistingInCollectionsOperationCompleted == null)) {
|
||||||
|
this.GetServersExistingInCollectionsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetServersExistingInCollectionsOperationCompleted);
|
||||||
|
}
|
||||||
|
this.InvokeAsync("GetServersExistingInCollections", new object[0], this.GetServersExistingInCollectionsOperationCompleted, userState);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnGetServersExistingInCollectionsOperationCompleted(object arg) {
|
||||||
|
if ((this.GetServersExistingInCollectionsCompleted != null)) {
|
||||||
|
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
|
||||||
|
this.GetServersExistingInCollectionsCompleted(this, new GetServersExistingInCollectionsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <remarks/>
|
/// <remarks/>
|
||||||
public new void CancelAsync(object userState) {
|
public new void CancelAsync(object userState) {
|
||||||
base.CancelAsync(userState);
|
base.CancelAsync(userState);
|
||||||
|
@ -1537,4 +1581,30 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||||
|
public delegate void GetServersExistingInCollectionsCompletedEventHandler(object sender, GetServersExistingInCollectionsCompletedEventArgs e);
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||||
|
[System.Diagnostics.DebuggerStepThroughAttribute()]
|
||||||
|
[System.ComponentModel.DesignerCategoryAttribute("code")]
|
||||||
|
public partial class GetServersExistingInCollectionsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
|
||||||
|
|
||||||
|
private object[] results;
|
||||||
|
|
||||||
|
internal GetServersExistingInCollectionsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
|
||||||
|
base(exception, cancelled, userState) {
|
||||||
|
this.results = results;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public string[] Result {
|
||||||
|
get {
|
||||||
|
this.RaiseExceptionIfNecessary();
|
||||||
|
return ((string[])(this.results[0]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -410,5 +410,22 @@ namespace WebsitePanel.Server
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[WebMethod, SoapHeader("settings")]
|
||||||
|
public List<string> GetServersExistingInCollections()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Log.WriteStart("'{0}' GetServersExistingInCollections", ProviderSettings.ProviderName);
|
||||||
|
var result = RDSProvider.GetServersExistingInCollections();
|
||||||
|
Log.WriteEnd("'{0}' GetServersExistingInCollections", ProviderSettings.ProviderName);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.WriteError(String.Format("'{0}' GetServersExistingInCollections", ProviderSettings.ProviderName), ex);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using WebsitePanel.WebDavPortal.WebConfigSections;
|
using WebsitePanel.WebDavPortal.WebConfigSections;
|
||||||
|
|
||||||
namespace WebsitePanel.WebDavPortal.Config.Entities
|
namespace WebsitePanel.WebDav.Core.Config.Entities
|
||||||
{
|
{
|
||||||
public abstract class AbstractConfigCollection
|
public abstract class AbstractConfigCollection
|
||||||
{
|
{
|
|
@ -1,14 +1,19 @@
|
||||||
namespace WebsitePanel.WebDavPortal.Config.Entities
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace WebsitePanel.WebDav.Core.Config.Entities
|
||||||
{
|
{
|
||||||
public class ElementsRendering : AbstractConfigCollection
|
public class ElementsRendering : AbstractConfigCollection
|
||||||
{
|
{
|
||||||
public int DefaultCount { get; private set; }
|
public int DefaultCount { get; private set; }
|
||||||
public int AddElementsCount { get; private set; }
|
public int AddElementsCount { get; private set; }
|
||||||
|
public List<string> ElementsToIgnore { get; private set; }
|
||||||
|
|
||||||
public ElementsRendering()
|
public ElementsRendering()
|
||||||
{
|
{
|
||||||
DefaultCount = ConfigSection.ElementsRendering.DefaultCount;
|
DefaultCount = ConfigSection.ElementsRendering.DefaultCount;
|
||||||
AddElementsCount = ConfigSection.ElementsRendering.AddElementsCount;
|
AddElementsCount = ConfigSection.ElementsRendering.AddElementsCount;
|
||||||
|
ElementsToIgnore = ConfigSection.ElementsRendering.ElementsToIgnore.Split(',').ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,9 +1,9 @@
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using WebsitePanel.WebDavPortal.WebConfigSections;
|
using WebsitePanel.WebDav.Core.Config.WebConfigSections;
|
||||||
|
|
||||||
namespace WebsitePanel.WebDavPortal.Config.Entities
|
namespace WebsitePanel.WebDav.Core.Config.Entities
|
||||||
{
|
{
|
||||||
public class FileIconsDictionary : AbstractConfigCollection, IReadOnlyDictionary<string, string>
|
public class FileIconsDictionary : AbstractConfigCollection, IReadOnlyDictionary<string, string>
|
||||||
{
|
{
|
|
@ -1,7 +1,6 @@
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using Resources.Resource;
|
|
||||||
|
|
||||||
namespace WebsitePanel.WebDavPortal.Config.Entities
|
namespace WebsitePanel.WebDav.Core.Config.Entities
|
||||||
{
|
{
|
||||||
public class HttpErrorsCollection
|
public class HttpErrorsCollection
|
||||||
{
|
{
|
||||||
|
@ -9,14 +8,14 @@ namespace WebsitePanel.WebDavPortal.Config.Entities
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
var message = errors.ResourceManager.GetString("_" + statusCode.ToString(CultureInfo.InvariantCulture));
|
var message = Resources.HttpErrors.ResourceManager.GetString("_" + statusCode.ToString(CultureInfo.InvariantCulture));
|
||||||
return message ?? Default;
|
return message ?? Default;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Default
|
public string Default
|
||||||
{
|
{
|
||||||
get { return errors.Default; }
|
get { return Resources.HttpErrors.Default; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using WebsitePanel.WebDavPortal.WebConfigSections;
|
using WebsitePanel.WebDavPortal.WebConfigSections;
|
||||||
|
|
||||||
namespace WebsitePanel.WebDavPortal.Config.Entities
|
namespace WebsitePanel.WebDav.Core.Config.Entities
|
||||||
{
|
{
|
||||||
public class OfficeOnlineCollection : AbstractConfigCollection, IReadOnlyCollection<string>
|
public class OfficeOnlineCollection : AbstractConfigCollection, IReadOnlyCollection<string>
|
||||||
{
|
{
|
|
@ -1,9 +1,8 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Configuration;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using WebsitePanel.WebDavPortal.WebConfigSections;
|
using WebsitePanel.WebDavPortal.WebConfigSections;
|
||||||
|
|
||||||
namespace WebsitePanel.WebDavPortal.Config.Entities
|
namespace WebsitePanel.WebDav.Core.Config.Entities
|
||||||
{
|
{
|
||||||
public class SessionKeysCollection : AbstractConfigCollection
|
public class SessionKeysCollection : AbstractConfigCollection
|
||||||
{
|
{
|
||||||
|
@ -14,12 +13,12 @@ namespace WebsitePanel.WebDavPortal.Config.Entities
|
||||||
_sessionKeys = ConfigSection.SessionKeys.Cast<SessionKeysElement>();
|
_sessionKeys = ConfigSection.SessionKeys.Cast<SessionKeysElement>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string AccountInfo
|
public string AuthTicket
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
SessionKeysElement sessionKey =
|
SessionKeysElement sessionKey =
|
||||||
_sessionKeys.FirstOrDefault(x => x.Key == SessionKeysElement.AccountInfoKey);
|
_sessionKeys.FirstOrDefault(x => x.Key == SessionKeysElement.AuthTicketKey);
|
||||||
return sessionKey != null ? sessionKey.Value : null;
|
return sessionKey != null ? sessionKey.Value : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
namespace WebsitePanel.WebDavPortal.Config.Entities
|
namespace WebsitePanel.WebDav.Core.Config.Entities
|
||||||
{
|
{
|
||||||
public class WebsitePanelConstantUserParameters : AbstractConfigCollection
|
public class WebsitePanelConstantUserParameters : AbstractConfigCollection
|
||||||
{
|
{
|
|
@ -1,6 +1,6 @@
|
||||||
using WebsitePanel.WebDavPortal.Config.Entities;
|
using WebsitePanel.WebDav.Core.Config.Entities;
|
||||||
|
|
||||||
namespace WebsitePanel.WebDavPortal.Config
|
namespace WebsitePanel.WebDav.Core.Config
|
||||||
{
|
{
|
||||||
public interface IWebDavAppConfig
|
public interface IWebDavAppConfig
|
||||||
{
|
{
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
|
|
||||||
namespace WebsitePanel.WebDavPortal.WebConfigSections
|
namespace WebsitePanel.WebDav.Core.Config.WebConfigSections
|
||||||
{
|
{
|
||||||
public class ApplicationNameElement : ConfigurationElement
|
public class ApplicationNameElement : ConfigurationElement
|
||||||
{
|
{
|
|
@ -0,0 +1,21 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace WebsitePanel.WebDav.Core.Config.WebConfigSections
|
||||||
|
{
|
||||||
|
public class AuthTimeoutCookieNameElement : 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,11 +1,12 @@
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
|
|
||||||
namespace WebsitePanel.WebDavPortal.WebConfigSections
|
namespace WebsitePanel.WebDav.Core.Config.WebConfigSections
|
||||||
{
|
{
|
||||||
public class ElementsRenderingElement : ConfigurationElement
|
public class ElementsRenderingElement : ConfigurationElement
|
||||||
{
|
{
|
||||||
private const string DefaultCountKey = "defaultCount";
|
private const string DefaultCountKey = "defaultCount";
|
||||||
private const string AddElementsCountKey = "addElementsCount";
|
private const string AddElementsCountKey = "addElementsCount";
|
||||||
|
private const string ElementsToIgnoreKey = "elementsToIgnoreKey";
|
||||||
|
|
||||||
[ConfigurationProperty(DefaultCountKey, IsKey = true, IsRequired = true, DefaultValue = 30)]
|
[ConfigurationProperty(DefaultCountKey, IsKey = true, IsRequired = true, DefaultValue = 30)]
|
||||||
public int DefaultCount
|
public int DefaultCount
|
||||||
|
@ -20,5 +21,12 @@ namespace WebsitePanel.WebDavPortal.WebConfigSections
|
||||||
get { return (int)this[AddElementsCountKey]; }
|
get { return (int)this[AddElementsCountKey]; }
|
||||||
set { this[AddElementsCountKey] = value; }
|
set { this[AddElementsCountKey] = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[ConfigurationProperty(ElementsToIgnoreKey, IsKey = true, IsRequired = true, DefaultValue = "")]
|
||||||
|
public string ElementsToIgnore
|
||||||
|
{
|
||||||
|
get { return (string)this[ElementsToIgnoreKey]; }
|
||||||
|
set { this[ElementsToIgnoreKey] = value; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
|
|
||||||
namespace WebsitePanel.WebDavPortal.WebConfigSections
|
namespace WebsitePanel.WebDav.Core.Config.WebConfigSections
|
||||||
{
|
{
|
||||||
public class FileIconsElement : ConfigurationElement
|
public class FileIconsElement : ConfigurationElement
|
||||||
{
|
{
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
|
|
||||||
namespace WebsitePanel.WebDavPortal.WebConfigSections
|
namespace WebsitePanel.WebDav.Core.Config.WebConfigSections
|
||||||
{
|
{
|
||||||
[ConfigurationCollection(typeof (FileIconsElement))]
|
[ConfigurationCollection(typeof (FileIconsElement))]
|
||||||
public class FileIconsElementCollection : ConfigurationElementCollection
|
public class FileIconsElementCollection : ConfigurationElementCollection
|
|
@ -8,6 +8,7 @@ namespace WebsitePanel.WebDavPortal.WebConfigSections
|
||||||
private const string ValueKey = "value";
|
private const string ValueKey = "value";
|
||||||
|
|
||||||
public const string AccountInfoKey = "AccountInfoSessionKey";
|
public const string AccountInfoKey = "AccountInfoSessionKey";
|
||||||
|
public const string AuthTicketKey = "AuthTicketKey";
|
||||||
public const string WebDavManagerKey = "WebDavManagerSessionKey";
|
public const string WebDavManagerKey = "WebDavManagerSessionKey";
|
||||||
public const string ResourseRenderCountKey = "ResourseRenderCountSessionKey";
|
public const string ResourseRenderCountKey = "ResourseRenderCountSessionKey";
|
||||||
public const string ItemIdSessionKey = "ItemId";
|
public const string ItemIdSessionKey = "ItemId";
|
|
@ -1,6 +1,7 @@
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
|
using WebsitePanel.WebDavPortal.WebConfigSections;
|
||||||
|
|
||||||
namespace WebsitePanel.WebDavPortal.WebConfigSections
|
namespace WebsitePanel.WebDav.Core.Config.WebConfigSections
|
||||||
{
|
{
|
||||||
[ConfigurationCollection(typeof (SessionKeysElement))]
|
[ConfigurationCollection(typeof (SessionKeysElement))]
|
||||||
public class SessionKeysElementCollection : ConfigurationElementCollection
|
public class SessionKeysElementCollection : ConfigurationElementCollection
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
|
|
||||||
namespace WebsitePanel.WebDavPortal.WebConfigSections
|
namespace WebsitePanel.WebDav.Core.Config.WebConfigSections
|
||||||
{
|
{
|
||||||
public class UserDomainElement : ConfigurationElement
|
public class UserDomainElement : ConfigurationElement
|
||||||
{
|
{
|
|
@ -1,10 +1,12 @@
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
|
using WebsitePanel.WebDav.Core.Config.WebConfigSections;
|
||||||
|
|
||||||
namespace WebsitePanel.WebDavPortal.WebConfigSections
|
namespace WebsitePanel.WebDavPortal.WebConfigSections
|
||||||
{
|
{
|
||||||
public class WebDavExplorerConfigurationSettingsSection : ConfigurationSection
|
public class WebDavExplorerConfigurationSettingsSection : ConfigurationSection
|
||||||
{
|
{
|
||||||
private const string UserDomainKey = "userDomain";
|
private const string UserDomainKey = "userDomain";
|
||||||
|
private const string AuthTimeoutCookieNameKey = "authTimeoutCookieName";
|
||||||
private const string AppName = "applicationName";
|
private const string AppName = "applicationName";
|
||||||
private const string WebsitePanelConstantUserKey = "websitePanelConstantUser";
|
private const string WebsitePanelConstantUserKey = "websitePanelConstantUser";
|
||||||
private const string ElementsRenderingKey = "elementsRendering";
|
private const string ElementsRenderingKey = "elementsRendering";
|
||||||
|
@ -16,6 +18,13 @@ namespace WebsitePanel.WebDavPortal.WebConfigSections
|
||||||
|
|
||||||
public const string SectionName = "webDavExplorerConfigurationSettings";
|
public const string SectionName = "webDavExplorerConfigurationSettings";
|
||||||
|
|
||||||
|
[ConfigurationProperty(AuthTimeoutCookieNameKey, IsRequired = true)]
|
||||||
|
public AuthTimeoutCookieNameElement AuthTimeoutCookieName
|
||||||
|
{
|
||||||
|
get { return (AuthTimeoutCookieNameElement)this[AuthTimeoutCookieNameKey]; }
|
||||||
|
set { this[AuthTimeoutCookieNameKey] = value; }
|
||||||
|
}
|
||||||
|
|
||||||
[ConfigurationProperty(UserDomainKey, IsRequired = true)]
|
[ConfigurationProperty(UserDomainKey, IsRequired = true)]
|
||||||
public UserDomainElement UserDomain
|
public UserDomainElement UserDomain
|
||||||
{
|
{
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
|
|
||||||
namespace WebsitePanel.WebDavPortal.WebConfigSections
|
namespace WebsitePanel.WebDav.Core.Config.WebConfigSections
|
||||||
{
|
{
|
||||||
public class WebsitePanelConstantUserElement : ConfigurationElement
|
public class WebsitePanelConstantUserElement : ConfigurationElement
|
||||||
{
|
{
|
|
@ -1,8 +1,8 @@
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using WebsitePanel.WebDavPortal.Config.Entities;
|
using WebsitePanel.WebDav.Core.Config.Entities;
|
||||||
using WebsitePanel.WebDavPortal.WebConfigSections;
|
using WebsitePanel.WebDavPortal.WebConfigSections;
|
||||||
|
|
||||||
namespace WebsitePanel.WebDavPortal.Config
|
namespace WebsitePanel.WebDav.Core.Config
|
||||||
{
|
{
|
||||||
public class WebDavAppConfigManager : IWebDavAppConfig
|
public class WebDavAppConfigManager : IWebDavAppConfig
|
||||||
{
|
{
|
||||||
|
@ -35,6 +35,11 @@ namespace WebsitePanel.WebDavPortal.Config
|
||||||
get { return _configSection.ApplicationName.Value; }
|
get { return _configSection.ApplicationName.Value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string AuthTimeoutCookieName
|
||||||
|
{
|
||||||
|
get { return _configSection.AuthTimeoutCookieName.Value; }
|
||||||
|
}
|
||||||
|
|
||||||
public ElementsRendering ElementsRendering { get; private set; }
|
public ElementsRendering ElementsRendering { get; private set; }
|
||||||
public WebsitePanelConstantUserParameters WebsitePanelConstantUserParameters { get; private set; }
|
public WebsitePanelConstantUserParameters WebsitePanelConstantUserParameters { get; private set; }
|
||||||
public SessionKeysCollection SessionKeys { get; private set; }
|
public SessionKeysCollection SessionKeys { get; private set; }
|
|
@ -59,7 +59,10 @@ namespace WebsitePanel.WebDav.Core
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
string displayName = _href.AbsoluteUri.Replace(_baseUri.AbsoluteUri, "");
|
var href = HttpUtility.UrlDecode(_href.AbsoluteUri);
|
||||||
|
var baseUri = HttpUtility.UrlDecode(_baseUri.AbsoluteUri);
|
||||||
|
|
||||||
|
string displayName = href.Replace(baseUri, "");
|
||||||
displayName = Regex.Replace(displayName, "\\/$", "");
|
displayName = Regex.Replace(displayName, "\\/$", "");
|
||||||
Match displayNameMatch = Regex.Match(displayName, "([\\/]+)$");
|
Match displayNameMatch = Regex.Match(displayName, "([\\/]+)$");
|
||||||
if (displayNameMatch.Success)
|
if (displayNameMatch.Success)
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using WebsitePanel.WebDav.Core.Security.Authentication.Principals;
|
||||||
|
|
||||||
|
namespace WebsitePanel.WebDav.Core.Interfaces.Security
|
||||||
|
{
|
||||||
|
public interface IAuthenticationService
|
||||||
|
{
|
||||||
|
WspPrincipal LogIn(string login, string password);
|
||||||
|
void CreateAuthenticationTicket(WspPrincipal principal);
|
||||||
|
void LogOut();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,14 +1,14 @@
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// This code was generated by a tool.
|
// This code was generated by a tool.
|
||||||
// Runtime Version:4.0.30319.18449
|
// Runtime Version:4.0.30319.33440
|
||||||
//
|
//
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
// the code is regenerated.
|
// the code is regenerated.
|
||||||
// </auto-generated>
|
// </auto-generated>
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
namespace Resources.Resource {
|
namespace WebsitePanel.WebDav.Core.Resources {
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,18 +18,18 @@ namespace Resources.Resource {
|
||||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||||
// class via a tool like ResGen or Visual Studio.
|
// class via a tool like ResGen or Visual Studio.
|
||||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||||
// with the /str option or rebuild the Visual Studio project.
|
// with the /str option, or rebuild your VS project.
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Web.Application.StronglyTypedResourceProxyBuilder", "12.0.0.0")]
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
internal class errors {
|
internal class HttpErrors {
|
||||||
|
|
||||||
private static global::System.Resources.ResourceManager resourceMan;
|
private static global::System.Resources.ResourceManager resourceMan;
|
||||||
|
|
||||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||||
|
|
||||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||||
internal errors() {
|
internal HttpErrors() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -39,7 +39,7 @@ namespace Resources.Resource {
|
||||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||||
get {
|
get {
|
||||||
if (object.ReferenceEquals(resourceMan, null)) {
|
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"));
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WebsitePanel.WebDav.Core.Resources.HttpErrors", typeof(HttpErrors).Assembly);
|
||||||
resourceMan = temp;
|
resourceMan = temp;
|
||||||
}
|
}
|
||||||
return resourceMan;
|
return resourceMan;
|
||||||
|
@ -60,15 +60,6 @@ namespace Resources.Resource {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Fatal error.
|
|
||||||
/// </summary>
|
|
||||||
internal static string Default {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("Default", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to The requested content was not found.
|
/// Looks up a localized string similar to The requested content was not found.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -86,5 +77,14 @@ namespace Resources.Resource {
|
||||||
return ResourceManager.GetString("_500", resourceCulture);
|
return ResourceManager.GetString("_500", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Fatal error.
|
||||||
|
/// </summary>
|
||||||
|
internal static string Default {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Default", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,75 @@
|
||||||
|
using System;
|
||||||
|
using System.DirectoryServices.AccountManagement;
|
||||||
|
using System.Web;
|
||||||
|
using System.Web.Script.Serialization;
|
||||||
|
using System.Web.Security;
|
||||||
|
using WebsitePanel.WebDav.Core.Config;
|
||||||
|
using WebsitePanel.WebDav.Core.Interfaces.Security;
|
||||||
|
using WebsitePanel.WebDav.Core.Security.Authentication.Principals;
|
||||||
|
using WebsitePanel.WebDav.Core.Security.Cryptography;
|
||||||
|
using WebsitePanel.WebDav.Core.Wsp.Framework;
|
||||||
|
|
||||||
|
namespace WebsitePanel.WebDav.Core.Security.Authentication
|
||||||
|
{
|
||||||
|
public class FormsAuthenticationService : IAuthenticationService
|
||||||
|
{
|
||||||
|
private readonly ICryptography _cryptography;
|
||||||
|
private readonly PrincipalContext _principalContext;
|
||||||
|
|
||||||
|
public FormsAuthenticationService(ICryptography cryptography)
|
||||||
|
{
|
||||||
|
_cryptography = cryptography;
|
||||||
|
_principalContext = new PrincipalContext(ContextType.Domain, WebDavAppConfigManager.Instance.UserDomain);
|
||||||
|
}
|
||||||
|
|
||||||
|
public WspPrincipal LogIn(string login, string password)
|
||||||
|
{
|
||||||
|
if (_principalContext.ValidateCredentials(login, password) == false)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var principal = new WspPrincipal(login);
|
||||||
|
|
||||||
|
var exchangeAccount = WSP.Services.ExchangeServer.GetAccountByAccountNameWithoutItemId(login);
|
||||||
|
var organization = WSP.Services.Organizations.GetOrganization(exchangeAccount.ItemId);
|
||||||
|
|
||||||
|
principal.AccountId = exchangeAccount.AccountId;
|
||||||
|
principal.ItemId = exchangeAccount.ItemId;
|
||||||
|
principal.OrganizationId = organization.OrganizationId;
|
||||||
|
principal.DisplayName = exchangeAccount.DisplayName;
|
||||||
|
principal.EncryptedPassword = _cryptography.Encrypt(password);
|
||||||
|
|
||||||
|
CreateAuthenticationTicket(principal);
|
||||||
|
|
||||||
|
HttpContext.Current.User = principal;
|
||||||
|
|
||||||
|
return principal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CreateAuthenticationTicket(WspPrincipal principal)
|
||||||
|
{
|
||||||
|
var serializer = new JavaScriptSerializer();
|
||||||
|
string userData = serializer.Serialize(principal);
|
||||||
|
|
||||||
|
var authTicket = new FormsAuthenticationTicket(1, principal.Identity.Name, DateTime.Now, DateTime.Now.Add(FormsAuthentication.Timeout),
|
||||||
|
FormsAuthentication.SlidingExpiration, userData);
|
||||||
|
|
||||||
|
var encTicket = FormsAuthentication.Encrypt(authTicket);
|
||||||
|
|
||||||
|
var cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encTicket);
|
||||||
|
|
||||||
|
if (FormsAuthentication.SlidingExpiration)
|
||||||
|
{
|
||||||
|
cookie.Expires = authTicket.Expiration;
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpContext.Current.Response.Cookies.Add(cookie);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LogOut()
|
||||||
|
{
|
||||||
|
FormsAuthentication.SignOut();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
using System.Security.Principal;
|
||||||
|
using System.Web.Script.Serialization;
|
||||||
|
using System.Web.Security;
|
||||||
|
using System.Xml.Serialization;
|
||||||
|
|
||||||
|
namespace WebsitePanel.WebDav.Core.Security.Authentication.Principals
|
||||||
|
{
|
||||||
|
public class WspPrincipal : IPrincipal
|
||||||
|
{
|
||||||
|
public int AccountId { get; set; }
|
||||||
|
public string OrganizationId { get; set; }
|
||||||
|
public int ItemId { get; set; }
|
||||||
|
|
||||||
|
public string Login { get; set; }
|
||||||
|
public string EncryptedPassword { get; set; }
|
||||||
|
|
||||||
|
public string DisplayName { get; set; }
|
||||||
|
|
||||||
|
public string UserName
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return !string.IsNullOrEmpty(Login) ? Login.Split('@')[0] : string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[XmlIgnore, ScriptIgnore]
|
||||||
|
public IIdentity Identity { get; private set; }
|
||||||
|
|
||||||
|
public WspPrincipal(string username)
|
||||||
|
{
|
||||||
|
Identity = new GenericIdentity(username);
|
||||||
|
Login = username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public WspPrincipal()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsInRole(string role)
|
||||||
|
{
|
||||||
|
return Identity.IsAuthenticated
|
||||||
|
&& !string.IsNullOrWhiteSpace(role)
|
||||||
|
&& Roles.IsUserInRole(Identity.Name, role);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,14 +1,11 @@
|
||||||
using Microsoft.Win32;
|
using System;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Web;
|
using Microsoft.Win32;
|
||||||
|
|
||||||
namespace WebsitePanel.WebDavPortal.Cryptography
|
namespace WebsitePanel.WebDav.Core.Security.Cryptography
|
||||||
{
|
{
|
||||||
public class CryptoUtils : ICryptography
|
public class CryptoUtils : ICryptography
|
||||||
{
|
{
|
|
@ -1,4 +1,4 @@
|
||||||
namespace WebsitePanel.WebDavPortal.Cryptography
|
namespace WebsitePanel.WebDav.Core.Security.Cryptography
|
||||||
{
|
{
|
||||||
public interface ICryptography
|
public interface ICryptography
|
||||||
{
|
{
|
|
@ -11,6 +11,8 @@
|
||||||
<AssemblyName>WebsitePanel.WebDav.Core</AssemblyName>
|
<AssemblyName>WebsitePanel.WebDav.Core</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
|
||||||
|
<RestorePackages>true</RestorePackages>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
@ -30,18 +32,82 @@
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
|
<Private>True</Private>
|
||||||
|
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\..\..\..\Scheduler Domains\WebsitePanel\Bin\Microsoft.Web.Services3.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Configuration" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.DirectoryServices.AccountManagement" />
|
||||||
<Reference Include="System.Web">
|
<Reference Include="System.Web">
|
||||||
<HintPath>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Web.dll</HintPath>
|
<HintPath>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Web.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="System.Web.Extensions" />
|
||||||
|
<Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.2\lib\net45\System.Web.Helpers.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Web.Mvc, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\packages\Microsoft.AspNet.Mvc.5.2.2\lib\net45\System.Web.Mvc.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\packages\Microsoft.AspNet.Razor.3.2.2\lib\net45\System.Web.Razor.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Web.Services" />
|
||||||
|
<Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.2\lib\net45\System.Web.WebPages.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.2\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.2\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="WebsitePanel.EnterpriseServer.Client">
|
||||||
|
<HintPath>..\WebsitePanel.WebPortal\Bin\WebsitePanel.EnterpriseServer.Client.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="WebsitePanel.Providers.Base">
|
||||||
|
<HintPath>..\WebsitePanel.WebPortal\Bin\WebsitePanel.Providers.Base.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<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\WebConfigSections\ApplicationNameElement.cs" />
|
||||||
|
<Compile Include="Config\WebConfigSections\AuthTimeoutCookieNameElement.cs" />
|
||||||
|
<Compile Include="Config\WebConfigSections\ElementsRenderingElement.cs" />
|
||||||
|
<Compile Include="Config\WebConfigSections\FileIconsElement.cs" />
|
||||||
|
<Compile Include="Config\WebConfigSections\FileIconsElementCollection.cs" />
|
||||||
|
<Compile Include="Config\WebConfigSections\OfficeOnlineElement.cs" />
|
||||||
|
<Compile Include="Config\WebConfigSections\OfficeOnlineElementCollection.cs" />
|
||||||
|
<Compile Include="Config\WebConfigSections\SessionKeysElement.cs" />
|
||||||
|
<Compile Include="Config\WebConfigSections\SessionKeysElementCollection.cs" />
|
||||||
|
<Compile Include="Config\WebConfigSections\UserDomainElement.cs" />
|
||||||
|
<Compile Include="Config\WebConfigSections\WebDavExplorerConfigurationSettingsSection.cs" />
|
||||||
|
<Compile Include="Config\WebConfigSections\WebsitePanelConstantUserElement.cs" />
|
||||||
|
<Compile Include="Config\WebDavAppConfigManager.cs" />
|
||||||
<Compile Include="Exceptions\UnauthorizedException.cs" />
|
<Compile Include="Exceptions\UnauthorizedException.cs" />
|
||||||
<Compile Include="Exceptions\WebDavException.cs" />
|
<Compile Include="Exceptions\WebDavException.cs" />
|
||||||
<Compile Include="Exceptions\WebDavHttpException.cs" />
|
<Compile Include="Exceptions\WebDavHttpException.cs" />
|
||||||
|
@ -49,6 +115,7 @@
|
||||||
<Compile Include="IFolder.cs" />
|
<Compile Include="IFolder.cs" />
|
||||||
<Compile Include="IHierarchyItem.cs" />
|
<Compile Include="IHierarchyItem.cs" />
|
||||||
<Compile Include="IItemContent.cs" />
|
<Compile Include="IItemContent.cs" />
|
||||||
|
<Compile Include="Interfaces\Security\IAuthenticationService.cs" />
|
||||||
<Compile Include="IResource.cs" />
|
<Compile Include="IResource.cs" />
|
||||||
<Compile Include="IResumableUpload.cs" />
|
<Compile Include="IResumableUpload.cs" />
|
||||||
<Compile Include="ItemType.cs" />
|
<Compile Include="ItemType.cs" />
|
||||||
|
@ -56,9 +123,45 @@
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Property.cs" />
|
<Compile Include="Property.cs" />
|
||||||
<Compile Include="PropertyName.cs" />
|
<Compile Include="PropertyName.cs" />
|
||||||
|
<Compile Include="Resources\HttpErrors.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<DependentUpon>HttpErrors.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Security\Cryptography\CryptoUtils.cs" />
|
||||||
|
<Compile Include="Security\Cryptography\ICryptography.cs" />
|
||||||
|
<Compile Include="Security\Authentication\FormsAuthenticationService.cs" />
|
||||||
|
<Compile Include="Security\Authentication\Principals\WspPrincipal.cs" />
|
||||||
<Compile Include="WebDavSession.cs" />
|
<Compile Include="WebDavSession.cs" />
|
||||||
|
<Compile Include="WspContext.cs" />
|
||||||
|
<Compile Include="Wsp\Framework\WSP.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Interfaces\ActiveDirectory\" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="packages.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\WebsitePanel.WebPortal\WebsitePanel.WebPortal.csproj">
|
||||||
|
<Project>{C99EFB18-FFE7-45BB-8CA8-29336F3E8C68}</Project>
|
||||||
|
<Name>WebsitePanel.WebPortal</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="Resources\HttpErrors.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>HttpErrors.Designer.cs</LastGenOutput>
|
||||||
|
</EmbeddedResource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
|
||||||
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
|
<PropertyGroup>
|
||||||
|
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
|
||||||
|
</Target>
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
<Target Name="BeforeBuild">
|
<Target Name="BeforeBuild">
|
||||||
|
|
|
@ -0,0 +1,287 @@
|
||||||
|
// Copyright (c) 2015, Outercurve Foundation.
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
// are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// - Redistributions of source code must retain the above copyright notice, this
|
||||||
|
// list of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//
|
||||||
|
// - Neither the name of the Outercurve Foundation nor the names of its
|
||||||
|
// contributors may be used to endorse or promote products derived from this
|
||||||
|
// software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Web;
|
||||||
|
using System.Web.Mvc;
|
||||||
|
using Microsoft.Web.Services3;
|
||||||
|
using WebsitePanel.EnterpriseServer;
|
||||||
|
using WebsitePanel.EnterpriseServer.HostedSolution;
|
||||||
|
using WebsitePanel.WebDav.Core.Config;
|
||||||
|
using WebsitePanel.WebDav.Core.Security.Cryptography;
|
||||||
|
using WebsitePanel.WebPortal;
|
||||||
|
|
||||||
|
namespace WebsitePanel.WebDav.Core.Wsp.Framework
|
||||||
|
{
|
||||||
|
// WSP.Services
|
||||||
|
|
||||||
|
public class WSP
|
||||||
|
{
|
||||||
|
private readonly ICryptography _cryptography;
|
||||||
|
|
||||||
|
protected WSP()
|
||||||
|
{
|
||||||
|
_cryptography = DependencyResolver.Current.GetService<ICryptography>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static WSP Services
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
WSP services = (WSP)HttpContext.Current.Items["WebServices"];
|
||||||
|
|
||||||
|
if (services == null)
|
||||||
|
{
|
||||||
|
services = new WSP();
|
||||||
|
HttpContext.Current.Items["WebServices"] = services;
|
||||||
|
}
|
||||||
|
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public esCRM CRM
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return GetCachedProxy<esCRM>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public esVirtualizationServer VPS
|
||||||
|
{
|
||||||
|
get { return GetCachedProxy<esVirtualizationServer>(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public esVirtualizationServerForPrivateCloud VPSPC
|
||||||
|
{
|
||||||
|
get { return GetCachedProxy<esVirtualizationServerForPrivateCloud>(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public esBlackBerry BlackBerry
|
||||||
|
{
|
||||||
|
get { return GetCachedProxy<esBlackBerry>(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public esOCS OCS
|
||||||
|
{
|
||||||
|
get { return GetCachedProxy<esOCS>(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public esLync Lync
|
||||||
|
{
|
||||||
|
get { return GetCachedProxy<esLync>(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public esOrganizations Organizations
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return GetCachedProxy<esOrganizations>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public esSystem System
|
||||||
|
{
|
||||||
|
get { return GetCachedProxy<esSystem>(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public esApplicationsInstaller ApplicationsInstaller
|
||||||
|
{
|
||||||
|
get { return GetCachedProxy<esApplicationsInstaller>(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public esWebApplicationGallery WebApplicationGallery
|
||||||
|
{
|
||||||
|
get { return GetCachedProxy<esWebApplicationGallery>(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public esAuditLog AuditLog
|
||||||
|
{
|
||||||
|
get { return GetCachedProxy<esAuditLog>(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public esAuthentication Authentication
|
||||||
|
{
|
||||||
|
get { return GetCachedProxy<esAuthentication>(false); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public esComments Comments
|
||||||
|
{
|
||||||
|
get { return GetCachedProxy<esComments>(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public esDatabaseServers DatabaseServers
|
||||||
|
{
|
||||||
|
get { return GetCachedProxy<esDatabaseServers>(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public esFiles Files
|
||||||
|
{
|
||||||
|
get { return GetCachedProxy<esFiles>(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public esFtpServers FtpServers
|
||||||
|
{
|
||||||
|
get { return GetCachedProxy<esFtpServers>(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public esMailServers MailServers
|
||||||
|
{
|
||||||
|
get { return GetCachedProxy<esMailServers>(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public esOperatingSystems OperatingSystems
|
||||||
|
{
|
||||||
|
get { return GetCachedProxy<esOperatingSystems>(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public esPackages Packages
|
||||||
|
{
|
||||||
|
get { return GetCachedProxy<esPackages>(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public esScheduler Scheduler
|
||||||
|
{
|
||||||
|
get { return GetCachedProxy<esScheduler>(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public esTasks Tasks
|
||||||
|
{
|
||||||
|
get { return GetCachedProxy<esTasks>(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public esServers Servers
|
||||||
|
{
|
||||||
|
get { return GetCachedProxy<esServers>(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public esStatisticsServers StatisticsServers
|
||||||
|
{
|
||||||
|
get { return GetCachedProxy<esStatisticsServers>(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public esUsers Users
|
||||||
|
{
|
||||||
|
get { return GetCachedProxy<esUsers>(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public esWebServers WebServers
|
||||||
|
{
|
||||||
|
get { return GetCachedProxy<esWebServers>(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public esSharePointServers SharePointServers
|
||||||
|
{
|
||||||
|
get { return GetCachedProxy<esSharePointServers>(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public esHostedSharePointServers HostedSharePointServers
|
||||||
|
{
|
||||||
|
get { return GetCachedProxy<esHostedSharePointServers>(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public esImport Import
|
||||||
|
{
|
||||||
|
get { return GetCachedProxy<esImport>(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public esBackup Backup
|
||||||
|
{
|
||||||
|
get { return GetCachedProxy<esBackup>(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public esExchangeServer ExchangeServer
|
||||||
|
{
|
||||||
|
get { return GetCachedProxy<esExchangeServer>(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public esHeliconZoo HeliconZoo
|
||||||
|
{
|
||||||
|
get { return GetCachedProxy<esHeliconZoo>(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public esEnterpriseStorage EnterpriseStorage
|
||||||
|
{
|
||||||
|
get { return GetCachedProxy<esEnterpriseStorage>(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public esRemoteDesktopServices RDS
|
||||||
|
{
|
||||||
|
get { return GetCachedProxy<esRemoteDesktopServices>(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual T GetCachedProxy<T>()
|
||||||
|
{
|
||||||
|
return GetCachedProxy<T>(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual T GetCachedProxy<T>(bool secureCalls)
|
||||||
|
{
|
||||||
|
Type t = typeof(T);
|
||||||
|
string key = t.FullName + ".ServiceProxy";
|
||||||
|
T proxy = (T)HttpContext.Current.Items[key];
|
||||||
|
if (proxy == null)
|
||||||
|
{
|
||||||
|
proxy = (T)Activator.CreateInstance(t);
|
||||||
|
HttpContext.Current.Items[key] = proxy;
|
||||||
|
}
|
||||||
|
|
||||||
|
object p = proxy;
|
||||||
|
|
||||||
|
// configure proxy
|
||||||
|
ConfigureEnterpriseServerProxy((WebServicesClientProtocol)p, secureCalls);
|
||||||
|
|
||||||
|
return proxy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ConfigureEnterpriseServerProxy(WebServicesClientProtocol proxy, bool applyPolicy)
|
||||||
|
{
|
||||||
|
// load ES properties
|
||||||
|
string serverUrl = PortalConfiguration.SiteSettings["EnterpriseServer"];
|
||||||
|
|
||||||
|
EnterpriseServerProxyConfigurator cnfg = new EnterpriseServerProxyConfigurator();
|
||||||
|
cnfg.EnterpriseServerUrl = serverUrl;
|
||||||
|
|
||||||
|
// create assertion
|
||||||
|
if (applyPolicy)
|
||||||
|
{
|
||||||
|
|
||||||
|
cnfg.Username = WebDavAppConfigManager.Instance.WebsitePanelConstantUserParameters.Login;
|
||||||
|
cnfg.Password = _cryptography.Decrypt(WebDavAppConfigManager.Instance.WebsitePanelConstantUserParameters.Password);
|
||||||
|
}
|
||||||
|
|
||||||
|
cnfg.Configure(proxy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
15
WebsitePanel/Sources/WebsitePanel.WebDav.Core/WspContext.cs
Normal file
15
WebsitePanel/Sources/WebsitePanel.WebDav.Core/WspContext.cs
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Web;
|
||||||
|
using WebsitePanel.WebDav.Core.Security.Authentication.Principals;
|
||||||
|
|
||||||
|
namespace WebsitePanel.WebDav.Core
|
||||||
|
{
|
||||||
|
public class WspContext
|
||||||
|
{
|
||||||
|
public static WspPrincipal User { get { return HttpContext.Current.User as WspPrincipal; } }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="Microsoft.AspNet.Mvc" version="5.2.2" targetFramework="net45" />
|
||||||
|
<package id="Microsoft.AspNet.Razor" version="3.2.2" targetFramework="net45" />
|
||||||
|
<package id="Microsoft.AspNet.WebPages" version="3.2.2" targetFramework="net45" />
|
||||||
|
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
|
||||||
|
</packages>
|
|
@ -8,7 +8,8 @@ namespace WebsitePanel.WebDavPortal
|
||||||
public static void RegisterBundles(BundleCollection bundles)
|
public static void RegisterBundles(BundleCollection bundles)
|
||||||
{
|
{
|
||||||
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
|
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(
|
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
|
||||||
"~/Scripts/jquery.validate*"));
|
"~/Scripts/jquery.validate*"));
|
||||||
|
@ -24,7 +25,11 @@ namespace WebsitePanel.WebDavPortal
|
||||||
|
|
||||||
bundles.Add(new ScriptBundle("~/bundles/appScripts").Include(
|
bundles.Add(new ScriptBundle("~/bundles/appScripts").Include(
|
||||||
"~/Scripts/appScripts/recalculateResourseHeight.js",
|
"~/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(
|
bundles.Add(new StyleBundle("~/Content/css").Include(
|
||||||
"~/Content/bootstrap.css",
|
"~/Content/bootstrap.css",
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using System.Web.Routing;
|
using System.Web.Routing;
|
||||||
|
using WebsitePanel.WebDavPortal.UI.Routes;
|
||||||
|
|
||||||
namespace WebsitePanel.WebDavPortal
|
namespace WebsitePanel.WebDavPortal
|
||||||
{
|
{
|
||||||
|
@ -9,6 +10,22 @@ namespace WebsitePanel.WebDavPortal
|
||||||
{
|
{
|
||||||
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
|
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
|
||||||
|
|
||||||
|
#region Account
|
||||||
|
|
||||||
|
routes.MapRoute(
|
||||||
|
name: AccountRouteNames.Logout,
|
||||||
|
url: "account/logout",
|
||||||
|
defaults: new { controller = "Account", action = "Logout" }
|
||||||
|
);
|
||||||
|
|
||||||
|
routes.MapRoute(
|
||||||
|
name: AccountRouteNames.Login,
|
||||||
|
url: "account/login",
|
||||||
|
defaults: new { controller = "Account", action = "Login" }
|
||||||
|
);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
routes.MapRoute(
|
routes.MapRoute(
|
||||||
name: "Office365DocumentRoute",
|
name: "Office365DocumentRoute",
|
||||||
url: "office365/{org}/{*pathPart}",
|
url: "office365/{org}/{*pathPart}",
|
||||||
|
@ -16,10 +33,9 @@ namespace WebsitePanel.WebDavPortal
|
||||||
);
|
);
|
||||||
|
|
||||||
routes.MapRoute(
|
routes.MapRoute(
|
||||||
name: "FilePathRoute",
|
name: FileSystemRouteNames.FilePath,
|
||||||
url: "{org}/{*pathPart}",
|
url: "{org}/{*pathPart}",
|
||||||
defaults: new { controller = "FileSystem", action = "ShowContent", pathPart = UrlParameter.Optional },
|
defaults: new { controller = "FileSystem", action = "ShowContent", pathPart = UrlParameter.Optional }
|
||||||
constraints: new { org = new WebsitePanel.WebDavPortal.Constraints.OrganizationRouteConstraint() }
|
|
||||||
);
|
);
|
||||||
|
|
||||||
routes.MapRoute(
|
routes.MapRoute(
|
||||||
|
|
|
@ -3,8 +3,9 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
|
using System.Web.Mvc;
|
||||||
using System.Web.Routing;
|
using System.Web.Routing;
|
||||||
using WebsitePanel.WebDavPortal.Config;
|
using WebsitePanel.WebDav.Core;
|
||||||
using WebsitePanel.WebDavPortal.DependencyInjection;
|
using WebsitePanel.WebDavPortal.DependencyInjection;
|
||||||
using WebsitePanel.WebDavPortal.Models;
|
using WebsitePanel.WebDavPortal.Models;
|
||||||
|
|
||||||
|
@ -12,10 +13,13 @@ namespace WebsitePanel.WebDavPortal.Constraints
|
||||||
{
|
{
|
||||||
public class OrganizationRouteConstraint : IRouteConstraint
|
public class OrganizationRouteConstraint : IRouteConstraint
|
||||||
{
|
{
|
||||||
private static string actualOrgName;
|
|
||||||
|
|
||||||
public bool Match(HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection)
|
public bool Match(HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection)
|
||||||
{
|
{
|
||||||
|
if (WspContext.User == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
object value;
|
object value;
|
||||||
if (!values.TryGetValue(parameterName, out value))
|
if (!values.TryGetValue(parameterName, out value))
|
||||||
return false;
|
return false;
|
||||||
|
@ -24,21 +28,7 @@ namespace WebsitePanel.WebDavPortal.Constraints
|
||||||
if (str == null)
|
if (str == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (routeDirection == RouteDirection.IncomingRequest)
|
return WspContext.User.OrganizationId == str;
|
||||||
return actualOrgName == str;
|
|
||||||
|
|
||||||
if (httpContext.Session == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
IKernel kernel = new StandardKernel(new WebDavExplorerAppModule());
|
|
||||||
var webDavManager = kernel.Get<IWebDavManager>();
|
|
||||||
if (webDavManager != null && str == webDavManager.OrganizationName)
|
|
||||||
{
|
|
||||||
actualOrgName = str;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -33,3 +33,16 @@ textarea {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
padding-top: 5px;
|
padding-top: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#username {
|
||||||
|
display:inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
#logout {
|
||||||
|
font-size: 1.2em;
|
||||||
|
color: #9d9d9d;
|
||||||
|
}
|
||||||
|
|
||||||
|
#logout :hover {
|
||||||
|
color: white;
|
||||||
|
}
|
|
@ -1,82 +1,65 @@
|
||||||
using System;
|
using System.Linq;
|
||||||
using System.Configuration;
|
|
||||||
using System.DirectoryServices;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Security.Cryptography;
|
|
||||||
using System.Text;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using System.Web;
|
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using System.Web.Security;
|
using System.Web.Routing;
|
||||||
using Microsoft.Win32;
|
using WebsitePanel.WebDav.Core.Config;
|
||||||
using Ninject;
|
using WebsitePanel.WebDav.Core.Security.Cryptography;
|
||||||
using WebsitePanel.EnterpriseServer;
|
|
||||||
using WebsitePanel.Portal;
|
|
||||||
using WebsitePanel.Providers.HostedSolution;
|
|
||||||
using WebsitePanel.WebDavPortal.Config;
|
|
||||||
using WebsitePanel.WebDavPortal.Cryptography;
|
|
||||||
using WebsitePanel.WebDavPortal.DependencyInjection;
|
|
||||||
using WebsitePanel.WebDavPortal.Exceptions;
|
using WebsitePanel.WebDavPortal.Exceptions;
|
||||||
using WebsitePanel.WebDavPortal.Models;
|
using WebsitePanel.WebDavPortal.Models;
|
||||||
using System.Collections.Generic;
|
using WebsitePanel.WebDavPortal.UI.Routes;
|
||||||
using WebsitePanel.Providers.OS;
|
using WebsitePanel.WebDav.Core.Interfaces.Security;
|
||||||
using WebDAV;
|
using WebsitePanel.WebDav.Core;
|
||||||
|
|
||||||
namespace WebsitePanel.WebDavPortal.Controllers
|
namespace WebsitePanel.WebDavPortal.Controllers
|
||||||
{
|
{
|
||||||
|
[AllowAnonymous]
|
||||||
public class AccountController : Controller
|
public class AccountController : Controller
|
||||||
{
|
{
|
||||||
private readonly IKernel _kernel = new StandardKernel(new NinjectSettings {AllowNullInjection = true}, new WebDavExplorerAppModule());
|
private readonly ICryptography _cryptography;
|
||||||
|
private readonly IAuthenticationService _authenticationService;
|
||||||
|
|
||||||
|
public AccountController(ICryptography cryptography, IAuthenticationService authenticationService)
|
||||||
|
{
|
||||||
|
_cryptography = cryptography;
|
||||||
|
_authenticationService = authenticationService;
|
||||||
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public ActionResult Login()
|
public ActionResult Login()
|
||||||
{
|
{
|
||||||
object isAuthentication = _kernel.Get<AccountModel>();
|
if (WspContext.User != null && WspContext.User.Identity.IsAuthenticated)
|
||||||
if (isAuthentication != null)
|
{
|
||||||
return RedirectToAction("ShowContent", "FileSystem");
|
return RedirectToRoute(FileSystemRouteNames.FilePath, new { org = WspContext.User.OrganizationId });
|
||||||
|
}
|
||||||
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult Login(AccountModel model)
|
public ActionResult Login(AccountModel model)
|
||||||
{
|
{
|
||||||
AutheticationToServicesUsingWebsitePanelUser();
|
var user = _authenticationService.LogIn(model.Login, model.Password);
|
||||||
var exchangeAccount = ES.Services.ExchangeServer.GetAccountByAccountNameWithoutItemId(model.Login);
|
|
||||||
var isAuthenticated = exchangeAccount != null && exchangeAccount.AccountPassword == model.Password;
|
|
||||||
|
|
||||||
ViewBag.LdapIsAuthentication = isAuthenticated;
|
ViewBag.LdapIsAuthentication = user.Identity.IsAuthenticated;
|
||||||
|
|
||||||
if (isAuthenticated)
|
if (user.Identity.IsAuthenticated)
|
||||||
{
|
{
|
||||||
Session[WebDavAppConfigManager.Instance.SessionKeys.ItemId] = exchangeAccount.ItemId;
|
Session[WebDavAppConfigManager.Instance.SessionKeys.WebDavManager] = null;
|
||||||
|
|
||||||
try
|
return RedirectToRoute(FileSystemRouteNames.FilePath, new { org = WspContext.User.OrganizationId });
|
||||||
{
|
|
||||||
Session[WebDavAppConfigManager.Instance.SessionKeys.AccountInfo] = model;
|
|
||||||
Session[WebDavAppConfigManager.Instance.SessionKeys.WebDavManager] = new WebDavManager(new NetworkCredential(model.Login, model.Password, WebDavAppConfigManager.Instance.UserDomain), exchangeAccount.ItemId);
|
|
||||||
}
|
|
||||||
catch (ConnectToWebDavServerException exception)
|
|
||||||
{
|
|
||||||
return View(new AccountModel { LdapError = exception.Message });
|
|
||||||
}
|
|
||||||
return RedirectToAction("ShowContent", "FileSystem", new { org = _kernel.Get<IWebDavManager>().OrganizationName });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return View(new AccountModel { LdapError = "The user name or password is incorrect" });
|
return View(new AccountModel { LdapError = "The user name or password is incorrect" });
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AutheticationToServicesUsingWebsitePanelUser()
|
[HttpGet]
|
||||||
|
public ActionResult Logout()
|
||||||
{
|
{
|
||||||
var crypto = _kernel.Get<ICryptography>();
|
_authenticationService.LogOut();
|
||||||
var websitePanelLogin = WebDavAppConfigManager.Instance.WebsitePanelConstantUserParameters.Login;
|
|
||||||
var websitePanelPassword = crypto.Decrypt(WebDavAppConfigManager.Instance.WebsitePanelConstantUserParameters.Password);
|
Session[WebDavAppConfigManager.Instance.SessionKeys.WebDavManager] = null;
|
||||||
var authTicket = new FormsAuthenticationTicket(1, websitePanelLogin, DateTime.Now, DateTime.Now.Add(FormsAuthentication.Timeout),
|
|
||||||
FormsAuthentication.SlidingExpiration, websitePanelPassword + Environment.NewLine);
|
return RedirectToRoute(AccountRouteNames.Login);
|
||||||
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;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using WebsitePanel.WebDavPortal.Config;
|
using WebsitePanel.WebDav.Core.Config;
|
||||||
using WebsitePanel.WebDavPortal.Models;
|
using WebsitePanel.WebDavPortal.Models;
|
||||||
|
|
||||||
namespace WebsitePanel.WebDavPortal.Controllers
|
namespace WebsitePanel.WebDavPortal.Controllers
|
||||||
|
|
|
@ -4,44 +4,47 @@ using System.Linq;
|
||||||
using System.Net.Mime;
|
using System.Net.Mime;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using Ninject;
|
using WebsitePanel.WebDav.Core;
|
||||||
using WebsitePanel.WebDav.Core.Client;
|
using WebsitePanel.WebDav.Core.Client;
|
||||||
|
using WebsitePanel.WebDav.Core.Config;
|
||||||
using WebsitePanel.WebDav.Core.Exceptions;
|
using WebsitePanel.WebDav.Core.Exceptions;
|
||||||
using WebsitePanel.WebDavPortal.Config;
|
|
||||||
using WebsitePanel.WebDavPortal.CustomAttributes;
|
using WebsitePanel.WebDavPortal.CustomAttributes;
|
||||||
using WebsitePanel.WebDavPortal.DependencyInjection;
|
|
||||||
using WebsitePanel.WebDavPortal.Extensions;
|
using WebsitePanel.WebDavPortal.Extensions;
|
||||||
using WebsitePanel.WebDavPortal.Models;
|
using WebsitePanel.WebDavPortal.Models;
|
||||||
using WebsitePanel.Portal;
|
|
||||||
using WebsitePanel.Providers.OS;
|
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
|
||||||
namespace WebsitePanel.WebDavPortal.Controllers
|
namespace WebsitePanel.WebDavPortal.Controllers
|
||||||
|
|
||||||
{
|
{
|
||||||
|
[ValidateInput(false)]
|
||||||
[LdapAuthorization]
|
[LdapAuthorization]
|
||||||
public class FileSystemController : Controller
|
public class FileSystemController : Controller
|
||||||
{
|
{
|
||||||
private readonly IKernel _kernel = new StandardKernel(new WebDavExplorerAppModule());
|
private readonly IWebDavManager _webdavManager;
|
||||||
|
|
||||||
|
public FileSystemController(IWebDavManager webdavManager)
|
||||||
|
{
|
||||||
|
_webdavManager = webdavManager;
|
||||||
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public ActionResult ShowContent(string org, string pathPart = "")
|
public ActionResult ShowContent(string org, string pathPart = "")
|
||||||
{
|
{
|
||||||
var webDavManager = new StandardKernel(new WebDavExplorerAppModule()).Get<IWebDavManager>();
|
if (org != WspContext.User.OrganizationId)
|
||||||
if (org != webDavManager.OrganizationName)
|
|
||||||
return new HttpStatusCodeResult(HttpStatusCode.NoContent);
|
return new HttpStatusCodeResult(HttpStatusCode.NoContent);
|
||||||
|
|
||||||
string fileName = pathPart.Split('/').Last();
|
string fileName = pathPart.Split('/').Last();
|
||||||
if (webDavManager.IsFile(fileName))
|
if (_webdavManager.IsFile(fileName))
|
||||||
{
|
{
|
||||||
var fileBytes = webDavManager.GetFileBytes(fileName);
|
var fileBytes = _webdavManager.GetFileBytes(fileName);
|
||||||
return File(fileBytes, MediaTypeNames.Application.Octet, fileName);
|
return File(fileBytes, MediaTypeNames.Application.Octet, fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
webDavManager.OpenFolder(pathPart);
|
_webdavManager.OpenFolder(pathPart);
|
||||||
IEnumerable<IHierarchyItem> children = webDavManager.GetChildren();
|
IEnumerable<IHierarchyItem> children = _webdavManager.GetChildren().Where(x => !WebDavAppConfigManager.Instance.ElementsRendering.ElementsToIgnore.Contains(x.DisplayName.Trim('/')));
|
||||||
|
|
||||||
var model = new ModelForWebDav { Items = children.Take(WebDavAppConfigManager.Instance.ElementsRendering.DefaultCount), UrlSuffix = pathPart };
|
var model = new ModelForWebDav { Items = children.Take(WebDavAppConfigManager.Instance.ElementsRendering.DefaultCount), UrlSuffix = pathPart };
|
||||||
Session[WebDavAppConfigManager.Instance.SessionKeys.ResourseRenderCount] = WebDavAppConfigManager.Instance.ElementsRendering.DefaultCount;
|
Session[WebDavAppConfigManager.Instance.SessionKeys.ResourseRenderCount] = WebDavAppConfigManager.Instance.ElementsRendering.DefaultCount;
|
||||||
|
|
||||||
|
@ -55,8 +58,7 @@ namespace WebsitePanel.WebDavPortal.Controllers
|
||||||
|
|
||||||
public ActionResult ShowOfficeDocument(string org, string pathPart = "")
|
public ActionResult ShowOfficeDocument(string org, string pathPart = "")
|
||||||
{
|
{
|
||||||
var webDavManager = _kernel.Get<IWebDavManager>();
|
string fileUrl = _webdavManager.RootPath.TrimEnd('/') + "/" + pathPart.TrimStart('/');
|
||||||
string fileUrl = webDavManager.RootPath.TrimEnd('/') + "/" + pathPart.TrimStart('/');
|
|
||||||
var uri = new Uri(WebDavAppConfigManager.Instance.OfficeOnline.Url).AddParameter("src", fileUrl).ToString();
|
var uri = new Uri(WebDavAppConfigManager.Instance.OfficeOnline.Url).AddParameter("src", fileUrl).ToString();
|
||||||
|
|
||||||
return View(new OfficeOnlineModel(uri, new Uri(fileUrl).Segments.Last()));
|
return View(new OfficeOnlineModel(uri, new Uri(fileUrl).Segments.Last()));
|
||||||
|
@ -68,9 +70,11 @@ namespace WebsitePanel.WebDavPortal.Controllers
|
||||||
if (Session[WebDavAppConfigManager.Instance.SessionKeys.ResourseRenderCount] != null)
|
if (Session[WebDavAppConfigManager.Instance.SessionKeys.ResourseRenderCount] != null)
|
||||||
{
|
{
|
||||||
var renderedElementsCount = (int)Session[WebDavAppConfigManager.Instance.SessionKeys.ResourseRenderCount];
|
var renderedElementsCount = (int)Session[WebDavAppConfigManager.Instance.SessionKeys.ResourseRenderCount];
|
||||||
var webDavManager = _kernel.Get<IWebDavManager>();
|
|
||||||
IEnumerable<IHierarchyItem> children = webDavManager.GetChildren();
|
IEnumerable<IHierarchyItem> children = _webdavManager.GetChildren();
|
||||||
|
|
||||||
var result = children.Skip(renderedElementsCount).Take(WebDavAppConfigManager.Instance.ElementsRendering.AddElementsCount);
|
var result = children.Skip(renderedElementsCount).Take(WebDavAppConfigManager.Instance.ElementsRendering.AddElementsCount);
|
||||||
|
|
||||||
Session[WebDavAppConfigManager.Instance.SessionKeys.ResourseRenderCount] = renderedElementsCount + WebDavAppConfigManager.Instance.ElementsRendering.AddElementsCount;
|
Session[WebDavAppConfigManager.Instance.SessionKeys.ResourseRenderCount] = renderedElementsCount + WebDavAppConfigManager.Instance.ElementsRendering.AddElementsCount;
|
||||||
|
|
||||||
return PartialView("_ResourseCollectionPartial", result);
|
return PartialView("_ResourseCollectionPartial", result);
|
||||||
|
|
|
@ -4,23 +4,15 @@ using System.Web.Routing;
|
||||||
using Ninject;
|
using Ninject;
|
||||||
using WebsitePanel.WebDavPortal.DependencyInjection;
|
using WebsitePanel.WebDavPortal.DependencyInjection;
|
||||||
using WebsitePanel.WebDavPortal.Models;
|
using WebsitePanel.WebDavPortal.Models;
|
||||||
|
using WebsitePanel.WebDavPortal.UI.Routes;
|
||||||
|
|
||||||
namespace WebsitePanel.WebDavPortal.CustomAttributes
|
namespace WebsitePanel.WebDavPortal.CustomAttributes
|
||||||
{
|
{
|
||||||
public class LdapAuthorizationAttribute : AuthorizeAttribute
|
public class LdapAuthorizationAttribute : AuthorizeAttribute
|
||||||
{
|
{
|
||||||
protected override bool AuthorizeCore(HttpContextBase httpContext)
|
|
||||||
{
|
|
||||||
IKernel kernel = new StandardKernel(new NinjectSettings { AllowNullInjection = true }, new WebDavExplorerAppModule());
|
|
||||||
var accountInfo = kernel.Get<AccountModel>();
|
|
||||||
if (accountInfo == null)
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext)
|
protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext)
|
||||||
{
|
{
|
||||||
filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new { controller = "Account", action = "Login" }));
|
filterContext.Result = new RedirectToRouteResult(AccountRouteNames.Login, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,19 +0,0 @@
|
||||||
using System.Web.SessionState;
|
|
||||||
using Ninject;
|
|
||||||
using Ninject.Activation;
|
|
||||||
using WebsitePanel.WebDavPortal.Config;
|
|
||||||
using WebsitePanel.WebDavPortal.Models;
|
|
||||||
|
|
||||||
namespace WebsitePanel.WebDavPortal.DependencyInjection
|
|
||||||
{
|
|
||||||
public class AccountInfoProvider : Provider<AccountModel>
|
|
||||||
{
|
|
||||||
protected override AccountModel CreateInstance(IContext context)
|
|
||||||
{
|
|
||||||
var session = context.Kernel.Get<HttpSessionState>();
|
|
||||||
|
|
||||||
var accountInfo = session[WebDavAppConfigManager.Instance.SessionKeys.AccountInfo] as AccountModel;
|
|
||||||
return accountInfo;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
using Ninject;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Web;
|
||||||
|
using System.Web.Mvc;
|
||||||
|
|
||||||
|
namespace WebsitePanel.WebDavPortal.DependencyInjection
|
||||||
|
{
|
||||||
|
public class NinjectDependecyResolver : IDependencyResolver
|
||||||
|
{
|
||||||
|
IKernel kernal;
|
||||||
|
|
||||||
|
public NinjectDependecyResolver()
|
||||||
|
{
|
||||||
|
kernal = new StandardKernel(new NinjectSettings { AllowNullInjection = true });
|
||||||
|
AddBindings();
|
||||||
|
}
|
||||||
|
|
||||||
|
public object GetService(Type serviceType)
|
||||||
|
{
|
||||||
|
return kernal.TryGet(serviceType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<object> GetServices(Type serviceType)
|
||||||
|
{
|
||||||
|
return kernal.GetAll(serviceType);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddBindings()
|
||||||
|
{
|
||||||
|
PortalDependencies.Configure(kernal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
using Ninject;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Web;
|
||||||
|
using System.Web.SessionState;
|
||||||
|
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;
|
||||||
|
|
||||||
|
namespace WebsitePanel.WebDavPortal.DependencyInjection
|
||||||
|
{
|
||||||
|
public class PortalDependencies
|
||||||
|
{
|
||||||
|
public static void Configure(IKernel kernel)
|
||||||
|
{
|
||||||
|
kernel.Bind<HttpSessionState>().ToProvider<HttpSessionStateProvider>();
|
||||||
|
kernel.Bind<ICryptography>().To<CryptoUtils>();
|
||||||
|
kernel.Bind<IAuthenticationService>().To<FormsAuthenticationService>();
|
||||||
|
kernel.Bind<IWebDavManager>().ToProvider<WebDavManagerProvider>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
using Ninject.Activation;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Web;
|
||||||
|
using System.Web.SessionState;
|
||||||
|
|
||||||
|
namespace WebsitePanel.WebDavPortal.DependencyInjection.Providers
|
||||||
|
{
|
||||||
|
public class HttpSessionStateProvider : Provider<HttpSessionState>
|
||||||
|
{
|
||||||
|
protected override HttpSessionState CreateInstance(IContext context)
|
||||||
|
{
|
||||||
|
return HttpContext.Current.Session;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
using System.Net;
|
||||||
|
using System.Web.SessionState;
|
||||||
|
using Ninject;
|
||||||
|
using Ninject.Activation;
|
||||||
|
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
|
||||||
|
{
|
||||||
|
public class WebDavManagerProvider : Provider<WebDavManager>
|
||||||
|
{
|
||||||
|
protected override WebDavManager CreateInstance(IContext context)
|
||||||
|
{
|
||||||
|
var session = context.Kernel.Get<HttpSessionState>();
|
||||||
|
|
||||||
|
WebDavManager webDavManager = null;
|
||||||
|
|
||||||
|
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,19 +0,0 @@
|
||||||
using System.Web;
|
|
||||||
using System.Web.SessionState;
|
|
||||||
using Ninject.Modules;
|
|
||||||
using WebsitePanel.WebDavPortal.Cryptography;
|
|
||||||
using WebsitePanel.WebDavPortal.Models;
|
|
||||||
|
|
||||||
namespace WebsitePanel.WebDavPortal.DependencyInjection
|
|
||||||
{
|
|
||||||
public class WebDavExplorerAppModule : NinjectModule
|
|
||||||
{
|
|
||||||
public override void Load()
|
|
||||||
{
|
|
||||||
Bind<HttpSessionState>().ToConstant(HttpContext.Current.Session);
|
|
||||||
Bind<IWebDavManager>().ToProvider<WebDavManagerProvider>();
|
|
||||||
Bind<AccountModel>().ToProvider<AccountInfoProvider>();
|
|
||||||
Bind<ICryptography>().To<CryptoUtils>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
using System.Web.SessionState;
|
|
||||||
using Ninject;
|
|
||||||
using Ninject.Activation;
|
|
||||||
using WebsitePanel.WebDavPortal.Config;
|
|
||||||
using WebsitePanel.WebDavPortal.Models;
|
|
||||||
|
|
||||||
namespace WebsitePanel.WebDavPortal.DependencyInjection
|
|
||||||
{
|
|
||||||
public class WebDavManagerProvider : Provider<WebDavManager>
|
|
||||||
{
|
|
||||||
protected override WebDavManager CreateInstance(IContext context)
|
|
||||||
{
|
|
||||||
var session = context.Kernel.Get<HttpSessionState>();
|
|
||||||
|
|
||||||
var webDavManager = session[WebDavAppConfigManager.Instance.SessionKeys.WebDavManager] as WebDavManager;
|
|
||||||
return webDavManager;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using WebsitePanel.WebDavPortal.Config;
|
using WebsitePanel.WebDav.Core.Config;
|
||||||
using WebsitePanel.WebDavPortal.Extensions;
|
using WebsitePanel.WebDavPortal.Extensions;
|
||||||
|
|
||||||
namespace WebsitePanel.WebDavPortal.FileOperations
|
namespace WebsitePanel.WebDavPortal.FileOperations
|
||||||
|
|
|
@ -3,7 +3,12 @@ using System.Web;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using System.Web.Optimization;
|
using System.Web.Optimization;
|
||||||
using System.Web.Routing;
|
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.Controllers;
|
||||||
|
using WebsitePanel.WebDavPortal.DependencyInjection;
|
||||||
|
|
||||||
namespace WebsitePanel.WebDavPortal
|
namespace WebsitePanel.WebDavPortal
|
||||||
{
|
{
|
||||||
|
@ -15,6 +20,10 @@ namespace WebsitePanel.WebDavPortal
|
||||||
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
|
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
|
||||||
RouteConfig.RegisterRoutes(RouteTable.Routes);
|
RouteConfig.RegisterRoutes(RouteTable.Routes);
|
||||||
BundleConfig.RegisterBundles(BundleTable.Bundles);
|
BundleConfig.RegisterBundles(BundleTable.Bundles);
|
||||||
|
|
||||||
|
DependencyResolver.SetResolver(new NinjectDependecyResolver());
|
||||||
|
|
||||||
|
log4net.Config.XmlConfigurator.Configure();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void Application_Error(object sender, EventArgs e)
|
protected void Application_Error(object sender, EventArgs e)
|
||||||
|
@ -43,5 +52,47 @@ namespace WebsitePanel.WebDavPortal
|
||||||
controller.Execute(requestContext);
|
controller.Execute(requestContext);
|
||||||
Response.End();
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,4 +1,6 @@
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using WebsitePanel.Providers.HostedSolution;
|
||||||
|
|
||||||
namespace WebsitePanel.WebDavPortal.Models
|
namespace WebsitePanel.WebDavPortal.Models
|
||||||
{
|
{
|
||||||
|
@ -13,14 +15,6 @@ namespace WebsitePanel.WebDavPortal.Models
|
||||||
[Display(Name = @"Password")]
|
[Display(Name = @"Password")]
|
||||||
public string Password { get; set; }
|
public string Password { get; set; }
|
||||||
|
|
||||||
public string UserName
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return !string.IsNullOrEmpty(Login) ? Login.Split('@')[0] : string.Empty;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string LdapError { get; set; }
|
public string LdapError { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,7 +6,6 @@ namespace WebsitePanel.WebDavPortal.Models
|
||||||
public interface IWebDavManager
|
public interface IWebDavManager
|
||||||
{
|
{
|
||||||
string RootPath { get; }
|
string RootPath { get; }
|
||||||
string OrganizationName { get; }
|
|
||||||
void OpenFolder(string pathPart);
|
void OpenFolder(string pathPart);
|
||||||
IEnumerable<IHierarchyItem> GetChildren();
|
IEnumerable<IHierarchyItem> GetChildren();
|
||||||
bool IsFile(string fileName);
|
bool IsFile(string fileName);
|
||||||
|
|
|
@ -4,23 +4,30 @@ using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using WebsitePanel.WebDav.Core;
|
||||||
using WebsitePanel.WebDav.Core.Client;
|
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.WebDavPortal.Exceptions;
|
||||||
using WebsitePanel.Portal;
|
|
||||||
using WebsitePanel.Providers.OS;
|
using WebsitePanel.Providers.OS;
|
||||||
using Ninject;
|
using Ninject;
|
||||||
using WebsitePanel.WebDavPortal.DependencyInjection;
|
using WebsitePanel.WebDavPortal.DependencyInjection;
|
||||||
|
using System.Web.Mvc;
|
||||||
|
using log4net;
|
||||||
|
|
||||||
namespace WebsitePanel.WebDavPortal.Models
|
namespace WebsitePanel.WebDavPortal.Models
|
||||||
{
|
{
|
||||||
public class WebDavManager : IWebDavManager
|
public class WebDavManager : IWebDavManager
|
||||||
{
|
{
|
||||||
private readonly WebDavSession _webDavSession = new WebDavSession();
|
private readonly ICryptography _cryptography;
|
||||||
|
private readonly WebDavSession _webDavSession;
|
||||||
|
|
||||||
|
private readonly ILog Log;
|
||||||
|
|
||||||
private IList<SystemFile> _rootFolders;
|
private IList<SystemFile> _rootFolders;
|
||||||
private int _itemId;
|
private int _itemId;
|
||||||
private IFolder _currentFolder;
|
private IFolder _currentFolder;
|
||||||
private string _organizationName;
|
|
||||||
private string _webDavRootPath;
|
private string _webDavRootPath;
|
||||||
private bool _isRoot = true;
|
private bool _isRoot = true;
|
||||||
|
|
||||||
|
@ -29,25 +36,24 @@ namespace WebsitePanel.WebDavPortal.Models
|
||||||
get { return _webDavRootPath; }
|
get { return _webDavRootPath; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public string OrganizationName
|
public WebDavManager(ICryptography cryptography)
|
||||||
{
|
{
|
||||||
get { return _organizationName; }
|
_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();
|
||||||
|
|
||||||
public WebDavManager(NetworkCredential credential, int itemId)
|
|
||||||
{
|
|
||||||
_webDavSession.Credentials = credential;
|
_webDavSession.Credentials = credential;
|
||||||
_itemId = itemId;
|
_itemId = WspContext.User.ItemId;
|
||||||
IKernel _kernel = new StandardKernel(new NinjectSettings { AllowNullInjection = true }, new WebDavExplorerAppModule());
|
_rootFolders = ConnectToWebDavServer();
|
||||||
var accountModel = _kernel.Get<AccountModel>();
|
|
||||||
_rootFolders = ConnectToWebDavServer(accountModel.UserName);
|
|
||||||
|
|
||||||
if (_rootFolders.Any())
|
if (_rootFolders.Any())
|
||||||
{
|
{
|
||||||
var folder = _rootFolders.First();
|
var folder = _rootFolders.First();
|
||||||
var uri = new Uri(folder.Url);
|
var uri = new Uri(folder.Url);
|
||||||
_webDavRootPath = uri.Scheme + "://" + uri.Host + uri.Segments[0] + uri.Segments[1];
|
_webDavRootPath = uri.Scheme + "://" + uri.Host + uri.Segments[0] + uri.Segments[1];
|
||||||
_organizationName = uri.Segments[1].Trim('/');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,14 +132,27 @@ namespace WebsitePanel.WebDavPortal.Models
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private IList<SystemFile> ConnectToWebDavServer(string userName)
|
private IList<SystemFile> ConnectToWebDavServer()
|
||||||
{
|
{
|
||||||
var rootFolders = new List<SystemFile>();
|
var rootFolders = new List<SystemFile>();
|
||||||
foreach (var folder in ES.Services.EnterpriseStorage.GetEnterpriseFolders(_itemId))
|
var user = WspContext.User;
|
||||||
|
|
||||||
|
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);
|
||||||
if (permissions.Any(x => x.DisplayName == userName))
|
|
||||||
rootFolders.Add(folder);
|
foreach (var permission in permissions)
|
||||||
|
{
|
||||||
|
if ((!permission.IsGroup
|
||||||
|
&& (permission.DisplayName == user.UserName || permission.DisplayName == user.DisplayName))
|
||||||
|
|| (permission.IsGroup && userGroups.Any(x => x.DisplayName == permission.DisplayName)))
|
||||||
|
{
|
||||||
|
rootFolders.Add(folder);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return rootFolders;
|
return rootFolders;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
|
@ -24,6 +24,8 @@ function GetResources() {
|
||||||
GetResources();
|
GetResources();
|
||||||
oldResourcesDivHeight = $('#resourcesDiv').height();
|
oldResourcesDivHeight = $('#resourcesDiv').height();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
recalculateResourseHeight();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -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;
|
||||||
|
};
|
||||||
|
|
||||||
|
}));
|
|
@ -0,0 +1,13 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Web;
|
||||||
|
|
||||||
|
namespace WebsitePanel.WebDavPortal.UI.Routes
|
||||||
|
{
|
||||||
|
public class AccountRouteNames
|
||||||
|
{
|
||||||
|
public const string Logout = "AccountLogout";
|
||||||
|
public const string Login = "AccountLogin";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Web;
|
||||||
|
|
||||||
|
namespace WebsitePanel.WebDavPortal.UI.Routes
|
||||||
|
{
|
||||||
|
public class FileSystemRouteNames
|
||||||
|
{
|
||||||
|
public const string FilePath = "FilePathRoute";
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,9 +16,9 @@
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="inputEmail" class="col-sm-2 control-label">Login</label>
|
<label for="inputLogin" class="col-sm-2 control-label">Login</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
@Html.TextBoxFor(x => x.Login, new { @class = "form-control", id = "inputPassword", placeholder = "Login" })
|
@Html.TextBoxFor(x => x.Login, new { @class = "form-control", id = "inputLogin", placeholder = "Login", autofocus = "autofocus" })
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
@ -34,3 +34,13 @@
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
@section scripts
|
||||||
|
{
|
||||||
|
<script>
|
||||||
|
$(document).ready(function () {
|
||||||
|
$('[autofocus]').focus();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
}
|
||||||
|
|
|
@ -5,4 +5,6 @@
|
||||||
<br/>
|
<br/>
|
||||||
<h4 id="errorMessage">
|
<h4 id="errorMessage">
|
||||||
@Html.Raw(Model.Message)
|
@Html.Raw(Model.Message)
|
||||||
|
|
||||||
|
@Html.Raw(Model.Exception)
|
||||||
</h4>
|
</h4>
|
|
@ -1,9 +1,12 @@
|
||||||
@using WebsitePanel.WebDav.Core.Client
|
@using WebsitePanel.WebDav.Core
|
||||||
|
@using WebsitePanel.WebDav.Core.Client
|
||||||
@using Ninject
|
@using Ninject
|
||||||
|
@using WebsitePanel.WebDav.Core.Config
|
||||||
|
|
||||||
@model WebsitePanel.WebDavPortal.Models.ModelForWebDav
|
@model WebsitePanel.WebDavPortal.Models.ModelForWebDav
|
||||||
@{
|
@{
|
||||||
var webDavManager = (new StandardKernel(new WebsitePanel.WebDavPortal.DependencyInjection.WebDavExplorerAppModule())).Get<WebsitePanel.WebDavPortal.Models.IWebDavManager>();
|
var webDavManager = DependencyResolver.Current.GetService<WebsitePanel.WebDavPortal.Models.IWebDavManager>();
|
||||||
ViewBag.Title = (string.IsNullOrEmpty(Model.UrlSuffix) ? webDavManager.OrganizationName : Model.UrlSuffix);
|
ViewBag.Title = WebDavAppConfigManager.Instance.ApplicationName;
|
||||||
}
|
}
|
||||||
@Scripts.Render("~/bundles/jquery")
|
@Scripts.Render("~/bundles/jquery")
|
||||||
@Scripts.Render("~/bundles/appScripts")
|
@Scripts.Render("~/bundles/appScripts")
|
||||||
|
@ -22,7 +25,7 @@ else
|
||||||
<div class="container">
|
<div class="container">
|
||||||
@if (Model != null)
|
@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>
|
<a href="/@header/" class="btn btn-primary btn-sm active" role="button">@header</a>
|
||||||
string[] elements = Model.UrlSuffix.Split(new[] {"/"}, StringSplitOptions.RemoveEmptyEntries);
|
string[] elements = Model.UrlSuffix.Split(new[] {"/"}, StringSplitOptions.RemoveEmptyEntries);
|
||||||
for (int i = 0; i < elements.Length; i++)
|
for (int i = 0; i < elements.Length; i++)
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
@using WebsitePanel.WebDav.Core.Client
|
@using WebsitePanel.WebDav.Core.Client
|
||||||
@using WebsitePanel.WebDavPortal.Config
|
@using WebsitePanel.WebDav.Core.Config
|
||||||
@using WebsitePanel.WebDavPortal.FileOperations
|
@using WebsitePanel.WebDavPortal.FileOperations
|
||||||
@using Ninject;
|
@using Ninject;
|
||||||
@model IHierarchyItem
|
@model IHierarchyItem
|
||||||
|
|
||||||
@{
|
@{
|
||||||
string actualPath = Model.ItemType == ItemType.Folder ? "~/Content/Images/folder_100x100.png" : WebDavAppConfigManager.Instance.FileIcons[Path.GetExtension(Model.DisplayName.Trim('/'))];
|
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('/') : Path.GetFileNameWithoutExtension(Model.DisplayName);
|
string name = Model.DisplayName.Trim('/');
|
||||||
var opener = new FileOpenerManager()[Path.GetExtension(Model.DisplayName)];
|
var opener = new FileOpenerManager()[Path.GetExtension(Model.DisplayName)];
|
||||||
bool isTargetBlank;
|
bool isTargetBlank;
|
||||||
string href = "/";
|
string href = "/";
|
||||||
|
@ -18,14 +18,12 @@
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
isTargetBlank = false;
|
isTargetBlank = false;
|
||||||
IKernel _kernel = new StandardKernel(new WebsitePanel.WebDavPortal.DependencyInjection.WebDavExplorerAppModule());
|
|
||||||
var webDavManager = _kernel.Get<WebsitePanel.WebDavPortal.Models.IWebDavManager>();
|
|
||||||
href = Model.Href.AbsolutePath;
|
href = Model.Href.AbsolutePath;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
<div class="col-sm-2 element-container">
|
<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)" />
|
<img class="icon-size" src="@Url.Content(actualPath)" />
|
||||||
<p style="word-wrap: break-word;">@name</p>
|
<p style="word-wrap: break-word;">@name</p>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
@using Ninject
|
@using Ninject
|
||||||
@using WebsitePanel.WebDavPortal.Config
|
@using WebsitePanel.WebDav.Core
|
||||||
|
@using WebsitePanel.WebDav.Core.Config
|
||||||
@using WebsitePanel.WebDavPortal.DependencyInjection
|
@using WebsitePanel.WebDavPortal.DependencyInjection
|
||||||
@using WebsitePanel.WebDavPortal.Models
|
@using WebsitePanel.WebDavPortal.Models
|
||||||
|
@using WebsitePanel.WebDavPortal.UI.Routes;
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
@ -20,17 +23,16 @@
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
</button>
|
</button>
|
||||||
@Html.ActionLink(WebDavAppConfigManager.Instance.ApplicationName, "Login", "Account", new { area = "" }, new { @class = "navbar-brand" })
|
@Html.RouteLink(WebDavAppConfigManager.Instance.ApplicationName, FileSystemRouteNames.FilePath, new { pathPart = string.Empty }, new { @class = "navbar-brand" })
|
||||||
</div>
|
</div>
|
||||||
<div class="navbar-collapse collapse">
|
<div class="navbar-collapse collapse">
|
||||||
@{
|
@{
|
||||||
IKernel kernel = new StandardKernel(new NinjectSettings { AllowNullInjection = true }, new WebDavExplorerAppModule());
|
if (WspContext.User != null)
|
||||||
var account = kernel.Get<AccountModel>();
|
|
||||||
if (account != null)
|
|
||||||
{
|
{
|
||||||
<h4 class="nav navbar-text navbar-right">@account.UserName</h4>
|
<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">@WspContext.User.Login</h4>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -40,6 +42,18 @@
|
||||||
|
|
||||||
@Scripts.Render("~/bundles/jquery")
|
@Scripts.Render("~/bundles/jquery")
|
||||||
@Scripts.Render("~/bundles/bootstrap")
|
@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)
|
@RenderSection("scripts", required: false)
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,54 +1,70 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!--
|
<!--
|
||||||
For more information on how to configure your ASP.NET application, please visit
|
For more information on how to configure your ASP.NET application, please visit
|
||||||
http://go.microsoft.com/fwlink/?LinkId=301880
|
http://go.microsoft.com/fwlink/?LinkId=301880
|
||||||
-->
|
-->
|
||||||
<configuration>
|
<configuration>
|
||||||
<configSections>
|
<configSections>
|
||||||
<section name="webDavExplorerConfigurationSettings" type="WebsitePanel.WebDavPortal.WebConfigSections.WebDavExplorerConfigurationSettingsSection" allowLocation="true" allowDefinition="Everywhere"/>
|
<section name="webDavExplorerConfigurationSettings" type="WebsitePanel.WebDavPortal.WebConfigSections.WebDavExplorerConfigurationSettingsSection" allowLocation="true" allowDefinition="Everywhere" />
|
||||||
|
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
|
||||||
</configSections>
|
</configSections>
|
||||||
|
<log4net>
|
||||||
|
<appender name="FileAppender" type="log4net.Appender.FileAppender">
|
||||||
|
<param name="File" value="Logs\log-debug.log" />
|
||||||
|
<param name="AppendToFile" value="true" />
|
||||||
|
<layout type="log4net.Layout.PatternLayout">
|
||||||
|
<param name="ConversionPattern" value="%d %-5p %c - %m%n" />
|
||||||
|
</layout>
|
||||||
|
</appender>
|
||||||
|
<root>
|
||||||
|
<level value="DEBUG" />
|
||||||
|
<appender-ref ref="FileAppender" />
|
||||||
|
</root>
|
||||||
|
</log4net>
|
||||||
|
|
||||||
<appSettings>
|
<appSettings>
|
||||||
<add key="webpages:Version" value="3.0.0.0"/>
|
<add key="webpages:Version" value="3.0.0.0" />
|
||||||
<add key="webpages:Enabled" value="false"/>
|
<add key="webpages:Enabled" value="false" />
|
||||||
<add key="ClientValidationEnabled" value="true"/>
|
<add key="ClientValidationEnabled" value="true" />
|
||||||
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
|
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
|
||||||
<add key="WebPortal.ThemeProvider" value="WebsitePanel.Portal.WebPortalThemeProvider, WebsitePanel.Portal.Modules" />
|
<add key="WebPortal.ThemeProvider" value="WebsitePanel.Portal.WebPortalThemeProvider, WebsitePanel.Portal.Modules" />
|
||||||
<add key="WebPortal.PageTitleProvider" value="WebsitePanel.Portal.WebPortalPageTitleProvider, WebsitePanel.Portal.Modules" />
|
<add key="WebPortal.PageTitleProvider" value="WebsitePanel.Portal.WebPortalPageTitleProvider, WebsitePanel.Portal.Modules" />
|
||||||
<add key="ChartImageHandler" value="storage=file;timeout=20;" />
|
<add key="ChartImageHandler" value="storage=file;timeout=20;" />
|
||||||
<add key="SessionValidationKey" value="DAD46D476F85E0198BCA134D7AA5CC1D7" />
|
<add key="SessionValidationKey" value="DAD46D476F85E0198BCA134D7AA5CC1D7" />
|
||||||
|
|
||||||
<add key="WebsitePanel.CryptoKey" value="jj2n22t2kje035cg4l77" />
|
<add key="WebsitePanel.CryptoKey" value="jj2n22t2kje035cg4l77" />
|
||||||
<add key="WebsitePanel.EncryptionEnabled" value="true"/>
|
<add key="WebsitePanel.EncryptionEnabled" value="true" />
|
||||||
<add key="WebsitePanel.AltCryptoKey" value="CryptoKey"/>
|
<add key="WebsitePanel.AltCryptoKey" value="CryptoKey" />
|
||||||
</appSettings>
|
</appSettings>
|
||||||
<webDavExplorerConfigurationSettings>
|
<webDavExplorerConfigurationSettings>
|
||||||
<!--<userDomain value=""/>-->
|
<!--<userDomain value=""/>-->
|
||||||
<applicationName value="WebDAV Explorer"/>
|
<applicationName value="WebDAV Explorer" />
|
||||||
<elementsRendering defaultCount="20" addElementsCount="20"/>
|
<authTimeoutCookieName value=".auth-logout-timeout" />
|
||||||
|
<elementsRendering defaultCount="20" addElementsCount="20" elementsToIgnoreKey="web.config" />
|
||||||
<websitePanelConstantUser login="serveradmin" password="HtR7J8dtBhovYLigXNtVutxqpvaE48Z+FBIokWZlR/g=" />
|
<websitePanelConstantUser login="serveradmin" password="HtR7J8dtBhovYLigXNtVutxqpvaE48Z+FBIokWZlR/g=" />
|
||||||
<sessionKeys>
|
<sessionKeys>
|
||||||
<add key="AccountInfoSessionKey" value="AccountInfo"/>
|
<add key="AccountInfoSessionKey" value="AccountInfo" />
|
||||||
<add key="WebDavManagerSessionKey" value="WebDavManager"/>
|
<add key="WebDavManagerSessionKey" value="WebDavManager" />
|
||||||
<add key="ResourseRenderCountSessionKey" value="ResourseRenderCount"/>
|
<add key="ResourseRenderCountSessionKey" value="ResourseRenderCount" />
|
||||||
<add key="ItemIdSessionKey" value="ItemId"/>
|
<add key="ItemIdSessionKey" value="ItemId" />
|
||||||
</sessionKeys>
|
</sessionKeys>
|
||||||
<fileIcons defaultPath="~/Content/Images/other-icon.png">
|
<fileIcons defaultPath="~/Content/Images/other-icon.png">
|
||||||
<add extension=".txt" path="~/Content/Images/txt-icon.png"/>
|
<add extension=".txt" path="~/Content/Images/txt-icon.png" />
|
||||||
<add extension=".doc" path="~/Content/Images/word-icon.png"/>
|
<add extension=".doc" path="~/Content/Images/word-icon.png" />
|
||||||
<add extension=".docx" path="~/Content/Images/word-icon.png"/>
|
<add extension=".docx" path="~/Content/Images/word-icon.png" />
|
||||||
<add extension=".jpg" path="~/Content/Images/jpg-icon.png"/>
|
<add extension=".jpg" path="~/Content/Images/jpg-icon.png" />
|
||||||
<add extension=".jpeg" path="~/Content/Images/jpg-icon.png"/>
|
<add extension=".jpeg" path="~/Content/Images/jpg-icon.png" />
|
||||||
<add extension=".xls" path="~/Content/Images/excel-icon.png"/>
|
<add extension=".xls" path="~/Content/Images/excel-icon.png" />
|
||||||
<add extension=".xlsx" path="~/Content/Images/excel-icon.png"/>
|
<add extension=".xlsx" path="~/Content/Images/excel-icon.png" />
|
||||||
<add extension=".png" path="~/Content/Images/png-icon.png"/>
|
<add extension=".png" path="~/Content/Images/png-icon.png" />
|
||||||
</fileIcons>
|
</fileIcons>
|
||||||
<officeOnline isEnabled="True" url="https://vir-owa.virtuworks.net/op/view.aspx">
|
<officeOnline isEnabled="True" url="https://vir-owa.virtuworks.net/op/view.aspx">
|
||||||
<add extension=".doc"/>
|
<add extension=".doc" />
|
||||||
<add extension=".docx"/>
|
<add extension=".docx" />
|
||||||
<add extension=".xls"/>
|
<add extension=".xls" />
|
||||||
<add extension=".xlsx"/>
|
<add extension=".xlsx" />
|
||||||
<add extension=".ppt"/>
|
<add extension=".ppt" />
|
||||||
<add extension=".pptx"/>
|
<add extension=".pptx" />
|
||||||
</officeOnline>
|
</officeOnline>
|
||||||
</webDavExplorerConfigurationSettings>
|
</webDavExplorerConfigurationSettings>
|
||||||
<!--
|
<!--
|
||||||
|
@ -60,20 +76,10 @@
|
||||||
</system.Web>
|
</system.Web>
|
||||||
-->
|
-->
|
||||||
<system.web>
|
<system.web>
|
||||||
<compilation debug="true" targetFramework="4.5"/>
|
<compilation debug="true" targetFramework="4.5" />
|
||||||
<siteMap defaultProvider="WebsitePanelSiteMapProvider" enabled="true">
|
|
||||||
<providers>
|
|
||||||
<add name="WebsitePanelSiteMapProvider" type="WebsitePanel.WebPortal.WebsitePanelSiteMapProvider, WebsitePanel.WebPortal" securityTrimmingEnabled="true" />
|
|
||||||
</providers>
|
|
||||||
</siteMap>
|
|
||||||
<!-- Set default scheme -->
|
|
||||||
<pages theme="Default" validateRequest="false" controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
|
|
||||||
<controls>
|
|
||||||
<add tagPrefix="ajaxToolkit" namespace="AjaxControlToolkit" assembly="AjaxControlToolkit" />
|
|
||||||
</controls>
|
|
||||||
</pages>
|
|
||||||
<!-- Maximum size of uploaded file, in MB -->
|
<!-- Maximum size of uploaded file, in MB -->
|
||||||
<httpRuntime executionTimeout="1800" requestValidationMode="2.0" maxRequestLength="16384" enableVersionHeader="false" />
|
<httpRuntime executionTimeout="1800" requestValidationMode="2.0" requestPathInvalidCharacters="" maxRequestLength="16384" enableVersionHeader="false" />
|
||||||
|
<pages validateRequest="false" />
|
||||||
<!--
|
<!--
|
||||||
ASMX is mapped to a new handler so that proxy javascripts can also be served.
|
ASMX is mapped to a new handler so that proxy javascripts can also be served.
|
||||||
-->
|
-->
|
||||||
|
@ -84,7 +90,7 @@
|
||||||
<forms name=".WEBSITEPANELWEBDAVPORTALAUTHASPX" protection="All" timeout="30" path="/" requireSSL="false" slidingExpiration="true" cookieless="UseDeviceProfile" domain="" enableCrossAppRedirects="false"></forms>
|
<forms name=".WEBSITEPANELWEBDAVPORTALAUTHASPX" protection="All" timeout="30" path="/" requireSSL="false" slidingExpiration="true" cookieless="UseDeviceProfile" domain="" enableCrossAppRedirects="false"></forms>
|
||||||
</authentication>
|
</authentication>
|
||||||
<authorization>
|
<authorization>
|
||||||
<allow users="*" />
|
<allow users="?" />
|
||||||
</authorization>
|
</authorization>
|
||||||
<globalization culture="auto:en-US" uiCulture="auto:en" requestEncoding="UTF-8" responseEncoding="UTF-8"></globalization>
|
<globalization culture="auto:en-US" uiCulture="auto:en" requestEncoding="UTF-8" responseEncoding="UTF-8"></globalization>
|
||||||
</system.web>
|
</system.web>
|
||||||
|
@ -93,7 +99,7 @@
|
||||||
<handlers>
|
<handlers>
|
||||||
<remove name="UrlRoutingModule-4.0" />
|
<remove name="UrlRoutingModule-4.0" />
|
||||||
<add name="ChartImg" path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" resourceType="Unspecified" preCondition="integratedMode" />
|
<add name="ChartImg" path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" resourceType="Unspecified" preCondition="integratedMode" />
|
||||||
<add name="FileHandler" path="*.*" verb="GET" type="WebsitePanel.WebDavPortal.HttpHandlers.FileTransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0"/>
|
<add name="FileHandler" path="*.*" verb="GET" type="WebsitePanel.WebDavPortal.HttpHandlers.FileTransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
|
||||||
</handlers>
|
</handlers>
|
||||||
<modules>
|
<modules>
|
||||||
<add name="SecureSession" type="WebsitePanel.WebPortal.SecureSessionModule" />
|
<add name="SecureSession" type="WebsitePanel.WebPortal.SecureSessionModule" />
|
||||||
|
@ -102,32 +108,32 @@
|
||||||
<runtime>
|
<runtime>
|
||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35"/>
|
<assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
|
||||||
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0"/>
|
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35"/>
|
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930"/>
|
<bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" culture="neutral"/>
|
<assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2"/>
|
<bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/>
|
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
|
||||||
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
|
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/>
|
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
|
||||||
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
|
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
|
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
|
||||||
<bindingRedirect oldVersion="1.0.0.0-5.2.2.0" newVersion="5.2.2.0"/>
|
<bindingRedirect oldVersion="1.0.0.0-5.2.2.0" newVersion="5.2.2.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
|
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/>
|
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
</runtime>
|
</runtime>
|
||||||
|
|
|
@ -48,6 +48,9 @@
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll</HintPath>
|
<HintPath>..\packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="log4net">
|
||||||
|
<HintPath>..\packages\log4net.2.0.0\lib\net40-full\log4net.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<Reference Include="Microsoft.Web.Services3">
|
<Reference Include="Microsoft.Web.Services3">
|
||||||
<HintPath>..\..\Lib\Microsoft.Web.Services3.dll</HintPath>
|
<HintPath>..\..\Lib\Microsoft.Web.Services3.dll</HintPath>
|
||||||
|
@ -134,33 +137,18 @@
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<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\BundleConfig.cs" />
|
||||||
<Compile Include="App_Start\FilterConfig.cs" />
|
<Compile Include="App_Start\FilterConfig.cs" />
|
||||||
<Compile Include="App_Start\RouteConfig.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="Constraints\OrganizationRouteConstraint.cs" />
|
||||||
<Compile Include="Controllers\AccountController.cs" />
|
<Compile Include="Controllers\AccountController.cs" />
|
||||||
<Compile Include="Controllers\ErrorController.cs" />
|
<Compile Include="Controllers\ErrorController.cs" />
|
||||||
<Compile Include="Controllers\FileSystemController.cs" />
|
<Compile Include="Controllers\FileSystemController.cs" />
|
||||||
<Compile Include="Cryptography\CryptoUtils.cs" />
|
|
||||||
<Compile Include="Cryptography\ICryptography.cs" />
|
|
||||||
<Compile Include="CustomAttributes\LdapAuthorizationAttribute.cs" />
|
<Compile Include="CustomAttributes\LdapAuthorizationAttribute.cs" />
|
||||||
<Compile Include="DependencyInjection\AccountInfoProvider.cs" />
|
<Compile Include="DependencyInjection\NinjectDependecyResolver.cs" />
|
||||||
<Compile Include="DependencyInjection\WebDavExplorerAppModule.cs" />
|
<Compile Include="DependencyInjection\PortalDependencies.cs" />
|
||||||
<Compile Include="DependencyInjection\WebDavManagerProvider.cs" />
|
<Compile Include="DependencyInjection\Providers\HttpSessionStateProvider.cs" />
|
||||||
|
<Compile Include="DependencyInjection\Providers\WebDavManagerProvider.cs" />
|
||||||
<Compile Include="Exceptions\ConnectToWebDavServerException.cs" />
|
<Compile Include="Exceptions\ConnectToWebDavServerException.cs" />
|
||||||
<Compile Include="Exceptions\ResourceNotFoundException.cs" />
|
<Compile Include="Exceptions\ResourceNotFoundException.cs" />
|
||||||
<Compile Include="Extensions\DictionaryExtensions.cs" />
|
<Compile Include="Extensions\DictionaryExtensions.cs" />
|
||||||
|
@ -179,17 +167,8 @@
|
||||||
<Compile Include="Models\OfficeOnlineModel.cs" />
|
<Compile Include="Models\OfficeOnlineModel.cs" />
|
||||||
<Compile Include="Models\WebDavManager.cs" />
|
<Compile Include="Models\WebDavManager.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="WebConfigSections\ApplicationNameElement.cs" />
|
<Compile Include="UI\Routes\AccountRouteNames.cs" />
|
||||||
<Compile Include="WebConfigSections\ElementsRenderingElement.cs" />
|
<Compile Include="UI\Routes\FileSystemRouteNames.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>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Content\bootstrap-theme.css" />
|
<Content Include="Content\bootstrap-theme.css" />
|
||||||
|
@ -241,6 +220,7 @@
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Content>
|
</Content>
|
||||||
<None Include="Scripts\jquery-2.1.1.intellisense.js" />
|
<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\recalculateResourseHeight.js" />
|
||||||
<Content Include="Scripts\appScripts\uploadingData2.js" />
|
<Content Include="Scripts\appScripts\uploadingData2.js" />
|
||||||
<Content Include="Scripts\bootstrap.js" />
|
<Content Include="Scripts\bootstrap.js" />
|
||||||
|
@ -249,6 +229,7 @@
|
||||||
<Content Include="Scripts\jquery-2.1.1.min.js" />
|
<Content Include="Scripts\jquery-2.1.1.min.js" />
|
||||||
<Content Include="Scripts\jquery-2.1.1.min.map" />
|
<Content Include="Scripts\jquery-2.1.1.min.map" />
|
||||||
<None Include="Scripts\jquery.validate-vsdoc.js" />
|
<None Include="Scripts\jquery.validate-vsdoc.js" />
|
||||||
|
<Content Include="Scripts\jquery.cookie.js" />
|
||||||
<Content Include="Scripts\jquery.validate.js" />
|
<Content Include="Scripts\jquery.validate.js" />
|
||||||
<Content Include="Scripts\jquery.validate.min.js" />
|
<Content Include="Scripts\jquery.validate.min.js" />
|
||||||
<Content Include="Scripts\jquery.validate.unobtrusive.js" />
|
<Content Include="Scripts\jquery.validate.unobtrusive.js" />
|
||||||
|
@ -285,21 +266,11 @@
|
||||||
<Content Include="packages.config" />
|
<Content Include="packages.config" />
|
||||||
<None Include="Project_Readme.html" />
|
<None Include="Project_Readme.html" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<Content Include="App_GlobalResources\Resource.errors.resx">
|
|
||||||
<Generator>GlobalResourceProxyGenerator</Generator>
|
|
||||||
<LastGenOutput>Resource.errors.designer.cs</LastGenOutput>
|
|
||||||
</Content>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\WebsitePanel.WebDav.Core\WebsitePanel.WebDav.Core.csproj">
|
<ProjectReference Include="..\WebsitePanel.WebDav.Core\WebsitePanel.WebDav.Core.csproj">
|
||||||
<Project>{BA147805-9EF1-45F2-BF32-A5825D4E950D}</Project>
|
<Project>{BA147805-9EF1-45F2-BF32-A5825D4E950D}</Project>
|
||||||
<Name>WebsitePanel.WebDav.Core</Name>
|
<Name>WebsitePanel.WebDav.Core</Name>
|
||||||
</ProjectReference>
|
</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>
|
</ItemGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||||
|
|
|
@ -3,7 +3,9 @@
|
||||||
<package id="Antlr" version="3.5.0.2" targetFramework="net45" />
|
<package id="Antlr" version="3.5.0.2" targetFramework="net45" />
|
||||||
<package id="bootstrap" version="3.3.0" targetFramework="net45" />
|
<package id="bootstrap" version="3.3.0" targetFramework="net45" />
|
||||||
<package id="jQuery" version="2.1.1" 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="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" />
|
<package id="Microsoft.AspNet.Mvc" version="5.2.2" targetFramework="net45" />
|
||||||
<package id="Microsoft.AspNet.Razor" version="3.2.2" targetFramework="net45" />
|
<package id="Microsoft.AspNet.Razor" version="3.2.2" targetFramework="net45" />
|
||||||
<package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net45" />
|
<package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net45" />
|
||||||
|
|
|
@ -5626,4 +5626,7 @@
|
||||||
<data name="ERROR.IDNDOMAIN_NO_ORGANIZATION" xml:space="preserve">
|
<data name="ERROR.IDNDOMAIN_NO_ORGANIZATION" xml:space="preserve">
|
||||||
<value>You cannot use a IDN domain name for organizations</value>
|
<value>You cannot use a IDN domain name for organizations</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="ERROR.RDSCOLLECTION_NOT_CREATED" xml:space="preserve">
|
||||||
|
<value>Collection not created</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -71,9 +71,9 @@ namespace WebsitePanel.Portal
|
||||||
return rdsServers.Servers;
|
return rdsServers.Servers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RdsServer[] GetFreeRDSServers()
|
public RdsServer[] GetFreeRDSServers(int packageId)
|
||||||
{
|
{
|
||||||
return ES.Services.RDS.GetFreeRdsServersPaged("", "", "", 0, 1000).Servers;
|
return ES.Services.RDS.GetFreeRdsServersPaged(packageId, "", "", "", 0, 1000).Servers;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace WebsitePanel.Portal.RDS
|
||||||
|
|
||||||
private void BindRDSServers()
|
private void BindRDSServers()
|
||||||
{
|
{
|
||||||
ddlServers.DataSource = new RDSHelper().GetFreeRDSServers();
|
ddlServers.DataSource = new RDSHelper().GetFreeRDSServers(PanelRequest.ItemID);
|
||||||
ddlServers.DataTextField = "Name";
|
ddlServers.DataTextField = "Name";
|
||||||
ddlServers.DataValueField = "Id";
|
ddlServers.DataValueField = "Id";
|
||||||
ddlServers.DataBind();
|
ddlServers.DataBind();
|
||||||
|
|
|
@ -50,7 +50,9 @@ namespace WebsitePanel.Portal.RDS
|
||||||
protected void btnSave_Click(object sender, EventArgs e)
|
protected void btnSave_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (!Page.IsValid)
|
if (!Page.IsValid)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -59,14 +61,15 @@ namespace WebsitePanel.Portal.RDS
|
||||||
messageBox.ShowErrorMessage("RDS_CREATE_COLLECTION_RDSSERVER_REQUAIRED");
|
messageBox.ShowErrorMessage("RDS_CREATE_COLLECTION_RDSSERVER_REQUAIRED");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RdsCollection collection = new RdsCollection{ Name = txtCollectionName.Text, Servers = servers.GetServers(), Description = "" };
|
RdsCollection collection = new RdsCollection{ Name = txtCollectionName.Text, Servers = servers.GetServers(), Description = "" };
|
||||||
|
|
||||||
ES.Services.RDS.AddRdsCollection(PanelRequest.ItemID, collection);
|
ES.Services.RDS.AddRdsCollection(PanelRequest.ItemID, collection);
|
||||||
|
Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), "rds_collections", "SpaceID=" + PanelSecurity.PackageId));
|
||||||
Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), "rds_collections",
|
}
|
||||||
"SpaceID=" + PanelSecurity.PackageId));
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
messageBox.ShowErrorMessage("RDSCOLLECTION_NOT_CREATED", ex);
|
||||||
}
|
}
|
||||||
catch { }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue