remove waste asc.common

This commit is contained in:
Anton Suhorukov 2022-09-01 11:16:46 +03:00
parent 118ba04fae
commit cdad8da572
10 changed files with 0 additions and 798 deletions

View File

@ -1,48 +0,0 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Common.Data;
public static class StreamExtension
{
public const int BufferSize = 2048; //NOTE: set to 2048 to fit in minimum tcp window
public static void StreamCopyTo(this Stream srcStream, Stream dstStream, int length)
{
ArgumentNullException.ThrowIfNull(srcStream);
ArgumentNullException.ThrowIfNull(dstStream);
var buffer = new byte[BufferSize];
var totalRead = 0;
int readed;
while ((readed = srcStream.Read(buffer, 0, length - totalRead > BufferSize ? BufferSize : length - totalRead)) > 0 && totalRead < length)
{
dstStream.Write(buffer, 0, readed);
totalRead += readed;
}
}
}

View File

@ -44,14 +44,10 @@ global using System.Web;
global using System.Xml.Linq;
global using System.Xml.XPath;
global using ARSoft.Tools.Net;
global using ARSoft.Tools.Net.Dns;
global using ASC.Common;
global using ASC.Common.Caching;
global using ASC.Common.DependencyInjection;
global using ASC.Common.Log;
global using ASC.Common.Mapping.PrimitiveTypeConverters;
global using ASC.Common.Security;
global using ASC.Common.Security.Authorizing;
global using ASC.Common.Threading;
@ -72,8 +68,6 @@ global using JWT;
global using JWT.Algorithms;
global using JWT.Serializers;
global using log4net.Util;
global using Microsoft.AspNetCore.Cryptography.KeyDerivation;
global using Microsoft.AspNetCore.Http;
global using Microsoft.AspNetCore.Http.Extensions;

View File

@ -1,97 +0,0 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Common.Logging;
public class SpecialFolderPathConverter : PatternConverter
{
protected override void Convert(TextWriter writer, object state)
{
if (string.IsNullOrEmpty(Option))
{
return;
}
try
{
var result = string.Empty;
const string CMD_LINE = "CommandLine:";
if (Option.StartsWith(CMD_LINE))
{
var args = Environment.CommandLine.Split(' ');
for (var i = 0; i < args.Length - 1; i++)
{
if (args[i].Contains(Option, StringComparison.InvariantCultureIgnoreCase))
{
result = args[i + 1];
}
}
}
else
{
var repo = log4net.LogManager.GetRepository(Assembly.GetCallingAssembly());
if (repo != null)
{
var realKey = Option;
foreach (var key in repo.Properties.GetKeys())
{
if (Path.DirectorySeparatorChar == '/' && key == "UNIX:" + Option)
{
realKey = "UNIX:" + Option;
}
if (Path.DirectorySeparatorChar == '\\' && key == "WINDOWS:" + Option)
{
realKey = "WINDOWS:" + Option;
}
}
var val = repo.Properties[realKey];
if (val is PatternString patternString)
{
patternString.ActivateOptions();
patternString.Format(writer);
}
else if (val != null)
{
result = val.ToString();
}
}
}
if (!string.IsNullOrEmpty(result))
{
result = result.Replace('/', Path.DirectorySeparatorChar).Replace('\\', Path.DirectorySeparatorChar);
writer.Write(result);
}
}
catch (Exception err)
{
LogLog.Error(GetType(), "Can not convert " + Option, err);
}
}
}

View File

@ -1,91 +0,0 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Common.Mapping;
public class DefaultMappingProfile : Profile
{
public DefaultMappingProfile()
{
Array.ForEach(AppDomain.CurrentDomain.GetAssemblies(), a => ApplyMappingsFromAssembly(a));
ApplyPrimitiveMappers();
}
private void ApplyMappingsFromAssembly(Assembly assembly)
{
if (!assembly.GetName().Name.StartsWith("ASC."))
{
return;
}
var mapFromType = typeof(IMapFrom<>);
var mappingMethodName = nameof(IMapFrom<object>.Mapping);
bool HasInterface(Type t) => t.IsGenericType && t.GetGenericTypeDefinition() == mapFromType;
var types = assembly.GetExportedTypes().Where(t => t.GetInterfaces().Any(HasInterface)).ToList();
var argumentTypes = new Type[] { typeof(Profile) };
foreach (var type in types)
{
if (type.ContainsGenericParameters)
{
throw new Exception("Denied for using type with generic parameters.");
}
var instance = Activator.CreateInstance(type);
var methodInfo = type.GetMethod(mappingMethodName);
if (methodInfo != null)
{
methodInfo.Invoke(instance, new object[] { this });
}
else
{
var interfaces = type.GetInterfaces().Where(HasInterface).ToList();
if (interfaces.Count > 0)
{
foreach (var @interface in interfaces)
{
var interfaceMethodInfo = @interface.GetMethod(mappingMethodName, argumentTypes);
interfaceMethodInfo?.Invoke(instance, new object[] { this });
}
}
}
}
}
private void ApplyPrimitiveMappers()
{
CreateMap<long, DateTime>().ReverseMap()
.ConvertUsing<TimeConverter>();
}
}

View File

@ -1,34 +0,0 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Common.Module;
public interface IServiceController
{
void Start();
void Stop();
}

View File

@ -1,54 +0,0 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Common.Security;
[DebuggerDisplay("ObjectType: {ObjectType.Name}, SecurityId: {SecurityId}")]
public class SecurityObjectId : ISecurityObjectId
{
public object SecurityId { get; private set; }
public Type ObjectType { get; private set; }
public string FullId => AzObjectIdHelper.GetFullObjectId(this);
public SecurityObjectId(object id, Type objType)
{
ArgumentNullException.ThrowIfNull(objType);
SecurityId = id;
ObjectType = objType;
}
public override int GetHashCode()
{
return AzObjectIdHelper.GetFullObjectId(this).GetHashCode();
}
public override bool Equals(object obj)
{
return obj is SecurityObjectId other &&
Equals(AzObjectIdHelper.GetFullObjectId(other), AzObjectIdHelper.GetFullObjectId(this));
}
}

View File

@ -1,237 +0,0 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Common.Utils;
public class DnsLookup
{
private readonly IDnsResolver _sDnsResolver;
private readonly DnsClient _dnsClient;
public DnsLookup()
{
_dnsClient = DnsClient.Default;
_sDnsResolver = new DnsStubResolver(_dnsClient);
}
/// <summary>
/// Get domain MX records
/// </summary>
/// <param name="domainName">domain name</param>
/// <exception cref="ArgumentNullException">if domainName is empty</exception>
/// <exception cref="ArgumentException">if domainName is invalid</exception>
/// <returns>list of MxRecord</returns>
public List<MxRecord> GetDomainMxRecords(string domainName)
{
ArgumentNullOrEmptyException.ThrowIfNullOrEmpty(domainName);
var mxRecords = DnsResolve<MxRecord>(domainName, RecordType.Mx);
return mxRecords;
}
/// <summary>
/// Check existance of MX record in domain DNS
/// </summary>
/// <param name="domainName">domain name</param>
/// <param name="mxRecord">MX record value</param>
/// <exception cref="ArgumentNullException">if domainName is empty</exception>
/// <exception cref="ArgumentException">if domainName is invalid</exception>
/// <returns>true if exists and vice versa</returns>
public bool IsDomainMxRecordExists(string domainName, string mxRecord)
{
ArgumentNullOrEmptyException.ThrowIfNullOrEmpty(domainName);
ArgumentNullOrEmptyException.ThrowIfNullOrEmpty(mxRecord);
var mxDomain = DomainName.Parse(mxRecord);
var records = GetDomainMxRecords(domainName);
return records.Any(
mx => mx.ExchangeDomainName.Equals(mxDomain));
}
/// <summary>
/// Check domain existance
/// </summary>
/// <param name="domainName"></param>
/// <exception cref="ArgumentNullException">if domainName is empty</exception>
/// <exception cref="ArgumentException">if domainName is invalid</exception>
/// <exception cref="SystemException">if DNS request failed</exception>
/// <returns>true if any DNS record exists and vice versa</returns>
public bool IsDomainExists(string domainName)
{
ArgumentNullOrEmptyException.ThrowIfNullOrEmpty(domainName);
var dnsMessage = GetDnsMessage(domainName);
return dnsMessage.AnswerRecords.Count != 0;
}
/// <summary>
/// Get domain A records
/// </summary>
/// <param name="domainName">domain name</param>
/// <exception cref="ArgumentNullException">if domainName is empty</exception>
/// <exception cref="ArgumentException">if domainName is invalid</exception>
/// <returns>list of ARecord</returns>
public List<ARecord> GetDomainARecords(string domainName)
{
ArgumentNullOrEmptyException.ThrowIfNullOrEmpty(domainName);
var aRecords = DnsResolve<ARecord>(domainName, RecordType.A);
return aRecords;
}
/// <summary>
/// Get domain IP addresses list
/// </summary>
/// <param name="domainName">domain name</param>
/// <exception cref="ArgumentNullException">if domainName is empty</exception>
/// <exception cref="ArgumentException">if domainName is invalid</exception>
/// <returns>list of IPAddress</returns>
public List<IPAddress> GetDomainIPs(string domainName)
{
ArgumentNullOrEmptyException.ThrowIfNullOrEmpty(domainName);
var addresses = _sDnsResolver.ResolveHost(domainName);
return addresses;
}
/// <summary>
/// Get domain TXT records
/// </summary>
/// <param name="domainName">domain name</param>
/// <exception cref="ArgumentNullException">if domainName is empty</exception>
/// <exception cref="ArgumentException">if domainName is invalid</exception>
/// <returns>list of TxtRecord</returns>
public List<TxtRecord> GetDomainTxtRecords(string domainName)
{
ArgumentNullOrEmptyException.ThrowIfNullOrEmpty(domainName);
var txtRecords = DnsResolve<TxtRecord>(domainName, RecordType.Txt);
return txtRecords;
}
/// <summary>
/// Check existance of TXT record in domain DNS
/// </summary>
/// <param name="domainName">domain name</param>
/// <param name="recordValue">TXT record value</param>
/// <exception cref="ArgumentNullException">if domainName is empty</exception>
/// <exception cref="ArgumentException">if domainName is invalid</exception>
/// <returns>true if exists and vice versa</returns>
public bool IsDomainTxtRecordExists(string domainName, string recordValue)
{
var txtRecords = GetDomainTxtRecords(domainName);
return
txtRecords.Any(
txtRecord =>
txtRecord.TextData.Trim('\"').Equals(recordValue, StringComparison.InvariantCultureIgnoreCase));
}
/// <summary>
/// Check existance of DKIM record in domain DNS
/// </summary>
/// <param name="domainName">domain name</param>
/// <param name="dkimSelector">DKIM selector (example is "dkim")</param>
/// <param name="dkimValue">DKIM record value</param>
/// <exception cref="ArgumentNullException">if domainName is empty</exception>
/// <exception cref="ArgumentException">if domainName is invalid</exception>
/// <returns>true if exists and vice versa</returns>
public bool IsDomainDkimRecordExists(string domainName, string dkimSelector, string dkimValue)
{
var dkimRecordName = dkimSelector + "._domainkey." + domainName;
var txtRecords = GetDomainTxtRecords(dkimRecordName);
return txtRecords.Any(txtRecord => txtRecord.TextData.Trim('\"').Equals(dkimValue));
}
/// <summary>
/// Check existance Domain in PTR record
/// </summary>
/// <param name="ipAddress">IP address for PTR check</param>
/// <param name="domainName">PTR domain name</param>
/// <exception cref="ArgumentNullException">if domainName or ipAddress is empty/null</exception>
/// <exception cref="ArgumentException">if domainName is invalid</exception>
/// <returns>true if exists and vice versa</returns>
public bool IsDomainPtrRecordExists(IPAddress ipAddress, string domainName)
{
ArgumentNullOrEmptyException.ThrowIfNullOrEmpty(domainName);
ArgumentNullException.ThrowIfNull(ipAddress);
var domain = DomainName.Parse(domainName);
var ptrDomain = _sDnsResolver.ResolvePtr(ipAddress);
return ptrDomain.Equals(domain);
}
/// <summary>
/// Check existance Domain in PTR record
/// </summary>
/// <param name="ipAddress">IP address for PTR check</param>
/// <param name="domainName">PTR domain name</param>
/// <exception cref="ArgumentNullException">if domainName or ipAddress is empty/null</exception>
/// <exception cref="ArgumentException">if domainName is invalid</exception>
/// <exception cref="FormatException">if ipAddress is invalid</exception>
/// <returns>true if exists and vice versa</returns>
public bool IsDomainPtrRecordExists(string ipAddress, string domainName)
{
return IsDomainPtrRecordExists(IPAddress.Parse(ipAddress), domainName);
}
private DnsMessage GetDnsMessage(string domainName, RecordType? type = null)
{
ArgumentNullOrEmptyException.ThrowIfNullOrEmpty(domainName);
var domain = DomainName.Parse(domainName);
var dnsMessage = type.HasValue ? _dnsClient.Resolve(domain, type.Value) : _dnsClient.Resolve(domain);
if ((dnsMessage == null) ||
((dnsMessage.ReturnCode != ReturnCode.NoError) && (dnsMessage.ReturnCode != ReturnCode.NxDomain)))
{
throw new SystemException(); // DNS request failed
}
return dnsMessage;
}
private List<T> DnsResolve<T>(string domainName, RecordType type)
{
ArgumentNullOrEmptyException.ThrowIfNullOrEmpty(domainName);
var dnsMessage = GetDnsMessage(domainName, type);
return dnsMessage.AnswerRecords.Where(r => r.RecordType == type).Cast<T>().ToList();
}
}

View File

@ -1,120 +0,0 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Common.Utils;
public static class Wildcard
{
public static bool WildcardMatch(this string input, string pattern)
{
return WildcardMatch(input, pattern, true);
}
public static bool WildcardMatch(this string input, string pattern, bool ignoreCase)
{
if (!string.IsNullOrEmpty(input))
{
return IsMatch(pattern, input, ignoreCase);
}
return false;
}
public static bool IsMatch(string pattern, string input)
{
return IsMatch(pattern, input, true);
}
public static bool IsMatch(string pattern, string input, bool ignoreCase)
{
var offsetInput = 0;
var isAsterix = false;
var i = 0;
while (i < pattern.Length)
{
switch (pattern[i])
{
case '?':
isAsterix = false;
offsetInput++;
break;
case '*':
isAsterix = true;
while (i < pattern.Length &&
pattern[i] == '*')
{
i++;
}
if (i >= pattern.Length)
{
return true;
}
continue;
default:
if (offsetInput >= input.Length)
{
return false;
}
if ((ignoreCase
? char.ToLower(input[offsetInput])
: input[offsetInput])
!=
(ignoreCase
? char.ToLower(pattern[i])
: pattern[i]))
{
if (!isAsterix)
{
return false;
}
offsetInput++;
continue;
}
offsetInput++;
break;
}
i++;
}
if (i > input.Length)
{
return false;
}
while (i < pattern.Length && pattern[i] == '*')
{
++i;
}
return offsetInput == input.Length;
}
}

View File

@ -1,61 +0,0 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Common.Web;
public abstract class AbstractHttpAsyncHandler // : IHttpAsyncHandler, IReadOnlySessionState
{
public bool IsReusable => false;
private Action<HttpContext> _processRequest;
private IPrincipal _principal;
private CultureInfo _culture;
public void ProcessRequest(HttpContext context)
{
Thread.CurrentThread.CurrentCulture = _culture;
Thread.CurrentThread.CurrentUICulture = _culture;
Thread.CurrentPrincipal = _principal;
//HttpContext.Current = context;
OnProcessRequest(context);
}
public IAsyncResult BeginProcessRequest(HttpContext context, AsyncCallback cb, object extraData)
{
_culture = Thread.CurrentThread.CurrentCulture;
_principal = Thread.CurrentPrincipal;
_processRequest = ProcessRequest;
return _processRequest.BeginInvoke(context, cb, extraData);
}
public void EndProcessRequest(IAsyncResult result)
{
_processRequest.EndInvoke(result);
}
public abstract void OnProcessRequest(HttpContext context);
}

View File

@ -1,50 +0,0 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Common.Web;
public class RouteCallInfo
{
public int? Tid { get; set; }
public string Url { get; set; }
public string AttachmentUrl { get; set; }
public bool IsNewRequest { get; set; }
public string Method { get; set; }
public Dictionary<string, object> Params { get; set; }
public bool CleanupHtml { get; set; }
public RouteCallInfo()
{
CleanupHtml = true; //Default
}
public override string ToString()
{
return string.Format("{0} {1} T:{2},{3}", Method.ToUpper(), Url, Tid,
string.Join(",",
Params.Select(x => string.Format("{0}={1}", x.Key, x.Value)).ToArray()));
}
}