Merge branch 'develop' into feature/fix-hide/show-header
This commit is contained in:
commit
8f47fe938c
@ -4,7 +4,6 @@ using ASC.Api.Core.Auth;
|
|||||||
using ASC.Api.Core.Core;
|
using ASC.Api.Core.Core;
|
||||||
using ASC.Api.Core.Middleware;
|
using ASC.Api.Core.Middleware;
|
||||||
using ASC.Common;
|
using ASC.Common;
|
||||||
using ASC.Common.DependencyInjection;
|
|
||||||
using ASC.Common.Logging;
|
using ASC.Common.Logging;
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Authentication;
|
using Microsoft.AspNetCore.Authentication;
|
||||||
@ -100,8 +99,6 @@ namespace ASC.Api.Core
|
|||||||
{
|
{
|
||||||
DIHelper.AddNLogManager(LogParams);
|
DIHelper.AddNLogManager(LogParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
services.AddAutofac(Configuration, HostEnvironment.ContentRootPath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
public virtual void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||||
|
@ -28,9 +28,9 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ARSoft.Tools.NetStandard.DXSdata" Version="1.0.0" />
|
<PackageReference Include="ARSoft.Tools.NetStandard.DXSdata" Version="1.0.0" />
|
||||||
<PackageReference Include="Autofac" Version="5.2.0" />
|
<PackageReference Include="Autofac" Version="6.0.0" />
|
||||||
<PackageReference Include="Autofac.Configuration" Version="5.1.0" />
|
<PackageReference Include="Autofac.Configuration" Version="6.0.0" />
|
||||||
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="6.0.0" />
|
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.1.0" />
|
||||||
<PackageReference Include="Confluent.Kafka" Version="1.4.3" />
|
<PackageReference Include="Confluent.Kafka" Version="1.4.3" />
|
||||||
<PackageReference Include="Google.Protobuf" Version="3.13.0" />
|
<PackageReference Include="Google.Protobuf" Version="3.13.0" />
|
||||||
<PackageReference Include="Grpc" Version="2.32.0" />
|
<PackageReference Include="Grpc" Version="2.32.0" />
|
||||||
|
@ -6,11 +6,8 @@ using System.Runtime.Loader;
|
|||||||
|
|
||||||
using Autofac;
|
using Autofac;
|
||||||
using Autofac.Configuration;
|
using Autofac.Configuration;
|
||||||
using Autofac.Extensions.DependencyInjection;
|
|
||||||
|
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
|
||||||
|
|
||||||
namespace ASC.Common.DependencyInjection
|
namespace ASC.Common.DependencyInjection
|
||||||
{
|
{
|
||||||
@ -26,7 +23,7 @@ namespace ASC.Common.DependencyInjection
|
|||||||
|
|
||||||
public static class AutofacExtension
|
public static class AutofacExtension
|
||||||
{
|
{
|
||||||
public static IContainer AddAutofac(this IServiceCollection services, IConfiguration configuration, string currentDir, bool loadproducts = true, bool loadconsumers = true, params string[] intern)
|
public static void Register(this ContainerBuilder builder, IConfiguration configuration, string currentDir, bool loadproducts = true, bool loadconsumers = true, params string[] intern)
|
||||||
{
|
{
|
||||||
var folder = configuration["core:products:folder"];
|
var folder = configuration["core:products:folder"];
|
||||||
var subfolder = configuration["core:products:subfolder"];
|
var subfolder = configuration["core:products:subfolder"];
|
||||||
@ -48,7 +45,6 @@ namespace ASC.Common.DependencyInjection
|
|||||||
productsDir = folder;
|
productsDir = folder;
|
||||||
}
|
}
|
||||||
|
|
||||||
var builder = new ContainerBuilder();
|
|
||||||
var modules = new List<(bool, string)>
|
var modules = new List<(bool, string)>
|
||||||
{
|
{
|
||||||
(true, "autofac.json")
|
(true, "autofac.json")
|
||||||
@ -88,13 +84,7 @@ namespace ASC.Common.DependencyInjection
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.Populate(services);
|
return;
|
||||||
|
|
||||||
var container = builder.Build();
|
|
||||||
|
|
||||||
services.TryAddSingleton(container);
|
|
||||||
|
|
||||||
return container;
|
|
||||||
|
|
||||||
void FindAndLoad(IConfigurationSection sectionSettings)
|
void FindAndLoad(IConfigurationSection sectionSettings)
|
||||||
{
|
{
|
||||||
|
@ -53,5 +53,10 @@ namespace ASC.Core.Tenants
|
|||||||
AuditTrailLifeTime = MaxLifeTime
|
AuditTrailLifeTime = MaxLifeTime
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TenantAuditSettingsWrapper
|
||||||
|
{
|
||||||
|
public TenantAuditSettings settings{ get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -29,6 +29,7 @@ using System.Globalization;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Security.Authentication;
|
using System.Security.Authentication;
|
||||||
|
using System.Security.Claims;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.Encodings.Web;
|
using System.Text.Encodings.Web;
|
||||||
@ -36,10 +37,12 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
using ASC.Common;
|
using ASC.Common;
|
||||||
using ASC.Common.Logging;
|
using ASC.Common.Logging;
|
||||||
|
using ASC.Core.Common.Security;
|
||||||
using ASC.Security.Cryptography;
|
using ASC.Security.Cryptography;
|
||||||
using ASC.Web.Core.Helpers;
|
using ASC.Web.Core.Helpers;
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Authentication;
|
using Microsoft.AspNetCore.Authentication;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.WebUtilities;
|
using Microsoft.AspNetCore.WebUtilities;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
@ -61,7 +64,8 @@ namespace ASC.ApiSystem.Classes
|
|||||||
IConfiguration configuration,
|
IConfiguration configuration,
|
||||||
IOptionsMonitor<ILog> option,
|
IOptionsMonitor<ILog> option,
|
||||||
ApiSystemHelper apiSystemHelper,
|
ApiSystemHelper apiSystemHelper,
|
||||||
MachinePseudoKeys machinePseudoKeys) :
|
MachinePseudoKeys machinePseudoKeys,
|
||||||
|
IHttpContextAccessor httpContextAccessor) :
|
||||||
base(options, logger, encoder, clock)
|
base(options, logger, encoder, clock)
|
||||||
{
|
{
|
||||||
Configuration = configuration;
|
Configuration = configuration;
|
||||||
@ -70,6 +74,7 @@ namespace ASC.ApiSystem.Classes
|
|||||||
|
|
||||||
ApiSystemHelper = apiSystemHelper;
|
ApiSystemHelper = apiSystemHelper;
|
||||||
MachinePseudoKeys = machinePseudoKeys;
|
MachinePseudoKeys = machinePseudoKeys;
|
||||||
|
HttpContextAccessor = httpContextAccessor;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ILog Log { get; }
|
private ILog Log { get; }
|
||||||
@ -78,6 +83,7 @@ namespace ASC.ApiSystem.Classes
|
|||||||
|
|
||||||
private ApiSystemHelper ApiSystemHelper { get; }
|
private ApiSystemHelper ApiSystemHelper { get; }
|
||||||
private MachinePseudoKeys MachinePseudoKeys { get; }
|
private MachinePseudoKeys MachinePseudoKeys { get; }
|
||||||
|
private IHttpContextAccessor HttpContextAccessor { get; }
|
||||||
|
|
||||||
protected override Task<AuthenticateResult> HandleAuthenticateAsync()
|
protected override Task<AuthenticateResult> HandleAuthenticateAsync()
|
||||||
{
|
{
|
||||||
@ -103,7 +109,7 @@ namespace ASC.ApiSystem.Classes
|
|||||||
|
|
||||||
var substring = "ASC";
|
var substring = "ASC";
|
||||||
|
|
||||||
if (!header.StartsWith(substring, StringComparison.InvariantCultureIgnoreCase))
|
if (header.StartsWith(substring, StringComparison.InvariantCultureIgnoreCase))
|
||||||
{
|
{
|
||||||
var splitted = header.Substring(substring.Length).Trim().Split(':', StringSplitOptions.RemoveEmptyEntries);
|
var splitted = header.Substring(substring.Length).Trim().Split(':', StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
|
||||||
@ -159,9 +165,10 @@ namespace ASC.ApiSystem.Classes
|
|||||||
|
|
||||||
return Task.FromResult(AuthenticateResult.Fail(new AuthenticationException(HttpStatusCode.InternalServerError.ToString())));
|
return Task.FromResult(AuthenticateResult.Fail(new AuthenticationException(HttpStatusCode.InternalServerError.ToString())));
|
||||||
}
|
}
|
||||||
|
var identity = new ClaimsIdentity( Scheme.Name);
|
||||||
|
|
||||||
Log.InfoFormat("Auth success {0}", Scheme.Name);
|
Log.InfoFormat("Auth success {0}", Scheme.Name);
|
||||||
|
if (HttpContextAccessor?.HttpContext != null) HttpContextAccessor.HttpContext.User = new CustomClaimsPrincipal(new ClaimsIdentity(Scheme.Name), identity);
|
||||||
return Task.FromResult(AuthenticateResult.Success(new AuthenticationTicket(Context.User, new AuthenticationProperties(), Scheme.Name)));
|
return Task.FromResult(AuthenticateResult.Success(new AuthenticationTicket(Context.User, new AuthenticationProperties(), Scheme.Name)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ namespace ASC.ApiSystem.Models
|
|||||||
[StringLength(255)]
|
[StringLength(255)]
|
||||||
public string FirstName { get; set; }
|
public string FirstName { get; set; }
|
||||||
|
|
||||||
[Email]
|
//todo [Email]
|
||||||
[StringLength(255)]
|
[StringLength(255)]
|
||||||
public string Email { get; set; }
|
public string Email { get; set; }
|
||||||
|
|
||||||
|
@ -25,7 +25,9 @@
|
|||||||
|
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
|
using Autofac.Extensions.DependencyInjection;
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
@ -43,6 +45,7 @@ namespace ASC.ApiSystem
|
|||||||
public static IHostBuilder CreateHostBuilder(string[] args)
|
public static IHostBuilder CreateHostBuilder(string[] args)
|
||||||
{
|
{
|
||||||
return Host.CreateDefaultBuilder(args)
|
return Host.CreateDefaultBuilder(args)
|
||||||
|
.UseServiceProviderFactory(new AutofacServiceProviderFactory())
|
||||||
.ConfigureWebHostDefaults(webBuilder =>
|
.ConfigureWebHostDefaults(webBuilder =>
|
||||||
{
|
{
|
||||||
webBuilder.UseStartup<Startup>();
|
webBuilder.UseStartup<Startup>();
|
||||||
|
@ -28,7 +28,9 @@ using ASC.ApiSystem.Classes;
|
|||||||
using ASC.ApiSystem.Controllers;
|
using ASC.ApiSystem.Controllers;
|
||||||
using ASC.Common;
|
using ASC.Common;
|
||||||
using ASC.Common.DependencyInjection;
|
using ASC.Common.DependencyInjection;
|
||||||
using ASC.Common.Logging;
|
using ASC.Common.Logging;
|
||||||
|
|
||||||
|
using Autofac;
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Authentication;
|
using Microsoft.AspNetCore.Authentication;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
@ -81,8 +83,6 @@ namespace ASC.ApiSystem
|
|||||||
.AddRegistrationController()
|
.AddRegistrationController()
|
||||||
.AddSettingsController()
|
.AddSettingsController()
|
||||||
.AddTariffController();
|
.AddTariffController();
|
||||||
|
|
||||||
services.AddAutofac(Configuration, HostEnvironment.ContentRootPath, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||||
@ -114,6 +114,10 @@ namespace ASC.ApiSystem
|
|||||||
{
|
{
|
||||||
endpoints.MapControllers();
|
endpoints.MapControllers();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
public void ConfigureContainer(ContainerBuilder builder)
|
||||||
|
{
|
||||||
|
builder.Register(Configuration, HostEnvironment.ContentRootPath, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,21 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
using ASC.Api.Core.Middleware;
|
using ASC.Api.Core.Middleware;
|
||||||
using ASC.Common;
|
using ASC.Common;
|
||||||
using ASC.Core;
|
using ASC.Core;
|
||||||
using ASC.Data.Backup.Contracts;
|
using ASC.Data.Backup.Contracts;
|
||||||
|
using ASC.Data.Backup.ModelApi;
|
||||||
using ASC.Data.Backup.Models;
|
using ASC.Data.Backup.Models;
|
||||||
using ASC.Web.Api.Routing;
|
using ASC.Web.Api.Routing;
|
||||||
using ASC.Web.Studio.Utility;
|
using ASC.Web.Studio.Utility;
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
using static ASC.Data.Backup.BackupAjaxHandler;
|
||||||
|
|
||||||
namespace ASC.Data.Backup.Controllers
|
namespace ASC.Data.Backup.Controllers
|
||||||
{
|
{
|
||||||
[DefaultRoute]
|
[DefaultRoute]
|
||||||
@ -57,14 +61,23 @@ namespace ASC.Data.Backup.Controllers
|
|||||||
/// <param name="backupMail">Include mail in the backup</param>
|
/// <param name="backupMail">Include mail in the backup</param>
|
||||||
/// <category>Backup</category>
|
/// <category>Backup</category>
|
||||||
[Create("createbackupschedule")]
|
[Create("createbackupschedule")]
|
||||||
public void CreateBackupSchedule(BackupStorageType storageType, [FromQuery] Dictionary<string, string> storageParams, int backupsStored, [FromBody] BackupAjaxHandler.CronParams cronParams, bool backupMail)
|
public bool CreateBackupSchedule(BackupSchedule backupSchedule)
|
||||||
{
|
{
|
||||||
if (CoreBaseSettings.Standalone)
|
if (CoreBaseSettings.Standalone)
|
||||||
{
|
{
|
||||||
TenantExtra.DemandControlPanelPermission();
|
TenantExtra.DemandControlPanelPermission();
|
||||||
}
|
}
|
||||||
|
var storageType = backupSchedule.StorageType == null ? BackupStorageType.Documents : (BackupStorageType)Int32.Parse(backupSchedule.StorageType);
|
||||||
BackupHandler.CreateSchedule(storageType, storageParams, backupsStored, cronParams, backupMail);
|
var storageParams = backupSchedule.StorageParams == null ? new Dictionary<string, string>() : backupSchedule.StorageParams.ToDictionary(r => r.Key.ToString(), r => r.Value.ToString());
|
||||||
|
var backupStored = backupSchedule.BackupsStored == null ? 0 : Int32.Parse(backupSchedule.BackupsStored);
|
||||||
|
var cron = new CronParams()
|
||||||
|
{
|
||||||
|
Period = backupSchedule.CronParams.Period == null ? BackupPeriod.EveryDay : (BackupPeriod)Int32.Parse(backupSchedule.CronParams.Period),
|
||||||
|
Hour = backupSchedule.CronParams.Hour == null ? 0 : Int32.Parse(backupSchedule.CronParams.Hour),
|
||||||
|
Day = backupSchedule.CronParams.Day == null ? 0 : Int32.Parse(backupSchedule.CronParams.Day),
|
||||||
|
};
|
||||||
|
BackupHandler.CreateSchedule(storageType, storageParams, backupStored, cron, backupSchedule.BackupMail);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -72,7 +85,7 @@ namespace ASC.Data.Backup.Controllers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <category>Backup</category>
|
/// <category>Backup</category>
|
||||||
[Delete("deletebackupschedule")]
|
[Delete("deletebackupschedule")]
|
||||||
public void DeleteBackupSchedule()
|
public bool DeleteBackupSchedule()
|
||||||
{
|
{
|
||||||
if (CoreBaseSettings.Standalone)
|
if (CoreBaseSettings.Standalone)
|
||||||
{
|
{
|
||||||
@ -80,6 +93,8 @@ namespace ASC.Data.Backup.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
BackupHandler.DeleteSchedule();
|
BackupHandler.DeleteSchedule();
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -97,8 +112,9 @@ namespace ASC.Data.Backup.Controllers
|
|||||||
{
|
{
|
||||||
TenantExtra.DemandControlPanelPermission();
|
TenantExtra.DemandControlPanelPermission();
|
||||||
}
|
}
|
||||||
|
var storageType = backup.StorageType == null ? BackupStorageType.Documents : (BackupStorageType)Int32.Parse(backup.StorageType);
|
||||||
BackupHandler.StartBackup(backup.StorageType, backup.StorageParams ?? new Dictionary<string, string>(), backup.BackupMail);
|
var storageParams = backup.StorageParams == null ? new Dictionary<string, string>() : backup.StorageParams.ToDictionary(r => r.Key.ToString(), r => r.Value.ToString());
|
||||||
|
BackupHandler.StartBackup(storageType, storageParams, backup.BackupMail);
|
||||||
return BackupHandler.GetBackupProgress();
|
return BackupHandler.GetBackupProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +155,7 @@ namespace ASC.Data.Backup.Controllers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <category>Backup</category>
|
/// <category>Backup</category>
|
||||||
[Delete("deletebackup/{id}")]
|
[Delete("deletebackup/{id}")]
|
||||||
public void DeleteBackup(Guid id)
|
public bool DeleteBackup(Guid id)
|
||||||
{
|
{
|
||||||
if (CoreBaseSettings.Standalone)
|
if (CoreBaseSettings.Standalone)
|
||||||
{
|
{
|
||||||
@ -147,6 +163,7 @@ namespace ASC.Data.Backup.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
BackupHandler.DeleteBackup(id);
|
BackupHandler.DeleteBackup(id);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -155,7 +172,7 @@ namespace ASC.Data.Backup.Controllers
|
|||||||
/// <category>Backup</category>
|
/// <category>Backup</category>
|
||||||
/// <returns>Backup History</returns>
|
/// <returns>Backup History</returns>
|
||||||
[Delete("deletebackuphistory")]
|
[Delete("deletebackuphistory")]
|
||||||
public void DeleteBackupHistory()
|
public bool DeleteBackupHistory()
|
||||||
{
|
{
|
||||||
if (CoreBaseSettings.Standalone)
|
if (CoreBaseSettings.Standalone)
|
||||||
{
|
{
|
||||||
@ -163,6 +180,7 @@ namespace ASC.Data.Backup.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
BackupHandler.DeleteAllBackups();
|
BackupHandler.DeleteAllBackups();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -181,8 +199,8 @@ namespace ASC.Data.Backup.Controllers
|
|||||||
{
|
{
|
||||||
TenantExtra.DemandControlPanelPermission();
|
TenantExtra.DemandControlPanelPermission();
|
||||||
}
|
}
|
||||||
|
var storageParams = backupRestore.StorageParams == null ? new Dictionary<string, string>() : backupRestore.StorageParams.ToDictionary(r => r.Key.ToString(), r => r.Value.ToString());
|
||||||
BackupHandler.StartRestore(backupRestore.BackupId, backupRestore.StorageType, backupRestore.StorageParams, backupRestore.Notify);
|
BackupHandler.StartRestore(backupRestore.BackupId, (BackupStorageType)Int32.Parse(backupRestore.StorageType.ToString()), storageParams, backupRestore.Notify);
|
||||||
return BackupHandler.GetBackupProgress();
|
return BackupHandler.GetBackupProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,14 +1,16 @@
|
|||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
using ASC.Api.Collections;
|
||||||
using ASC.Data.Backup.Contracts;
|
using ASC.Data.Backup.Contracts;
|
||||||
|
|
||||||
namespace ASC.Data.Backup.Models
|
namespace ASC.Data.Backup.Models
|
||||||
{
|
{
|
||||||
public class Backup
|
public class Backup
|
||||||
{
|
{
|
||||||
public BackupStorageType StorageType { get; set; }
|
|
||||||
|
public string StorageType { get; set; }
|
||||||
public bool BackupMail { get; set; }
|
public bool BackupMail { get; set; }
|
||||||
public Dictionary<string, string> StorageParams { get; set; }
|
public IEnumerable<ItemKeyValuePair<object, object>> StorageParams { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
using ASC.Api.Collections;
|
||||||
using ASC.Data.Backup.Contracts;
|
using ASC.Data.Backup.Contracts;
|
||||||
|
|
||||||
namespace ASC.Data.Backup.Models
|
namespace ASC.Data.Backup.Models
|
||||||
@ -7,8 +8,8 @@ namespace ASC.Data.Backup.Models
|
|||||||
public class BackupRestore
|
public class BackupRestore
|
||||||
{
|
{
|
||||||
public string BackupId { get; set; }
|
public string BackupId { get; set; }
|
||||||
public BackupStorageType StorageType { get; set; }
|
public object StorageType { get; set; }
|
||||||
public Dictionary<string, string> StorageParams { get; set; }
|
public IEnumerable<ItemKeyValuePair<object, object>> StorageParams { get; set; }
|
||||||
public bool Notify { get; set; }
|
public bool Notify { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
28
common/services/ASC.Data.Backup/ModelApi/BackupSchedule.cs
Normal file
28
common/services/ASC.Data.Backup/ModelApi/BackupSchedule.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
using ASC.Api.Collections;
|
||||||
|
using ASC.Data.Backup.Contracts;
|
||||||
|
|
||||||
|
using static ASC.Data.Backup.BackupAjaxHandler;
|
||||||
|
|
||||||
|
namespace ASC.Data.Backup.ModelApi
|
||||||
|
{
|
||||||
|
public class BackupSchedule
|
||||||
|
{
|
||||||
|
public string StorageType { get; set; }
|
||||||
|
public IEnumerable<ItemKeyValuePair<object, object>> StorageParams { get; set; }
|
||||||
|
public string BackupsStored { get; set; }
|
||||||
|
public Cron CronParams { get; set; }
|
||||||
|
public bool BackupMail { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Cron
|
||||||
|
{
|
||||||
|
public string Period { get; set; }
|
||||||
|
public string Hour { get; set; }
|
||||||
|
public string Day { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -2,6 +2,8 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
using Autofac.Extensions.DependencyInjection;
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
@ -12,7 +14,8 @@ namespace ASC.Data.Backup
|
|||||||
{
|
{
|
||||||
public static async Task Main(string[] args)
|
public static async Task Main(string[] args)
|
||||||
{
|
{
|
||||||
await Host.CreateDefaultBuilder(args)
|
await Host.CreateDefaultBuilder(args)
|
||||||
|
.UseServiceProviderFactory(new AutofacServiceProviderFactory())
|
||||||
.ConfigureWebHostDefaults(webBuilder =>
|
.ConfigureWebHostDefaults(webBuilder =>
|
||||||
{
|
{
|
||||||
webBuilder.UseStartup<Startup>();
|
webBuilder.UseStartup<Startup>();
|
||||||
|
@ -512,6 +512,7 @@ namespace ASC.Data.Backup.Service
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
tenant = tenantManager.GetTenant(TenantId);
|
tenant = tenantManager.GetTenant(TenantId);
|
||||||
|
tenantManager.SetCurrentTenant(tenant);
|
||||||
notifyHelper.SendAboutRestoreStarted(tenant, Notify);
|
notifyHelper.SendAboutRestoreStarted(tenant, Notify);
|
||||||
var storage = backupStorageFactory.GetBackupStorage(StorageType, TenantId, StorageParams);
|
var storage = backupStorageFactory.GetBackupStorage(StorageType, TenantId, StorageParams);
|
||||||
storage.Download(StoragePath, tempFile);
|
storage.Download(StoragePath, tempFile);
|
||||||
@ -561,7 +562,7 @@ namespace ASC.Data.Backup.Service
|
|||||||
restoredTenant.MappedDomain = tenant.MappedDomain;
|
restoredTenant.MappedDomain = tenant.MappedDomain;
|
||||||
}
|
}
|
||||||
tenantManager.SaveTenant(restoredTenant);
|
tenantManager.SaveTenant(restoredTenant);
|
||||||
|
tenantManager.SetCurrentTenant(restoredTenant);
|
||||||
// sleep until tenants cache expires
|
// sleep until tenants cache expires
|
||||||
Thread.Sleep(TimeSpan.FromMinutes(2));
|
Thread.Sleep(TimeSpan.FromMinutes(2));
|
||||||
|
|
||||||
@ -592,6 +593,7 @@ namespace ASC.Data.Backup.Service
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
IsCompleted = true;
|
||||||
backupWorker.PublishProgress(this);
|
backupWorker.PublishProgress(this);
|
||||||
}
|
}
|
||||||
catch (Exception error)
|
catch (Exception error)
|
||||||
@ -603,7 +605,6 @@ namespace ASC.Data.Backup.Service
|
|||||||
{
|
{
|
||||||
File.Delete(tempFile);
|
File.Delete(tempFile);
|
||||||
}
|
}
|
||||||
IsCompleted = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -702,6 +703,8 @@ namespace ASC.Data.Backup.Service
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
|
IsCompleted = true;
|
||||||
backupWorker.PublishProgress(this);
|
backupWorker.PublishProgress(this);
|
||||||
}
|
}
|
||||||
catch (Exception error)
|
catch (Exception error)
|
||||||
@ -713,7 +716,6 @@ namespace ASC.Data.Backup.Service
|
|||||||
{
|
{
|
||||||
File.Delete(tempFile);
|
File.Delete(tempFile);
|
||||||
}
|
}
|
||||||
IsCompleted = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
using ASC.Api.Core;
|
using ASC.Api.Core;
|
||||||
using ASC.Common;
|
using ASC.Common;
|
||||||
|
using ASC.Common.DependencyInjection;
|
||||||
using ASC.Data.Backup.Controllers;
|
using ASC.Data.Backup.Controllers;
|
||||||
using ASC.Data.Backup.Service;
|
using ASC.Data.Backup.Service;
|
||||||
|
|
||||||
|
using Autofac;
|
||||||
|
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
@ -29,6 +32,11 @@ namespace ASC.Data.Backup
|
|||||||
.AddProgressQueue<BaseBackupProgressItem>(1, (int)TimeSpan.FromMinutes(5).TotalMilliseconds, true, false, 0);
|
.AddProgressQueue<BaseBackupProgressItem>(1, (int)TimeSpan.FromMinutes(5).TotalMilliseconds, true, false, 0);
|
||||||
|
|
||||||
services.AddHostedService<BackupServiceLauncher>();
|
services.AddHostedService<BackupServiceLauncher>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ConfigureContainer(ContainerBuilder builder)
|
||||||
|
{
|
||||||
|
builder.Register(Configuration, HostEnvironment.ContentRootPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,8 +24,10 @@
|
|||||||
*/
|
*/
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
using Autofac.Extensions.DependencyInjection;
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
@ -36,7 +38,8 @@ namespace ASC.Data.Storage.Encryption
|
|||||||
{
|
{
|
||||||
public static async Task Main(string[] args)
|
public static async Task Main(string[] args)
|
||||||
{
|
{
|
||||||
await Host.CreateDefaultBuilder(args)
|
await Host.CreateDefaultBuilder(args)
|
||||||
|
.UseServiceProviderFactory(new AutofacServiceProviderFactory())
|
||||||
.ConfigureWebHostDefaults(webBuilder =>
|
.ConfigureWebHostDefaults(webBuilder =>
|
||||||
{
|
{
|
||||||
webBuilder.UseStartup<Startup>();
|
webBuilder.UseStartup<Startup>();
|
||||||
|
@ -24,10 +24,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
using ASC.Api.Core;
|
using ASC.Api.Core;
|
||||||
using ASC.Common;
|
using ASC.Common;
|
||||||
using ASC.Common.DependencyInjection;
|
using ASC.Common.DependencyInjection;
|
||||||
|
|
||||||
using Autofac.Extensions.DependencyInjection;
|
using Autofac;
|
||||||
|
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
@ -51,8 +51,11 @@ namespace ASC.Data.Storage.Encryption
|
|||||||
DIHelper.AddEncryptionServiceLauncher();
|
DIHelper.AddEncryptionServiceLauncher();
|
||||||
|
|
||||||
services.AddHostedService<EncryptionServiceLauncher>();
|
services.AddHostedService<EncryptionServiceLauncher>();
|
||||||
|
}
|
||||||
services.AddAutofac(Configuration, HostEnvironment.ContentRootPath);
|
|
||||||
|
public void ConfigureContainer(ContainerBuilder builder)
|
||||||
|
{
|
||||||
|
builder.Register(Configuration, HostEnvironment.ContentRootPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,10 @@ using System.Threading.Tasks;
|
|||||||
using ASC.Common;
|
using ASC.Common;
|
||||||
using ASC.Common.DependencyInjection;
|
using ASC.Common.DependencyInjection;
|
||||||
using ASC.Common.Logging;
|
using ASC.Common.Logging;
|
||||||
using ASC.Core.Common;
|
|
||||||
|
using Autofac;
|
||||||
|
using Autofac.Extensions.DependencyInjection;
|
||||||
|
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
@ -17,7 +19,8 @@ namespace ASC.Data.Storage.Migration
|
|||||||
{
|
{
|
||||||
public static async Task Main(string[] args)
|
public static async Task Main(string[] args)
|
||||||
{
|
{
|
||||||
await Host.CreateDefaultBuilder(args)
|
await Host.CreateDefaultBuilder(args)
|
||||||
|
.UseServiceProviderFactory(new AutofacServiceProviderFactory())
|
||||||
.ConfigureAppConfiguration((hostContext, config) =>
|
.ConfigureAppConfiguration((hostContext, config) =>
|
||||||
{
|
{
|
||||||
var buided = config.Build();
|
var buided = config.Build();
|
||||||
@ -52,8 +55,10 @@ namespace ASC.Data.Storage.Migration
|
|||||||
|
|
||||||
diHelper.AddMigrationServiceLauncher();
|
diHelper.AddMigrationServiceLauncher();
|
||||||
services.AddHostedService<MigrationServiceLauncher>();
|
services.AddHostedService<MigrationServiceLauncher>();
|
||||||
|
})
|
||||||
services.AddAutofac(hostContext.Configuration, hostContext.HostingEnvironment.ContentRootPath);
|
.ConfigureContainer<ContainerBuilder>((context, builder) =>
|
||||||
|
{
|
||||||
|
builder.Register(context.Configuration, context.HostingEnvironment.ContentRootPath);
|
||||||
})
|
})
|
||||||
.UseConsoleLifetime()
|
.UseConsoleLifetime()
|
||||||
.Build()
|
.Build()
|
||||||
|
@ -461,18 +461,9 @@ namespace ASC.ElasticSearch
|
|||||||
FactoryIndexerHelper factoryIndexerHelper,
|
FactoryIndexerHelper factoryIndexerHelper,
|
||||||
Client client,
|
Client client,
|
||||||
IOptionsMonitor<ILog> options,
|
IOptionsMonitor<ILog> options,
|
||||||
CoreBaseSettings coreBaseSettings) : this(null, factoryIndexerHelper, client, options, coreBaseSettings)
|
|
||||||
{
|
|
||||||
Builder = container;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FactoryIndexer(
|
|
||||||
IContainer container,
|
|
||||||
FactoryIndexerHelper factoryIndexerHelper,
|
|
||||||
Client client,
|
|
||||||
IOptionsMonitor<ILog> options,
|
|
||||||
CoreBaseSettings coreBaseSettings)
|
CoreBaseSettings coreBaseSettings)
|
||||||
{
|
{
|
||||||
|
Builder = container;
|
||||||
FactoryIndexerHelper = factoryIndexerHelper;
|
FactoryIndexerHelper = factoryIndexerHelper;
|
||||||
Client = client;
|
Client = client;
|
||||||
CoreBaseSettings = coreBaseSettings;
|
CoreBaseSettings = coreBaseSettings;
|
||||||
|
@ -48,7 +48,7 @@ namespace ASC.ElasticSearch
|
|||||||
private ICacheNotify<AscCacheItem> Notify { get; }
|
private ICacheNotify<AscCacheItem> Notify { get; }
|
||||||
private ICacheNotify<IndexAction> IndexNotify { get; }
|
private ICacheNotify<IndexAction> IndexNotify { get; }
|
||||||
private IServiceProvider ServiceProvider { get; }
|
private IServiceProvider ServiceProvider { get; }
|
||||||
public IContainer Container { get; }
|
public ILifetimeScope Container { get; }
|
||||||
private bool IsStarted { get; set; }
|
private bool IsStarted { get; set; }
|
||||||
private CancellationTokenSource CancellationTokenSource { get; set; }
|
private CancellationTokenSource CancellationTokenSource { get; set; }
|
||||||
private Timer Timer { get; set; }
|
private Timer Timer { get; set; }
|
||||||
@ -59,7 +59,7 @@ namespace ASC.ElasticSearch
|
|||||||
ICacheNotify<AscCacheItem> notify,
|
ICacheNotify<AscCacheItem> notify,
|
||||||
ICacheNotify<IndexAction> indexNotify,
|
ICacheNotify<IndexAction> indexNotify,
|
||||||
IServiceProvider serviceProvider,
|
IServiceProvider serviceProvider,
|
||||||
IContainer container,
|
ILifetimeScope container,
|
||||||
Settings settings)
|
Settings settings)
|
||||||
{
|
{
|
||||||
Log = options.Get("ASC.Indexer");
|
Log = options.Get("ASC.Indexer");
|
||||||
|
@ -42,11 +42,11 @@ namespace ASC.ElasticSearch.Service
|
|||||||
{
|
{
|
||||||
public class Service
|
public class Service
|
||||||
{
|
{
|
||||||
public IContainer Container { get; }
|
private ILifetimeScope Container { get; }
|
||||||
private IServiceProvider ServiceProvider { get; }
|
private IServiceProvider ServiceProvider { get; }
|
||||||
private ICacheNotify<ReIndexAction> CacheNotify { get; }
|
private ICacheNotify<ReIndexAction> CacheNotify { get; }
|
||||||
|
|
||||||
public Service(IContainer container, IServiceProvider serviceProvider, ICacheNotify<ReIndexAction> cacheNotify)
|
public Service(ILifetimeScope container, IServiceProvider serviceProvider, ICacheNotify<ReIndexAction> cacheNotify)
|
||||||
{
|
{
|
||||||
Container = container;
|
Container = container;
|
||||||
ServiceProvider = serviceProvider;
|
ServiceProvider = serviceProvider;
|
||||||
|
@ -63,12 +63,12 @@ namespace ASC.Feed.Aggregator
|
|||||||
|
|
||||||
private IConfiguration Configuration { get; }
|
private IConfiguration Configuration { get; }
|
||||||
private IServiceProvider ServiceProvider { get; }
|
private IServiceProvider ServiceProvider { get; }
|
||||||
public IContainer Container { get; }
|
public ILifetimeScope Container { get; }
|
||||||
|
|
||||||
public FeedAggregatorService(
|
public FeedAggregatorService(
|
||||||
IConfiguration configuration,
|
IConfiguration configuration,
|
||||||
IServiceProvider serviceProvider,
|
IServiceProvider serviceProvider,
|
||||||
IContainer container,
|
ILifetimeScope container,
|
||||||
IOptionsMonitor<ILog> optionsMonitor,
|
IOptionsMonitor<ILog> optionsMonitor,
|
||||||
SignalrServiceClient signalrServiceClient,
|
SignalrServiceClient signalrServiceClient,
|
||||||
IConfigureNamedOptions<SignalrServiceClient> configureOptions)
|
IConfigureNamedOptions<SignalrServiceClient> configureOptions)
|
||||||
|
@ -31,7 +31,6 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
using ASC.Common;
|
using ASC.Common;
|
||||||
using ASC.Common.Logging;
|
using ASC.Common.Logging;
|
||||||
using ASC.Core.Common;
|
|
||||||
using ASC.Notify.Config;
|
using ASC.Notify.Config;
|
||||||
using ASC.Web.Core;
|
using ASC.Web.Core;
|
||||||
using ASC.Web.Studio.Core.Notify;
|
using ASC.Web.Studio.Core.Notify;
|
||||||
|
@ -5,11 +5,13 @@ using System.Threading.Tasks;
|
|||||||
using ASC.Common;
|
using ASC.Common;
|
||||||
using ASC.Common.DependencyInjection;
|
using ASC.Common.DependencyInjection;
|
||||||
using ASC.Common.Logging;
|
using ASC.Common.Logging;
|
||||||
using ASC.Core.Common;
|
|
||||||
using ASC.Core.Notify;
|
using ASC.Core.Notify;
|
||||||
using ASC.Core.Notify.Senders;
|
using ASC.Core.Notify.Senders;
|
||||||
using ASC.Notify.Config;
|
using ASC.Notify.Config;
|
||||||
|
|
||||||
|
using Autofac;
|
||||||
|
using Autofac.Extensions.DependencyInjection;
|
||||||
|
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
@ -22,6 +24,7 @@ namespace ASC.Notify
|
|||||||
public static async Task Main(string[] args)
|
public static async Task Main(string[] args)
|
||||||
{
|
{
|
||||||
var host = Host.CreateDefaultBuilder(args)
|
var host = Host.CreateDefaultBuilder(args)
|
||||||
|
.UseServiceProviderFactory(new AutofacServiceProviderFactory())
|
||||||
.ConfigureAppConfiguration((hostContext, config) =>
|
.ConfigureAppConfiguration((hostContext, config) =>
|
||||||
{
|
{
|
||||||
var buided = config.Build();
|
var buided = config.Build();
|
||||||
@ -65,8 +68,10 @@ namespace ASC.Notify
|
|||||||
.AddSmtpSenderService()
|
.AddSmtpSenderService()
|
||||||
.AddAWSSenderService()
|
.AddAWSSenderService()
|
||||||
.AddEmailSenderSinkService();
|
.AddEmailSenderSinkService();
|
||||||
|
})
|
||||||
services.AddAutofac(hostContext.Configuration, hostContext.HostingEnvironment.ContentRootPath);
|
.ConfigureContainer<ContainerBuilder>((context, builder) =>
|
||||||
|
{
|
||||||
|
builder.Register(context.Configuration, context.HostingEnvironment.ContentRootPath);
|
||||||
})
|
})
|
||||||
.UseConsoleLifetime()
|
.UseConsoleLifetime()
|
||||||
.Build();
|
.Build();
|
||||||
|
@ -28,10 +28,13 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
using ASC.Common;
|
using ASC.Common;
|
||||||
using ASC.Common.DependencyInjection;
|
using ASC.Common.DependencyInjection;
|
||||||
using ASC.Common.Logging;
|
using ASC.Common.Logging;
|
||||||
|
|
||||||
|
using Autofac;
|
||||||
|
using Autofac.Extensions.DependencyInjection;
|
||||||
|
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
@ -43,7 +46,8 @@ namespace ASC.Socket.IO.Svc
|
|||||||
{
|
{
|
||||||
public static async Task Main(string[] args)
|
public static async Task Main(string[] args)
|
||||||
{
|
{
|
||||||
var host = Host.CreateDefaultBuilder(args)
|
var host = Host.CreateDefaultBuilder(args)
|
||||||
|
.UseServiceProviderFactory(new AutofacServiceProviderFactory())
|
||||||
.ConfigureAppConfiguration((hostContext, config) =>
|
.ConfigureAppConfiguration((hostContext, config) =>
|
||||||
{
|
{
|
||||||
var buided = config.Build();
|
var buided = config.Build();
|
||||||
@ -77,8 +81,10 @@ namespace ASC.Socket.IO.Svc
|
|||||||
diHelper.AddNLogManager("ASC.Socket.IO.Svc");
|
diHelper.AddNLogManager("ASC.Socket.IO.Svc");
|
||||||
services.AddHostedService<SocketServiceLauncher>();
|
services.AddHostedService<SocketServiceLauncher>();
|
||||||
diHelper.AddSocketServiceLauncher();
|
diHelper.AddSocketServiceLauncher();
|
||||||
|
})
|
||||||
services.AddAutofac(hostContext.Configuration, hostContext.HostingEnvironment.ContentRootPath, false, false);
|
.ConfigureContainer<ContainerBuilder>((context, builder) =>
|
||||||
|
{
|
||||||
|
builder.Register(context.Configuration, context.HostingEnvironment.ContentRootPath, false, false);
|
||||||
})
|
})
|
||||||
.UseConsoleLifetime()
|
.UseConsoleLifetime()
|
||||||
.Build();
|
.Build();
|
||||||
|
@ -40,8 +40,6 @@ using Microsoft.Extensions.Configuration;
|
|||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
|
|
||||||
using WebSocketSharp;
|
|
||||||
|
|
||||||
namespace ASC.Socket.IO.Svc
|
namespace ASC.Socket.IO.Svc
|
||||||
{
|
{
|
||||||
public class SocketServiceLauncher : IHostedService
|
public class SocketServiceLauncher : IHostedService
|
||||||
|
@ -8,6 +8,9 @@ using ASC.Common.Logging;
|
|||||||
using ASC.Core.Notify;
|
using ASC.Core.Notify;
|
||||||
using ASC.Notify;
|
using ASC.Notify;
|
||||||
|
|
||||||
|
using Autofac;
|
||||||
|
using Autofac.Extensions.DependencyInjection;
|
||||||
|
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
@ -19,6 +22,7 @@ namespace ASC.Studio.Notify
|
|||||||
public static async Task Main(string[] args)
|
public static async Task Main(string[] args)
|
||||||
{
|
{
|
||||||
var host = Host.CreateDefaultBuilder(args)
|
var host = Host.CreateDefaultBuilder(args)
|
||||||
|
.UseServiceProviderFactory(new AutofacServiceProviderFactory())
|
||||||
.ConfigureAppConfiguration((hostContext, config) =>
|
.ConfigureAppConfiguration((hostContext, config) =>
|
||||||
{
|
{
|
||||||
var buided = config.Build();
|
var buided = config.Build();
|
||||||
@ -52,7 +56,10 @@ namespace ASC.Studio.Notify
|
|||||||
services.AddHostedService<ServiceLauncher>();
|
services.AddHostedService<ServiceLauncher>();
|
||||||
diHelper.AddServiceLauncher();
|
diHelper.AddServiceLauncher();
|
||||||
diHelper.AddEmailSenderSinkService();
|
diHelper.AddEmailSenderSinkService();
|
||||||
services.AddAutofac(hostContext.Configuration, hostContext.HostingEnvironment.ContentRootPath);
|
})
|
||||||
|
.ConfigureContainer<ContainerBuilder>((context, builder) =>
|
||||||
|
{
|
||||||
|
builder.Register(context.Configuration, context.HostingEnvironment.ContentRootPath);
|
||||||
})
|
})
|
||||||
.UseConsoleLifetime()
|
.UseConsoleLifetime()
|
||||||
.Build();
|
.Build();
|
||||||
|
@ -24,8 +24,10 @@
|
|||||||
*/
|
*/
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
using Autofac.Extensions.DependencyInjection;
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
@ -36,7 +38,8 @@ namespace ASC.TelegramService
|
|||||||
{
|
{
|
||||||
public static async Task Main(string[] args)
|
public static async Task Main(string[] args)
|
||||||
{
|
{
|
||||||
await Host.CreateDefaultBuilder(args)
|
await Host.CreateDefaultBuilder(args)
|
||||||
|
.UseServiceProviderFactory(new AutofacServiceProviderFactory())
|
||||||
.ConfigureWebHostDefaults(webBuilder =>
|
.ConfigureWebHostDefaults(webBuilder =>
|
||||||
{
|
{
|
||||||
webBuilder.UseStartup<Startup>();
|
webBuilder.UseStartup<Startup>();
|
||||||
|
@ -25,9 +25,9 @@
|
|||||||
|
|
||||||
using ASC.Api.Core;
|
using ASC.Api.Core;
|
||||||
using ASC.Common;
|
using ASC.Common;
|
||||||
using ASC.Common.DependencyInjection;
|
using ASC.Common.DependencyInjection;
|
||||||
|
|
||||||
using Autofac.Extensions.DependencyInjection;
|
using Autofac;
|
||||||
|
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
@ -51,8 +51,11 @@ namespace ASC.TelegramService
|
|||||||
DIHelper.AddTelegramLauncher();
|
DIHelper.AddTelegramLauncher();
|
||||||
|
|
||||||
services.AddHostedService<TelegramLauncher>();
|
services.AddHostedService<TelegramLauncher>();
|
||||||
|
}
|
||||||
services.AddAutofac(Configuration, HostEnvironment.ContentRootPath);
|
|
||||||
|
public void ConfigureContainer(ContainerBuilder builder)
|
||||||
|
{
|
||||||
|
builder.Register(Configuration, HostEnvironment.ContentRootPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,11 +27,14 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
using ASC.Common;
|
using ASC.Common;
|
||||||
using ASC.Common.DependencyInjection;
|
using ASC.Common.DependencyInjection;
|
||||||
using ASC.Common.Logging;
|
using ASC.Common.Logging;
|
||||||
|
|
||||||
|
using Autofac;
|
||||||
|
using Autofac.Extensions.DependencyInjection;
|
||||||
|
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
@ -43,7 +46,8 @@ namespace ASC.Thumbnails.Svc
|
|||||||
{
|
{
|
||||||
public static async Task Main(string[] args)
|
public static async Task Main(string[] args)
|
||||||
{
|
{
|
||||||
var host = Host.CreateDefaultBuilder(args)
|
var host = Host.CreateDefaultBuilder(args)
|
||||||
|
.UseServiceProviderFactory(new AutofacServiceProviderFactory())
|
||||||
.ConfigureAppConfiguration((hostContext, config) =>
|
.ConfigureAppConfiguration((hostContext, config) =>
|
||||||
{
|
{
|
||||||
var buided = config.Build();
|
var buided = config.Build();
|
||||||
@ -76,8 +80,10 @@ namespace ASC.Thumbnails.Svc
|
|||||||
diHelper.AddNLogManager("ASC.Thumbnails.Svc");
|
diHelper.AddNLogManager("ASC.Thumbnails.Svc");
|
||||||
services.AddHostedService<ThumbnailsServiceLauncher>();
|
services.AddHostedService<ThumbnailsServiceLauncher>();
|
||||||
diHelper.AddThumbnailsServiceLauncher();
|
diHelper.AddThumbnailsServiceLauncher();
|
||||||
|
})
|
||||||
services.AddAutofac(hostContext.Configuration, hostContext.HostingEnvironment.ContentRootPath, false, false);
|
.ConfigureContainer<ContainerBuilder>((context, builder) =>
|
||||||
|
{
|
||||||
|
builder.Register(context.Configuration, context.HostingEnvironment.ContentRootPath, false, false);
|
||||||
})
|
})
|
||||||
.UseConsoleLifetime()
|
.UseConsoleLifetime()
|
||||||
.Build();
|
.Build();
|
||||||
|
@ -28,10 +28,13 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
using ASC.Common;
|
using ASC.Common;
|
||||||
using ASC.Common.DependencyInjection;
|
using ASC.Common.DependencyInjection;
|
||||||
using ASC.Common.Logging;
|
using ASC.Common.Logging;
|
||||||
|
|
||||||
|
using Autofac;
|
||||||
|
using Autofac.Extensions.DependencyInjection;
|
||||||
|
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
@ -43,7 +46,8 @@ namespace ASC.UrlShortener.Svc
|
|||||||
{
|
{
|
||||||
public static async Task Main(string[] args)
|
public static async Task Main(string[] args)
|
||||||
{
|
{
|
||||||
var host = Host.CreateDefaultBuilder(args)
|
var host = Host.CreateDefaultBuilder(args)
|
||||||
|
.UseServiceProviderFactory(new AutofacServiceProviderFactory())
|
||||||
.ConfigureAppConfiguration((hostContext, config) =>
|
.ConfigureAppConfiguration((hostContext, config) =>
|
||||||
{
|
{
|
||||||
var buided = config.Build();
|
var buided = config.Build();
|
||||||
@ -75,8 +79,10 @@ namespace ASC.UrlShortener.Svc
|
|||||||
diHelper.AddNLogManager("ASC.UrlShortener.Svc");
|
diHelper.AddNLogManager("ASC.UrlShortener.Svc");
|
||||||
services.AddHostedService<UrlShortenerServiceLauncher>();
|
services.AddHostedService<UrlShortenerServiceLauncher>();
|
||||||
diHelper.AddUrlShortenerServiceLauncher();
|
diHelper.AddUrlShortenerServiceLauncher();
|
||||||
|
})
|
||||||
services.AddAutofac(hostContext.Configuration, hostContext.HostingEnvironment.ContentRootPath, false, false);
|
.ConfigureContainer<ContainerBuilder>((context, builder) =>
|
||||||
|
{
|
||||||
|
builder.Register(context.Configuration, context.HostingEnvironment.ContentRootPath, false, false);
|
||||||
})
|
})
|
||||||
.UseConsoleLifetime()
|
.UseConsoleLifetime()
|
||||||
.Build();
|
.Build();
|
||||||
|
@ -97,24 +97,35 @@ server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
location /api/2.0 {
|
location /api/2.0 {
|
||||||
proxy_pass http://localhost:5000;
|
location ~* /(files|encryption) {
|
||||||
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
|
proxy_pass http://localhost:5007;
|
||||||
|
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
|
||||||
location ~* /(people|group) {
|
|
||||||
proxy_pass http://localhost:5004;
|
|
||||||
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~* /(files|encryption) {
|
location ~* /(authentication|modules|portal|security|settings|smtpsettings|capabilities) {
|
||||||
proxy_pass http://localhost:5007;
|
proxy_pass http://localhost:5000;
|
||||||
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
|
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
|
||||||
|
|
||||||
|
location ~* portal/(.*)(backup|restore)(.*) {
|
||||||
|
rewrite (.*)/portal/(.*) $1/backup/$2 break;
|
||||||
|
proxy_redirect off;
|
||||||
|
|
||||||
|
proxy_pass http://localhost:5012;
|
||||||
|
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~* /(people|group) {
|
||||||
|
proxy_pass http://localhost:5004;
|
||||||
|
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~* /backup {
|
location ~* /backup {
|
||||||
proxy_pass http://localhost:5012;
|
proxy_pass http://localhost:5012;
|
||||||
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
|
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
location /storage {
|
location /storage {
|
||||||
proxy_pass http://localhost:5003;
|
proxy_pass http://localhost:5003;
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
<meta name="mobile-web-app-capable" content="yes" />
|
<meta name="mobile-web-app-capable" content="yes" />
|
||||||
<!-- Tell iOS it's a PWA -->
|
<!-- Tell iOS it's a PWA -->
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||||
<link rel="apple-touch-icon" href="icon.png" />
|
<link rel="apple-touch-icon" href="appIcon.png" />
|
||||||
|
|
||||||
<link
|
<link
|
||||||
href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i"
|
href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i"
|
||||||
|
@ -90,10 +90,6 @@ namespace ASC.Api.Documents
|
|||||||
private UserManager UserManager { get; }
|
private UserManager UserManager { get; }
|
||||||
private CoreBaseSettings CoreBaseSettings { get; }
|
private CoreBaseSettings CoreBaseSettings { get; }
|
||||||
private ThirdpartyConfiguration ThirdpartyConfiguration { get; }
|
private ThirdpartyConfiguration ThirdpartyConfiguration { get; }
|
||||||
private BoxLoginProvider BoxLoginProvider { get; }
|
|
||||||
private DropboxLoginProvider DropboxLoginProvider { get; }
|
|
||||||
private GoogleLoginProvider GoogleLoginProvider { get; }
|
|
||||||
private OneDriveLoginProvider OneDriveLoginProvider { get; }
|
|
||||||
private MessageService MessageService { get; }
|
private MessageService MessageService { get; }
|
||||||
private CommonLinkUtility CommonLinkUtility { get; }
|
private CommonLinkUtility CommonLinkUtility { get; }
|
||||||
private DocumentServiceConnector DocumentServiceConnector { get; }
|
private DocumentServiceConnector DocumentServiceConnector { get; }
|
||||||
@ -150,10 +146,6 @@ namespace ASC.Api.Documents
|
|||||||
CoreBaseSettings = coreBaseSettings;
|
CoreBaseSettings = coreBaseSettings;
|
||||||
ThirdpartyConfiguration = thirdpartyConfiguration;
|
ThirdpartyConfiguration = thirdpartyConfiguration;
|
||||||
ConsumerFactory = consumerFactory;
|
ConsumerFactory = consumerFactory;
|
||||||
BoxLoginProvider = ConsumerFactory.Get<BoxLoginProvider>();
|
|
||||||
DropboxLoginProvider = ConsumerFactory.Get<DropboxLoginProvider>();
|
|
||||||
GoogleLoginProvider = ConsumerFactory.Get<GoogleLoginProvider>();
|
|
||||||
OneDriveLoginProvider = ConsumerFactory.Get<OneDriveLoginProvider>();
|
|
||||||
MessageService = messageService;
|
MessageService = messageService;
|
||||||
CommonLinkUtility = commonLinkUtility;
|
CommonLinkUtility = commonLinkUtility;
|
||||||
DocumentServiceConnector = documentServiceConnector;
|
DocumentServiceConnector = documentServiceConnector;
|
||||||
@ -1357,19 +1349,25 @@ namespace ASC.Api.Documents
|
|||||||
|
|
||||||
if (ThirdpartyConfiguration.SupportBoxInclusion)
|
if (ThirdpartyConfiguration.SupportBoxInclusion)
|
||||||
{
|
{
|
||||||
result.Add(new List<string> { "Box", BoxLoginProvider.ClientID, BoxLoginProvider.RedirectUri });
|
var boxLoginProvider = ConsumerFactory.Get<BoxLoginProvider>();
|
||||||
|
result.Add(new List<string> { "Box", boxLoginProvider.ClientID, boxLoginProvider.RedirectUri });
|
||||||
}
|
}
|
||||||
if (ThirdpartyConfiguration.SupportDropboxInclusion)
|
if (ThirdpartyConfiguration.SupportDropboxInclusion)
|
||||||
{
|
{
|
||||||
result.Add(new List<string> { "DropboxV2", DropboxLoginProvider.ClientID, DropboxLoginProvider.RedirectUri });
|
var dropboxLoginProvider = ConsumerFactory.Get<DropboxLoginProvider>();
|
||||||
|
result.Add(new List<string> { "DropboxV2", dropboxLoginProvider.ClientID, dropboxLoginProvider.RedirectUri });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ThirdpartyConfiguration.SupportGoogleDriveInclusion)
|
if (ThirdpartyConfiguration.SupportGoogleDriveInclusion)
|
||||||
{
|
{
|
||||||
result.Add(new List<string> { "GoogleDrive", GoogleLoginProvider.ClientID, GoogleLoginProvider.RedirectUri });
|
var googleLoginProvider = ConsumerFactory.Get<GoogleLoginProvider>();
|
||||||
|
result.Add(new List<string> { "GoogleDrive", googleLoginProvider.ClientID, googleLoginProvider.RedirectUri });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ThirdpartyConfiguration.SupportOneDriveInclusion)
|
if (ThirdpartyConfiguration.SupportOneDriveInclusion)
|
||||||
{
|
{
|
||||||
result.Add(new List<string> { "OneDrive", OneDriveLoginProvider.ClientID, OneDriveLoginProvider.RedirectUri });
|
var oneDriveLoginProvider = ConsumerFactory.Get<OneDriveLoginProvider>();
|
||||||
|
result.Add(new List<string> { "OneDrive", oneDriveLoginProvider.ClientID, oneDriveLoginProvider.RedirectUri });
|
||||||
}
|
}
|
||||||
if (ThirdpartyConfiguration.SupportSharePointInclusion)
|
if (ThirdpartyConfiguration.SupportSharePointInclusion)
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
|
using Autofac.Extensions.DependencyInjection;
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
@ -17,6 +19,7 @@ namespace ASC.Files
|
|||||||
public static IHostBuilder CreateHostBuilder(string[] args)
|
public static IHostBuilder CreateHostBuilder(string[] args)
|
||||||
{
|
{
|
||||||
return Host.CreateDefaultBuilder(args)
|
return Host.CreateDefaultBuilder(args)
|
||||||
|
.UseServiceProviderFactory(new AutofacServiceProviderFactory())
|
||||||
.ConfigureWebHostDefaults(webBuilder =>
|
.ConfigureWebHostDefaults(webBuilder =>
|
||||||
{
|
{
|
||||||
webBuilder.UseStartup<Startup>();
|
webBuilder.UseStartup<Startup>();
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
using System.Linq;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
@ -11,6 +11,9 @@ using ASC.Feed.Aggregator;
|
|||||||
using ASC.Web.Files.Core.Search;
|
using ASC.Web.Files.Core.Search;
|
||||||
using ASC.Web.Files.Utils;
|
using ASC.Web.Files.Utils;
|
||||||
|
|
||||||
|
using Autofac;
|
||||||
|
using Autofac.Extensions.DependencyInjection;
|
||||||
|
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
@ -22,6 +25,7 @@ namespace ASC.Files.Service
|
|||||||
public static async Task Main(string[] args)
|
public static async Task Main(string[] args)
|
||||||
{
|
{
|
||||||
var host = Host.CreateDefaultBuilder(args)
|
var host = Host.CreateDefaultBuilder(args)
|
||||||
|
.UseServiceProviderFactory(new AutofacServiceProviderFactory())
|
||||||
.ConfigureAppConfiguration((hostContext, config) =>
|
.ConfigureAppConfiguration((hostContext, config) =>
|
||||||
{
|
{
|
||||||
var buided = config.Build();
|
var buided = config.Build();
|
||||||
@ -65,8 +69,10 @@ namespace ASC.Files.Service
|
|||||||
services.AddHostedService<FeedAggregatorService>();
|
services.AddHostedService<FeedAggregatorService>();
|
||||||
diHelper
|
diHelper
|
||||||
.AddFeedAggregatorService();
|
.AddFeedAggregatorService();
|
||||||
|
})
|
||||||
services.AddAutofac(hostContext.Configuration, hostContext.HostingEnvironment.ContentRootPath, true, false, "search.json", "feed.json");
|
.ConfigureContainer<ContainerBuilder>((context, builder) =>
|
||||||
|
{
|
||||||
|
builder.Register(context.Configuration, context.HostingEnvironment.ContentRootPath, true, false, "search.json", "feed.json");
|
||||||
})
|
})
|
||||||
.UseConsoleLifetime()
|
.UseConsoleLifetime()
|
||||||
.Build();
|
.Build();
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
<meta name="mobile-web-app-capable" content="yes" />
|
<meta name="mobile-web-app-capable" content="yes" />
|
||||||
<!-- Tell iOS it's a PWA -->
|
<!-- Tell iOS it's a PWA -->
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||||
<link rel="apple-touch-icon" href="icon.png" />
|
<link rel="apple-touch-icon" href="appIcon.png" />
|
||||||
|
|
||||||
<link
|
<link
|
||||||
href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i"
|
href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i"
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
|
using Autofac.Extensions.DependencyInjection;
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
@ -17,6 +19,7 @@ namespace ASC.People
|
|||||||
public static IHostBuilder CreateHostBuilder(string[] args)
|
public static IHostBuilder CreateHostBuilder(string[] args)
|
||||||
{
|
{
|
||||||
return Host.CreateDefaultBuilder(args)
|
return Host.CreateDefaultBuilder(args)
|
||||||
|
.UseServiceProviderFactory(new AutofacServiceProviderFactory())
|
||||||
.ConfigureWebHostDefaults(webBuilder =>
|
.ConfigureWebHostDefaults(webBuilder =>
|
||||||
{
|
{
|
||||||
webBuilder.UseStartup<Startup>();
|
webBuilder.UseStartup<Startup>();
|
||||||
|
@ -2,11 +2,14 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
using ASC.Api.Core;
|
using ASC.Api.Core;
|
||||||
using ASC.Common;
|
using ASC.Common;
|
||||||
|
using ASC.Common.DependencyInjection;
|
||||||
using ASC.Data.Reassigns;
|
using ASC.Data.Reassigns;
|
||||||
using ASC.Employee.Core.Controllers;
|
using ASC.Employee.Core.Controllers;
|
||||||
using ASC.Web.Core.Users;
|
using ASC.Web.Core.Users;
|
||||||
|
|
||||||
|
using Autofac;
|
||||||
|
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
@ -33,6 +36,11 @@ namespace ASC.People
|
|||||||
DIHelper
|
DIHelper
|
||||||
.AddPeopleController()
|
.AddPeopleController()
|
||||||
.AddGroupController();
|
.AddGroupController();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ConfigureContainer(ContainerBuilder builder)
|
||||||
|
{
|
||||||
|
builder.Register(Configuration, HostEnvironment.ContentRootPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,14 +2,12 @@
|
|||||||
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
|
|
||||||
using ASC.Common.Logging;
|
using ASC.Common.Logging;
|
||||||
using ASC.Core;
|
using ASC.Core;
|
||||||
using ASC.Core.Common.Settings;
|
using ASC.Core.Common.Settings;
|
||||||
using ASC.FederatedLogin;
|
|
||||||
using ASC.FederatedLogin.LoginProviders;
|
using ASC.FederatedLogin.LoginProviders;
|
||||||
using ASC.Web.Api.Models;
|
using ASC.Web.Api.Models;
|
||||||
using ASC.Web.Api.Routing;
|
using ASC.Web.Api.Routing;
|
||||||
|
@ -8,7 +8,6 @@ using ASC.Common;
|
|||||||
using ASC.Common.Logging;
|
using ASC.Common.Logging;
|
||||||
using ASC.Core;
|
using ASC.Core;
|
||||||
using ASC.Core.Billing;
|
using ASC.Core.Billing;
|
||||||
using ASC.Core.Common.Notify.Push;
|
|
||||||
using ASC.Core.Common.Settings;
|
using ASC.Core.Common.Settings;
|
||||||
using ASC.Core.Tenants;
|
using ASC.Core.Tenants;
|
||||||
using ASC.Core.Users;
|
using ASC.Core.Users;
|
||||||
@ -21,6 +20,8 @@ using ASC.Web.Core.Mobile;
|
|||||||
using ASC.Web.Core.Utility;
|
using ASC.Web.Core.Utility;
|
||||||
using ASC.Web.Studio.Core;
|
using ASC.Web.Studio.Core;
|
||||||
using ASC.Web.Studio.Core.Notify;
|
using ASC.Web.Studio.Core.Notify;
|
||||||
|
using ASC.Web.Studio.UserControls.Management;
|
||||||
|
using ASC.Web.Studio.UserControls.Statistics;
|
||||||
using ASC.Web.Studio.Utility;
|
using ASC.Web.Studio.Utility;
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
@ -50,7 +51,8 @@ namespace ASC.Web.Api.Controllers
|
|||||||
private SettingsManager SettingsManager { get; }
|
private SettingsManager SettingsManager { get; }
|
||||||
private IMobileAppInstallRegistrator MobileAppInstallRegistrator { get; }
|
private IMobileAppInstallRegistrator MobileAppInstallRegistrator { get; }
|
||||||
private IConfiguration Configuration { get; set; }
|
private IConfiguration Configuration { get; set; }
|
||||||
private ILog Log { get; }
|
private TenantExtra TenantExtra { get; set; }
|
||||||
|
public ILog Log { get; }
|
||||||
|
|
||||||
|
|
||||||
public PortalController(
|
public PortalController(
|
||||||
@ -66,6 +68,7 @@ namespace ASC.Web.Api.Controllers
|
|||||||
SecurityContext securityContext,
|
SecurityContext securityContext,
|
||||||
SettingsManager settingsManager,
|
SettingsManager settingsManager,
|
||||||
IMobileAppInstallRegistrator mobileAppInstallRegistrator,
|
IMobileAppInstallRegistrator mobileAppInstallRegistrator,
|
||||||
|
TenantExtra tenantExtra,
|
||||||
IConfiguration configuration
|
IConfiguration configuration
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -82,6 +85,7 @@ namespace ASC.Web.Api.Controllers
|
|||||||
SettingsManager = settingsManager;
|
SettingsManager = settingsManager;
|
||||||
MobileAppInstallRegistrator = mobileAppInstallRegistrator;
|
MobileAppInstallRegistrator = mobileAppInstallRegistrator;
|
||||||
Configuration = configuration;
|
Configuration = configuration;
|
||||||
|
TenantExtra = tenantExtra;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Read("")]
|
[Read("")]
|
||||||
@ -122,6 +126,20 @@ namespace ASC.Web.Api.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Read("tenantextra")]
|
||||||
|
public object GetTenantExtra()
|
||||||
|
{
|
||||||
|
return new
|
||||||
|
{
|
||||||
|
opensource = TenantExtra.Opensource,
|
||||||
|
enterprise = TenantExtra.Enterprise,
|
||||||
|
tariff = TenantExtra.GetCurrentTariff(),
|
||||||
|
quota = TenantExtra.GetTenantQuota(),
|
||||||
|
notPaid = TenantExtra.IsNotPaid(),
|
||||||
|
licenseAccept = SettingsManager.LoadForCurrentUser<TariffSettings>().LicenseAcceptSetting
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
[Read("usedspace")]
|
[Read("usedspace")]
|
||||||
public double GetUsedSpace()
|
public double GetUsedSpace()
|
||||||
@ -208,7 +226,7 @@ namespace ASC.Web.Api.Controllers
|
|||||||
{
|
{
|
||||||
var currentUser = UserManager.GetUsers(SecurityContext.CurrentAccount.ID);
|
var currentUser = UserManager.GetUsers(SecurityContext.CurrentAccount.ID);
|
||||||
MobileAppInstallRegistrator.RegisterInstall(currentUser.Email, model.Type);
|
MobileAppInstallRegistrator.RegisterInstall(currentUser.Email, model.Type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class PortalControllerExtension
|
public static class PortalControllerExtension
|
||||||
@ -230,7 +248,8 @@ namespace ASC.Web.Api.Controllers
|
|||||||
.AddAuthContextService()
|
.AddAuthContextService()
|
||||||
.AddWebItemSecurity()
|
.AddWebItemSecurity()
|
||||||
.AddSecurityContextService()
|
.AddSecurityContextService()
|
||||||
.AddCachedMobileAppInstallRegistrator();
|
.AddCachedMobileAppInstallRegistrator()
|
||||||
|
.AddTenantExtraService();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -134,20 +134,20 @@ namespace ASC.Web.Api.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Create("audit/settings/lifetime")]
|
[Create("audit/settings/lifetime")]
|
||||||
public TenantAuditSettings SetAuditSettings(TenantAuditSettings settings)
|
public TenantAuditSettings SetAuditSettings(TenantAuditSettingsWrapper wrapper)
|
||||||
{
|
{
|
||||||
PermissionContext.DemandPermissions(SecutiryConstants.EditPortalSettings);
|
PermissionContext.DemandPermissions(SecutiryConstants.EditPortalSettings);
|
||||||
|
|
||||||
if (settings.LoginHistoryLifeTime <= 0 || settings.LoginHistoryLifeTime > TenantAuditSettings.MaxLifeTime)
|
if (wrapper.settings.LoginHistoryLifeTime <= 0 || wrapper.settings.LoginHistoryLifeTime > TenantAuditSettings.MaxLifeTime)
|
||||||
throw new ArgumentException("LoginHistoryLifeTime");
|
throw new ArgumentException("LoginHistoryLifeTime");
|
||||||
|
|
||||||
if (settings.AuditTrailLifeTime <= 0 || settings.AuditTrailLifeTime > TenantAuditSettings.MaxLifeTime)
|
if (wrapper.settings.AuditTrailLifeTime <= 0 || wrapper.settings.AuditTrailLifeTime > TenantAuditSettings.MaxLifeTime)
|
||||||
throw new ArgumentException("AuditTrailLifeTime");
|
throw new ArgumentException("AuditTrailLifeTime");
|
||||||
|
|
||||||
SettingsManager.SaveForTenant(settings, TenantManager.GetCurrentTenant().TenantId);
|
SettingsManager.SaveForTenant(wrapper.settings, TenantManager.GetCurrentTenant().TenantId);
|
||||||
MessageService.Send(MessageAction.AuditSettingsUpdated);
|
MessageService.Send(MessageAction.AuditSettingsUpdated);
|
||||||
|
|
||||||
return settings;
|
return wrapper.settings;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,6 +36,8 @@ using System.ServiceModel.Security;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
|
|
||||||
|
using ARSoft.Tools.Net.Dns;
|
||||||
|
|
||||||
using ASC.Api.Collections;
|
using ASC.Api.Collections;
|
||||||
using ASC.Api.Core;
|
using ASC.Api.Core;
|
||||||
using ASC.Api.Utils;
|
using ASC.Api.Utils;
|
||||||
@ -51,6 +53,7 @@ using ASC.Core.Common.Notify;
|
|||||||
using ASC.Core.Common.Settings;
|
using ASC.Core.Common.Settings;
|
||||||
using ASC.Core.Tenants;
|
using ASC.Core.Tenants;
|
||||||
using ASC.Core.Users;
|
using ASC.Core.Users;
|
||||||
|
using ASC.Data.Backup;
|
||||||
using ASC.Data.Backup.Contracts;
|
using ASC.Data.Backup.Contracts;
|
||||||
using ASC.Data.Backup.Service;
|
using ASC.Data.Backup.Service;
|
||||||
using ASC.Data.Storage;
|
using ASC.Data.Storage;
|
||||||
@ -166,6 +169,7 @@ namespace ASC.Api.Settings
|
|||||||
private PasswordHasher PasswordHasher { get; }
|
private PasswordHasher PasswordHasher { get; }
|
||||||
private ILog Log { get; set; }
|
private ILog Log { get; set; }
|
||||||
private TelegramHelper TelegramHelper { get; }
|
private TelegramHelper TelegramHelper { get; }
|
||||||
|
private BackupAjaxHandler BackupAjaxHandler { get; }
|
||||||
|
|
||||||
public SettingsController(
|
public SettingsController(
|
||||||
IOptionsMonitor<ILog> option,
|
IOptionsMonitor<ILog> option,
|
||||||
@ -227,7 +231,8 @@ namespace ASC.Api.Settings
|
|||||||
BackupServiceNotifier backupServiceNotifier,
|
BackupServiceNotifier backupServiceNotifier,
|
||||||
ICacheNotify<DeleteSchedule> cacheDeleteSchedule,
|
ICacheNotify<DeleteSchedule> cacheDeleteSchedule,
|
||||||
EncryptionServiceNotifier encryptionServiceNotifier,
|
EncryptionServiceNotifier encryptionServiceNotifier,
|
||||||
PasswordHasher passwordHasher)
|
PasswordHasher passwordHasher,
|
||||||
|
BackupAjaxHandler backupAjaxHandler)
|
||||||
{
|
{
|
||||||
Log = option.Get("ASC.Api");
|
Log = option.Get("ASC.Api");
|
||||||
WebHostEnvironment = webHostEnvironment;
|
WebHostEnvironment = webHostEnvironment;
|
||||||
@ -289,6 +294,7 @@ namespace ASC.Api.Settings
|
|||||||
StorageFactory = storageFactory;
|
StorageFactory = storageFactory;
|
||||||
UrlShortener = urlShortener;
|
UrlShortener = urlShortener;
|
||||||
TelegramHelper = telegramHelper;
|
TelegramHelper = telegramHelper;
|
||||||
|
BackupAjaxHandler = backupAjaxHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Read("", Check = false)]
|
[Read("", Check = false)]
|
||||||
@ -345,7 +351,7 @@ namespace ASC.Api.Settings
|
|||||||
|
|
||||||
MessageService.Send(MessageAction.AdministratorMessageSettingsUpdated);
|
MessageService.Send(MessageAction.AdministratorMessageSettingsUpdated);
|
||||||
|
|
||||||
return Resource.SuccessfullySaveSettingsMessage;
|
return Resource.SuccessfullySaveSettingsMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
@ -440,23 +446,23 @@ namespace ASC.Api.Settings
|
|||||||
switch (Tenant.TrustedDomainsType)
|
switch (Tenant.TrustedDomainsType)
|
||||||
{
|
{
|
||||||
case TenantTrustedDomainsType.Custom:
|
case TenantTrustedDomainsType.Custom:
|
||||||
{
|
{
|
||||||
var address = new MailAddress(email);
|
var address = new MailAddress(email);
|
||||||
if (Tenant.TrustedDomains.Any(d => address.Address.EndsWith("@" + d, StringComparison.InvariantCultureIgnoreCase)))
|
if (Tenant.TrustedDomains.Any(d => address.Address.EndsWith("@" + d, StringComparison.InvariantCultureIgnoreCase)))
|
||||||
{
|
|
||||||
StudioNotifyService.SendJoinMsg(email, emplType);
|
|
||||||
MessageService.Send(MessageInitiator.System, MessageAction.SentInviteInstructions, email);
|
|
||||||
return Resource.FinishInviteJoinEmailMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new Exception(Resource.ErrorEmailDomainNotAllowed);
|
|
||||||
}
|
|
||||||
case TenantTrustedDomainsType.All:
|
|
||||||
{
|
{
|
||||||
StudioNotifyService.SendJoinMsg(email, emplType);
|
StudioNotifyService.SendJoinMsg(email, emplType);
|
||||||
MessageService.Send(MessageInitiator.System, MessageAction.SentInviteInstructions, email);
|
MessageService.Send(MessageInitiator.System, MessageAction.SentInviteInstructions, email);
|
||||||
return Resource.FinishInviteJoinEmailMessage ;
|
return Resource.FinishInviteJoinEmailMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
throw new Exception(Resource.ErrorEmailDomainNotAllowed);
|
||||||
|
}
|
||||||
|
case TenantTrustedDomainsType.All:
|
||||||
|
{
|
||||||
|
StudioNotifyService.SendJoinMsg(email, emplType);
|
||||||
|
MessageService.Send(MessageInitiator.System, MessageAction.SentInviteInstructions, email);
|
||||||
|
return Resource.FinishInviteJoinEmailMessage;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
throw new Exception(Resource.ErrorNotCorrectEmail);
|
throw new Exception(Resource.ErrorNotCorrectEmail);
|
||||||
}
|
}
|
||||||
@ -885,7 +891,7 @@ namespace ASC.Api.Settings
|
|||||||
|
|
||||||
///<visible>false</visible>
|
///<visible>false</visible>
|
||||||
[Create("whitelabel/save")]
|
[Create("whitelabel/save")]
|
||||||
public void SaveWhiteLabelSettings(WhiteLabelModel model)
|
public bool SaveWhiteLabelSettings([FromBody] WhiteLabelModel model, [FromQuery] WhiteLabelQuery query)
|
||||||
{
|
{
|
||||||
PermissionContext.DemandPermissions(SecutiryConstants.EditPortalSettings);
|
PermissionContext.DemandPermissions(SecutiryConstants.EditPortalSettings);
|
||||||
|
|
||||||
@ -894,7 +900,7 @@ namespace ASC.Api.Settings
|
|||||||
throw new BillingException(Resource.ErrorNotAllowedOption, "WhiteLabel");
|
throw new BillingException(Resource.ErrorNotAllowedOption, "WhiteLabel");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.IsDefault)
|
if (query.IsDefault)
|
||||||
{
|
{
|
||||||
DemandRebrandingPermission();
|
DemandRebrandingPermission();
|
||||||
SaveWhiteLabelSettingsForDefaultTenant(model);
|
SaveWhiteLabelSettingsForDefaultTenant(model);
|
||||||
@ -903,6 +909,7 @@ namespace ASC.Api.Settings
|
|||||||
{
|
{
|
||||||
SaveWhiteLabelSettingsForCurrentTenant(model);
|
SaveWhiteLabelSettingsForCurrentTenant(model);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveWhiteLabelSettingsForCurrentTenant(WhiteLabelModel model)
|
private void SaveWhiteLabelSettingsForCurrentTenant(WhiteLabelModel model)
|
||||||
@ -925,7 +932,7 @@ namespace ASC.Api.Settings
|
|||||||
if (model.Logo != null)
|
if (model.Logo != null)
|
||||||
{
|
{
|
||||||
var logoDict = new Dictionary<int, string>();
|
var logoDict = new Dictionary<int, string>();
|
||||||
model.Logo.ToList().ForEach(n => logoDict.Add(n.Key, n.Value));
|
model.Logo.ToList().ForEach(n => logoDict.Add(Int32.Parse(n.Key), n.Value));
|
||||||
|
|
||||||
TenantWhiteLabelSettingsHelper.SetLogo(settings, logoDict, storage);
|
TenantWhiteLabelSettingsHelper.SetLogo(settings, logoDict, storage);
|
||||||
}
|
}
|
||||||
@ -938,7 +945,7 @@ namespace ASC.Api.Settings
|
|||||||
|
|
||||||
///<visible>false</visible>
|
///<visible>false</visible>
|
||||||
[Create("whitelabel/savefromfiles")]
|
[Create("whitelabel/savefromfiles")]
|
||||||
public void SaveWhiteLabelSettingsFromFiles(WhiteLabelModel model)
|
public bool SaveWhiteLabelSettingsFromFiles([FromQuery] WhiteLabelQuery query)
|
||||||
{
|
{
|
||||||
PermissionContext.DemandPermissions(SecutiryConstants.EditPortalSettings);
|
PermissionContext.DemandPermissions(SecutiryConstants.EditPortalSettings);
|
||||||
|
|
||||||
@ -947,40 +954,41 @@ namespace ASC.Api.Settings
|
|||||||
throw new BillingException(Resource.ErrorNotAllowedOption, "WhiteLabel");
|
throw new BillingException(Resource.ErrorNotAllowedOption, "WhiteLabel");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.Attachments == null || !model.Attachments.Any())
|
if (HttpContext.Request.Form?.Files == null || !HttpContext.Request.Form.Files.Any())
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("No input files");
|
throw new InvalidOperationException("No input files");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.IsDefault)
|
if (query.IsDefault)
|
||||||
{
|
{
|
||||||
DemandRebrandingPermission();
|
DemandRebrandingPermission();
|
||||||
SaveWhiteLabelSettingsFromFilesForDefaultTenant(model);
|
SaveWhiteLabelSettingsFromFilesForDefaultTenant();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SaveWhiteLabelSettingsFromFilesForCurrentTenant(model);
|
SaveWhiteLabelSettingsFromFilesForCurrentTenant();
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveWhiteLabelSettingsFromFilesForCurrentTenant(WhiteLabelModel model)
|
private void SaveWhiteLabelSettingsFromFilesForCurrentTenant()
|
||||||
{
|
{
|
||||||
var settings = SettingsManager.Load<TenantWhiteLabelSettings>();
|
var settings = SettingsManager.Load<TenantWhiteLabelSettings>();
|
||||||
|
|
||||||
SaveWhiteLabelSettingsFromFilesForTenant(settings, null, Tenant.TenantId, model);
|
SaveWhiteLabelSettingsFromFilesForTenant(settings, null, Tenant.TenantId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveWhiteLabelSettingsFromFilesForDefaultTenant(WhiteLabelModel model)
|
private void SaveWhiteLabelSettingsFromFilesForDefaultTenant()
|
||||||
{
|
{
|
||||||
var settings = SettingsManager.LoadForDefaultTenant<TenantWhiteLabelSettings>();
|
var settings = SettingsManager.LoadForDefaultTenant<TenantWhiteLabelSettings>();
|
||||||
var storage = StorageFactory.GetStorage(string.Empty, "static_partnerdata");
|
var storage = StorageFactory.GetStorage(string.Empty, "static_partnerdata");
|
||||||
|
|
||||||
SaveWhiteLabelSettingsFromFilesForTenant(settings, storage, Tenant.DEFAULT_TENANT, model);
|
SaveWhiteLabelSettingsFromFilesForTenant(settings, storage, Tenant.DEFAULT_TENANT);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveWhiteLabelSettingsFromFilesForTenant(TenantWhiteLabelSettings settings, IDataStore storage, int tenantId, WhiteLabelModel model)
|
private void SaveWhiteLabelSettingsFromFilesForTenant(TenantWhiteLabelSettings settings, IDataStore storage, int tenantId)
|
||||||
{
|
{
|
||||||
foreach (var f in model.Attachments)
|
foreach (var f in HttpContext.Request.Form.Files)
|
||||||
{
|
{
|
||||||
var parts = f.FileName.Split('.');
|
var parts = f.FileName.Split('.');
|
||||||
var logoType = (WhiteLabelLogoTypeEnum)(Convert.ToInt32(parts[0]));
|
var logoType = (WhiteLabelLogoTypeEnum)(Convert.ToInt32(parts[0]));
|
||||||
@ -1017,7 +1025,7 @@ namespace ASC.Api.Settings
|
|||||||
|
|
||||||
///<visible>false</visible>
|
///<visible>false</visible>
|
||||||
[Read("whitelabel/logos")]
|
[Read("whitelabel/logos")]
|
||||||
public Dictionary<int, string> GetWhiteLabelLogos(WhiteLabelModel model)
|
public Dictionary<string, string> GetWhiteLabelLogos([FromQuery] WhiteLabelQuery query)
|
||||||
{
|
{
|
||||||
PermissionContext.DemandPermissions(SecutiryConstants.EditPortalSettings);
|
PermissionContext.DemandPermissions(SecutiryConstants.EditPortalSettings);
|
||||||
|
|
||||||
@ -1026,30 +1034,30 @@ namespace ASC.Api.Settings
|
|||||||
throw new BillingException(Resource.ErrorNotAllowedOption, "WhiteLabel");
|
throw new BillingException(Resource.ErrorNotAllowedOption, "WhiteLabel");
|
||||||
}
|
}
|
||||||
|
|
||||||
Dictionary<int, string> result;
|
Dictionary<string, string> result;
|
||||||
|
|
||||||
if (model.IsDefault)
|
if (query.IsDefault)
|
||||||
{
|
{
|
||||||
DemandRebrandingPermission();
|
DemandRebrandingPermission();
|
||||||
|
|
||||||
result = new Dictionary<int, string>
|
result = new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
{ (int)WhiteLabelLogoTypeEnum.LightSmall, CommonLinkUtility.GetFullAbsolutePath(TenantWhiteLabelSettingsHelper.GetAbsoluteDefaultLogoPath(WhiteLabelLogoTypeEnum.LightSmall, !model.IsRetina)) },
|
{ ((int)WhiteLabelLogoTypeEnum.LightSmall).ToString(), CommonLinkUtility.GetFullAbsolutePath(TenantWhiteLabelSettingsHelper.GetAbsoluteDefaultLogoPath(WhiteLabelLogoTypeEnum.LightSmall, !query.IsRetina)) },
|
||||||
{ (int)WhiteLabelLogoTypeEnum.Dark, CommonLinkUtility.GetFullAbsolutePath(TenantWhiteLabelSettingsHelper.GetAbsoluteDefaultLogoPath(WhiteLabelLogoTypeEnum.Dark, !model.IsRetina)) },
|
{ ((int)WhiteLabelLogoTypeEnum.Dark).ToString(), CommonLinkUtility.GetFullAbsolutePath(TenantWhiteLabelSettingsHelper.GetAbsoluteDefaultLogoPath(WhiteLabelLogoTypeEnum.Dark, !query.IsRetina)) },
|
||||||
{ (int)WhiteLabelLogoTypeEnum.Favicon, CommonLinkUtility.GetFullAbsolutePath(TenantWhiteLabelSettingsHelper.GetAbsoluteDefaultLogoPath(WhiteLabelLogoTypeEnum.Favicon, !model.IsRetina)) },
|
{ ((int)WhiteLabelLogoTypeEnum.Favicon).ToString(), CommonLinkUtility.GetFullAbsolutePath(TenantWhiteLabelSettingsHelper.GetAbsoluteDefaultLogoPath(WhiteLabelLogoTypeEnum.Favicon, !query.IsRetina)) },
|
||||||
{ (int)WhiteLabelLogoTypeEnum.DocsEditor, CommonLinkUtility.GetFullAbsolutePath(TenantWhiteLabelSettingsHelper.GetAbsoluteDefaultLogoPath(WhiteLabelLogoTypeEnum.DocsEditor, !model.IsRetina)) }
|
{ ((int)WhiteLabelLogoTypeEnum.DocsEditor).ToString(), CommonLinkUtility.GetFullAbsolutePath(TenantWhiteLabelSettingsHelper.GetAbsoluteDefaultLogoPath(WhiteLabelLogoTypeEnum.DocsEditor, !query.IsRetina)) }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var _tenantWhiteLabelSettings = SettingsManager.Load<TenantWhiteLabelSettings>();
|
var _tenantWhiteLabelSettings = SettingsManager.Load<TenantWhiteLabelSettings>();
|
||||||
|
|
||||||
result = new Dictionary<int, string>
|
result = new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
{ (int)WhiteLabelLogoTypeEnum.LightSmall, CommonLinkUtility.GetFullAbsolutePath(TenantWhiteLabelSettingsHelper.GetAbsoluteLogoPath(_tenantWhiteLabelSettings, WhiteLabelLogoTypeEnum.LightSmall, !model.IsRetina)) },
|
{ ((int)WhiteLabelLogoTypeEnum.LightSmall).ToString(), CommonLinkUtility.GetFullAbsolutePath(TenantWhiteLabelSettingsHelper.GetAbsoluteLogoPath(_tenantWhiteLabelSettings, WhiteLabelLogoTypeEnum.LightSmall, !query.IsRetina)) },
|
||||||
{ (int)WhiteLabelLogoTypeEnum.Dark, CommonLinkUtility.GetFullAbsolutePath(TenantWhiteLabelSettingsHelper.GetAbsoluteLogoPath(_tenantWhiteLabelSettings, WhiteLabelLogoTypeEnum.Dark, !model.IsRetina)) },
|
{ ((int)WhiteLabelLogoTypeEnum.Dark).ToString(), CommonLinkUtility.GetFullAbsolutePath(TenantWhiteLabelSettingsHelper.GetAbsoluteLogoPath(_tenantWhiteLabelSettings, WhiteLabelLogoTypeEnum.Dark, !query.IsRetina)) },
|
||||||
{ (int)WhiteLabelLogoTypeEnum.Favicon, CommonLinkUtility.GetFullAbsolutePath(TenantWhiteLabelSettingsHelper.GetAbsoluteLogoPath(_tenantWhiteLabelSettings, WhiteLabelLogoTypeEnum.Favicon, !model.IsRetina)) },
|
{ ((int)WhiteLabelLogoTypeEnum.Favicon).ToString(), CommonLinkUtility.GetFullAbsolutePath(TenantWhiteLabelSettingsHelper.GetAbsoluteLogoPath(_tenantWhiteLabelSettings, WhiteLabelLogoTypeEnum.Favicon, !query.IsRetina)) },
|
||||||
{ (int)WhiteLabelLogoTypeEnum.DocsEditor, CommonLinkUtility.GetFullAbsolutePath(TenantWhiteLabelSettingsHelper.GetAbsoluteLogoPath(_tenantWhiteLabelSettings, WhiteLabelLogoTypeEnum.DocsEditor, !model.IsRetina)) }
|
{ ((int)WhiteLabelLogoTypeEnum.DocsEditor).ToString(), CommonLinkUtility.GetFullAbsolutePath(TenantWhiteLabelSettingsHelper.GetAbsoluteLogoPath(_tenantWhiteLabelSettings, WhiteLabelLogoTypeEnum.DocsEditor, !query.IsRetina)) }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1058,7 +1066,7 @@ namespace ASC.Api.Settings
|
|||||||
|
|
||||||
///<visible>false</visible>
|
///<visible>false</visible>
|
||||||
[Read("whitelabel/logotext")]
|
[Read("whitelabel/logotext")]
|
||||||
public object GetWhiteLabelLogoText(WhiteLabelModel model)
|
public object GetWhiteLabelLogoText([FromQuery] WhiteLabelQuery query)
|
||||||
{
|
{
|
||||||
if (!TenantLogoManager.WhiteLabelEnabled)
|
if (!TenantLogoManager.WhiteLabelEnabled)
|
||||||
{
|
{
|
||||||
@ -1066,12 +1074,12 @@ namespace ASC.Api.Settings
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (model.IsDefault)
|
if (query.IsDefault)
|
||||||
{
|
{
|
||||||
DemandRebrandingPermission();
|
DemandRebrandingPermission();
|
||||||
}
|
}
|
||||||
|
|
||||||
var settings = model.IsDefault ? SettingsManager.LoadForDefaultTenant<TenantWhiteLabelSettings>() : SettingsManager.Load<TenantWhiteLabelSettings>();
|
var settings = query.IsDefault ? SettingsManager.LoadForDefaultTenant<TenantWhiteLabelSettings>() : SettingsManager.Load<TenantWhiteLabelSettings>();
|
||||||
|
|
||||||
return settings.LogoText ?? TenantWhiteLabelSettings.DefaultLogoText;
|
return settings.LogoText ?? TenantWhiteLabelSettings.DefaultLogoText;
|
||||||
}
|
}
|
||||||
@ -1079,7 +1087,7 @@ namespace ASC.Api.Settings
|
|||||||
|
|
||||||
///<visible>false</visible>
|
///<visible>false</visible>
|
||||||
[Update("whitelabel/restore")]
|
[Update("whitelabel/restore")]
|
||||||
public void RestoreWhiteLabelOptions(WhiteLabelModel model)
|
public bool RestoreWhiteLabelOptions(WhiteLabelQuery query)
|
||||||
{
|
{
|
||||||
PermissionContext.DemandPermissions(SecutiryConstants.EditPortalSettings);
|
PermissionContext.DemandPermissions(SecutiryConstants.EditPortalSettings);
|
||||||
|
|
||||||
@ -1087,7 +1095,7 @@ namespace ASC.Api.Settings
|
|||||||
{
|
{
|
||||||
throw new BillingException(Resource.ErrorNotAllowedOption, "WhiteLabel");
|
throw new BillingException(Resource.ErrorNotAllowedOption, "WhiteLabel");
|
||||||
}
|
}
|
||||||
if (model.IsDefault)
|
if (query.IsDefault)
|
||||||
{
|
{
|
||||||
DemandRebrandingPermission();
|
DemandRebrandingPermission();
|
||||||
RestoreWhiteLabelOptionsForDefaultTenant();
|
RestoreWhiteLabelOptionsForDefaultTenant();
|
||||||
@ -1096,6 +1104,7 @@ namespace ASC.Api.Settings
|
|||||||
{
|
{
|
||||||
RestoreWhiteLabelOptionsForCurrentTenant();
|
RestoreWhiteLabelOptionsForCurrentTenant();
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RestoreWhiteLabelOptionsForCurrentTenant()
|
private void RestoreWhiteLabelOptionsForCurrentTenant()
|
||||||
@ -1776,23 +1785,10 @@ namespace ASC.Api.Settings
|
|||||||
return ServiceClient.GetProgress(Tenant.TenantId);
|
return ServiceClient.GetProgress(Tenant.TenantId);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Read("encryption")]
|
|
||||||
public void StartEncryption(EncryptionSettingsModel settings)
|
|
||||||
{
|
|
||||||
var encryptionSettingsProto = new EncryptionSettingsProto
|
|
||||||
{
|
|
||||||
NotifyUsers = settings.NotifyUsers,
|
|
||||||
Password = settings.Password,
|
|
||||||
Status = settings.Status,
|
|
||||||
ServerRootPath = settings.ServerRootPath
|
|
||||||
};
|
|
||||||
EncryptionServiceClient.Start(encryptionSettingsProto);
|
|
||||||
}
|
|
||||||
|
|
||||||
public readonly object Locker = new object();
|
public readonly object Locker = new object();
|
||||||
|
|
||||||
[Create("encryption/start")]
|
[Create("encryption/start")]
|
||||||
public void StartStorageEncryption(StorageEncryptionModel storageEncryption)
|
public bool StartStorageEncryption(StorageEncryptionModel storageEncryption)
|
||||||
{
|
{
|
||||||
lock (Locker)
|
lock (Locker)
|
||||||
{
|
{
|
||||||
@ -1803,6 +1799,7 @@ namespace ASC.Api.Settings
|
|||||||
StartEncryption(storageEncryption.NotifyUsers);
|
StartEncryption(storageEncryption.NotifyUsers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void StartEncryption(bool notifyUsers)
|
private void StartEncryption(bool notifyUsers)
|
||||||
@ -2079,29 +2076,29 @@ namespace ASC.Api.Settings
|
|||||||
StorageSettingsHelper.Clear(SettingsManager.Load<CdnStorageSettings>());
|
StorageSettingsHelper.Clear(SettingsManager.Load<CdnStorageSettings>());
|
||||||
}
|
}
|
||||||
|
|
||||||
//[Read("storage/backup")]
|
[Read("storage/backup")]
|
||||||
//public List<StorageWrapper> GetAllBackupStorages()
|
public List<StorageWrapper> GetAllBackupStorages()
|
||||||
//{
|
{
|
||||||
// PermissionContext.DemandPermissions(Tenant, SecutiryConstants.EditPortalSettings);
|
PermissionContext.DemandPermissions(SecutiryConstants.EditPortalSettings);
|
||||||
//if (CoreContext.Configuration.Standalone)
|
if (CoreBaseSettings.Standalone)
|
||||||
//{
|
{
|
||||||
// TenantExtra.DemandControlPanelPermission();
|
TenantExtra.DemandControlPanelPermission();
|
||||||
//}
|
}
|
||||||
// var schedule = new BackupAjaxHandler().GetSchedule();
|
var schedule = BackupAjaxHandler.GetSchedule();
|
||||||
// var current = new StorageSettings();
|
var current = new StorageSettings();
|
||||||
|
|
||||||
// if (schedule != null && schedule.StorageType == Contracts.BackupStorageType.ThirdPartyConsumer)
|
if (schedule != null && schedule.StorageType == BackupStorageType.ThirdPartyConsumer)
|
||||||
// {
|
{
|
||||||
// current = new StorageSettings
|
current = new StorageSettings
|
||||||
// {
|
{
|
||||||
// Module = schedule.StorageParams["module"],
|
Module = schedule.StorageParams["module"],
|
||||||
// Props = schedule.StorageParams.Where(r => r.Key != "module").ToDictionary(r => r.Key, r => r.Value)
|
Props = schedule.StorageParams.Where(r => r.Key != "module").ToDictionary(r => r.Key, r => r.Value)
|
||||||
// };
|
};
|
||||||
// }
|
}
|
||||||
|
|
||||||
// var consumers = ConsumerFactory.GetAll<DataStoreConsumer>().ToList();
|
var consumers = ConsumerFactory.GetAll<DataStoreConsumer>().ToList();
|
||||||
// return consumers.Select(consumer => new StorageWrapper(consumer, current)).ToList();
|
return consumers.Select(consumer => new StorageWrapper(consumer, current)).ToList();
|
||||||
//}
|
}
|
||||||
|
|
||||||
private void StartMigrate(StorageSettings settings)
|
private void StartMigrate(StorageSettings settings)
|
||||||
{
|
{
|
||||||
@ -2135,15 +2132,16 @@ namespace ASC.Api.Settings
|
|||||||
|
|
||||||
///<visible>false</visible>
|
///<visible>false</visible>
|
||||||
[Create("rebranding/company")]
|
[Create("rebranding/company")]
|
||||||
public void SaveCompanyWhiteLabelSettings(CompanyWhiteLabelSettings settings)
|
public bool SaveCompanyWhiteLabelSettings(CompanyWhiteLabelSettingsWrapper companyWhiteLabelSettingsWrapper)
|
||||||
{
|
{
|
||||||
if (settings == null) throw new ArgumentNullException("settings");
|
if (companyWhiteLabelSettingsWrapper.Settings == null) throw new ArgumentNullException("settings");
|
||||||
|
|
||||||
DemandRebrandingPermission();
|
DemandRebrandingPermission();
|
||||||
|
|
||||||
settings.IsLicensorSetting = false; //TODO: CoreContext.TenantManager.GetTenantQuota(TenantProvider.CurrentTenantID).Branding && settings.IsLicensor
|
companyWhiteLabelSettingsWrapper.Settings.IsLicensorSetting = false; //TODO: CoreContext.TenantManager.GetTenantQuota(TenantProvider.CurrentTenantID).Branding && settings.IsLicensor
|
||||||
|
|
||||||
SettingsManager.SaveForDefaultTenant(settings);
|
SettingsManager.SaveForDefaultTenant(companyWhiteLabelSettingsWrapper.Settings);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
///<visible>false</visible>
|
///<visible>false</visible>
|
||||||
@ -2168,13 +2166,14 @@ namespace ASC.Api.Settings
|
|||||||
|
|
||||||
///<visible>false</visible>
|
///<visible>false</visible>
|
||||||
[Create("rebranding/additional")]
|
[Create("rebranding/additional")]
|
||||||
public void SaveAdditionalWhiteLabelSettings(AdditionalWhiteLabelSettings settings)
|
public bool SaveAdditionalWhiteLabelSettings(AdditionalWhiteLabelSettingsWrapper wrapper)
|
||||||
{
|
{
|
||||||
if (settings == null) throw new ArgumentNullException("settings");
|
if (wrapper.Settings == null) throw new ArgumentNullException("settings");
|
||||||
|
|
||||||
DemandRebrandingPermission();
|
DemandRebrandingPermission();
|
||||||
|
|
||||||
SettingsManager.SaveForDefaultTenant(settings);
|
SettingsManager.SaveForDefaultTenant(wrapper.Settings);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
///<visible>false</visible>
|
///<visible>false</visible>
|
||||||
@ -2199,18 +2198,19 @@ namespace ASC.Api.Settings
|
|||||||
|
|
||||||
///<visible>false</visible>
|
///<visible>false</visible>
|
||||||
[Create("rebranding/mail")]
|
[Create("rebranding/mail")]
|
||||||
public void SaveMailWhiteLabelSettings(MailWhiteLabelSettings settings)
|
public bool SaveMailWhiteLabelSettings(MailWhiteLabelSettings settings)
|
||||||
{
|
{
|
||||||
if (settings == null) throw new ArgumentNullException("settings");
|
if (settings == null) throw new ArgumentNullException("settings");
|
||||||
|
|
||||||
DemandRebrandingPermission();
|
DemandRebrandingPermission();
|
||||||
|
|
||||||
SettingsManager.SaveForDefaultTenant(settings);
|
SettingsManager.SaveForDefaultTenant(settings);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
///<visible>false</visible>
|
///<visible>false</visible>
|
||||||
[Update("rebranding/mail")]
|
[Update("rebranding/mail")]
|
||||||
public void UpdateMailWhiteLabelSettings(bool footerEnabled)
|
public bool UpdateMailWhiteLabelSettings(bool footerEnabled)
|
||||||
{
|
{
|
||||||
DemandRebrandingPermission();
|
DemandRebrandingPermission();
|
||||||
|
|
||||||
@ -2219,6 +2219,8 @@ namespace ASC.Api.Settings
|
|||||||
settings.FooterEnabled = footerEnabled;
|
settings.FooterEnabled = footerEnabled;
|
||||||
|
|
||||||
SettingsManager.SaveForDefaultTenant(settings);
|
SettingsManager.SaveForDefaultTenant(settings);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
///<visible>false</visible>
|
///<visible>false</visible>
|
||||||
@ -2460,7 +2462,8 @@ namespace ASC.Api.Settings
|
|||||||
.AddEncryptionServiceNotifierService()
|
.AddEncryptionServiceNotifierService()
|
||||||
.AddTelegramLoginProviderService()
|
.AddTelegramLoginProviderService()
|
||||||
.AddTelegramHelperSerivce()
|
.AddTelegramHelperSerivce()
|
||||||
.AddPasswordHasherService();
|
.AddPasswordHasherService()
|
||||||
|
.AddBackupAjaxHandler();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,10 +1,4 @@
|
|||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Http;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
|
|
||||||
namespace ASC.Web.Api.Models
|
namespace ASC.Web.Api.Models
|
||||||
{
|
{
|
||||||
|
@ -8,9 +8,12 @@ namespace ASC.Web.Api.Models
|
|||||||
{
|
{
|
||||||
public class WhiteLabelModel
|
public class WhiteLabelModel
|
||||||
{
|
{
|
||||||
public IEnumerable<IFormFile> Attachments { get; set; }
|
|
||||||
public string LogoText { get; set; }
|
public string LogoText { get; set; }
|
||||||
public IEnumerable<ItemKeyValuePair<int, string>> Logo { get; set; }
|
public IEnumerable<ItemKeyValuePair<string, string>> Logo { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class WhiteLabelQuery
|
||||||
|
{
|
||||||
public bool IsDefault { get; set; }
|
public bool IsDefault { get; set; }
|
||||||
public bool IsRetina { get; set; }
|
public bool IsRetina { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
|
using Autofac.Extensions.DependencyInjection;
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
@ -18,6 +20,7 @@ namespace ASC.Web.Api
|
|||||||
public static IHostBuilder CreateHostBuilder(string[] args)
|
public static IHostBuilder CreateHostBuilder(string[] args)
|
||||||
{
|
{
|
||||||
return Host.CreateDefaultBuilder(args)
|
return Host.CreateDefaultBuilder(args)
|
||||||
|
.UseServiceProviderFactory(new AutofacServiceProviderFactory())
|
||||||
.ConfigureWebHostDefaults(webBuilder =>
|
.ConfigureWebHostDefaults(webBuilder =>
|
||||||
{
|
{
|
||||||
webBuilder.UseStartup<Startup>();
|
webBuilder.UseStartup<Startup>();
|
||||||
|
@ -3,9 +3,9 @@ using ASC.Api.Core;
|
|||||||
using ASC.Api.Settings;
|
using ASC.Api.Settings;
|
||||||
using ASC.Common;
|
using ASC.Common;
|
||||||
using ASC.Common.DependencyInjection;
|
using ASC.Common.DependencyInjection;
|
||||||
using ASC.Web.Api.Controllers;
|
using ASC.Web.Api.Controllers;
|
||||||
|
|
||||||
using Autofac.Extensions.DependencyInjection;
|
using Autofac;
|
||||||
|
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
@ -27,7 +27,9 @@ namespace ASC.Web.Api
|
|||||||
{
|
{
|
||||||
base.ConfigureServices(services);
|
base.ConfigureServices(services);
|
||||||
|
|
||||||
services.AddMemoryCache();
|
services.AddMemoryCache();
|
||||||
|
|
||||||
|
services.AddOptions();
|
||||||
|
|
||||||
DIHelper
|
DIHelper
|
||||||
.AddAuthenticationController()
|
.AddAuthenticationController()
|
||||||
@ -35,10 +37,12 @@ namespace ASC.Web.Api
|
|||||||
.AddPortalController()
|
.AddPortalController()
|
||||||
.AddSettingsController()
|
.AddSettingsController()
|
||||||
.AddSecurityController()
|
.AddSecurityController()
|
||||||
.AddSmtpSettingsController();
|
.AddSmtpSettingsController();
|
||||||
|
}
|
||||||
services.AddAutofac(Configuration, HostEnvironment.ContentRootPath);
|
|
||||||
|
public void ConfigureContainer(ContainerBuilder builder)
|
||||||
|
{
|
||||||
|
builder.Register(Configuration, HostEnvironment.ContentRootPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
<meta name="mobile-web-app-capable" content="yes" />
|
<meta name="mobile-web-app-capable" content="yes" />
|
||||||
<!-- Tell iOS it's a PWA -->
|
<!-- Tell iOS it's a PWA -->
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||||
<link rel="apple-touch-icon" href="icon.png" />
|
<link rel="apple-touch-icon" href="appIcon.png" />
|
||||||
<link
|
<link
|
||||||
href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i"
|
href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i"
|
||||||
rel="stylesheet"
|
rel="stylesheet"
|
||||||
|
@ -35,7 +35,6 @@ using ASC.Common;
|
|||||||
using ASC.Common.Logging;
|
using ASC.Common.Logging;
|
||||||
using ASC.Common.Notify.Engine;
|
using ASC.Common.Notify.Engine;
|
||||||
using ASC.Core;
|
using ASC.Core;
|
||||||
using ASC.Core.Common;
|
|
||||||
using ASC.Core.Common.Settings;
|
using ASC.Core.Common.Settings;
|
||||||
using ASC.Core.Tenants;
|
using ASC.Core.Tenants;
|
||||||
using ASC.Core.Users;
|
using ASC.Core.Users;
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
using System;
|
using System.Linq;
|
||||||
using System.Linq;
|
|
||||||
using System.Web;
|
|
||||||
|
|
||||||
using ASC.Common;
|
using ASC.Common;
|
||||||
using ASC.Common.Caching;
|
using ASC.Common.Caching;
|
||||||
@ -11,8 +9,6 @@ using ASC.Notify.Recipients;
|
|||||||
using ASC.Web.Studio.Core.Notify;
|
using ASC.Web.Studio.Core.Notify;
|
||||||
using ASC.Web.Studio.Utility;
|
using ASC.Web.Studio.Utility;
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Http;
|
|
||||||
|
|
||||||
namespace ASC.Web.Core.Notify
|
namespace ASC.Web.Core.Notify
|
||||||
{
|
{
|
||||||
public class StudioNotifyServiceHelper
|
public class StudioNotifyServiceHelper
|
||||||
|
@ -163,9 +163,18 @@ namespace ASC.Web.Core.Users
|
|||||||
|
|
||||||
public class CustomNamingPeople
|
public class CustomNamingPeople
|
||||||
{
|
{
|
||||||
|
private static object Locked;
|
||||||
private static bool loaded = false;
|
private static bool loaded = false;
|
||||||
|
|
||||||
private static readonly List<PeopleNamesItem> items = new List<PeopleNamesItem>();
|
private static readonly List<PeopleNamesItem> items = new List<PeopleNamesItem>();
|
||||||
|
private SettingsManager SettingsManager { get; }
|
||||||
|
|
||||||
|
static CustomNamingPeople()
|
||||||
|
{
|
||||||
|
Locked = new object();
|
||||||
|
loaded = false;
|
||||||
|
items = new List<PeopleNamesItem>();
|
||||||
|
}
|
||||||
|
|
||||||
public CustomNamingPeople(SettingsManager settingsManager)
|
public CustomNamingPeople(SettingsManager settingsManager)
|
||||||
{
|
{
|
||||||
@ -183,9 +192,6 @@ namespace ASC.Web.Core.Users
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public PeopleNamesSettings PeopleNamesSettings { get; }
|
|
||||||
private SettingsManager SettingsManager { get; }
|
|
||||||
|
|
||||||
public string Substitute<T>(string resourceKey) where T : class
|
public string Substitute<T>(string resourceKey) where T : class
|
||||||
{
|
{
|
||||||
var text = (string)typeof(T).GetProperty(resourceKey, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).GetValue(null, null);
|
var text = (string)typeof(T).GetProperty(resourceKey, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).GetValue(null, null);
|
||||||
@ -257,28 +263,36 @@ namespace ASC.Web.Core.Users
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
loaded = true;
|
lock (Locked)
|
||||||
var doc = new XmlDocument();
|
|
||||||
doc.LoadXml(NamingPeopleResource.PeopleNames);
|
|
||||||
|
|
||||||
items.Clear();
|
|
||||||
foreach (XmlNode node in doc.SelectNodes("/root/item"))
|
|
||||||
{
|
{
|
||||||
var item = new PeopleNamesItem
|
if (loaded)
|
||||||
{
|
{
|
||||||
Id = node.SelectSingleNode("id").InnerText,
|
return;
|
||||||
SchemaName = node.SelectSingleNode("names/schemaname").InnerText,
|
}
|
||||||
GroupHeadCaption = node.SelectSingleNode("names/grouphead").InnerText,
|
|
||||||
GroupCaption = node.SelectSingleNode("names/group").InnerText,
|
loaded = true;
|
||||||
GroupsCaption = node.SelectSingleNode("names/groups").InnerText,
|
var doc = new XmlDocument();
|
||||||
UserCaption = node.SelectSingleNode("names/user").InnerText,
|
doc.LoadXml(NamingPeopleResource.PeopleNames);
|
||||||
UsersCaption = node.SelectSingleNode("names/users").InnerText,
|
|
||||||
UserPostCaption = node.SelectSingleNode("names/userpost").InnerText,
|
items.Clear();
|
||||||
RegDateCaption = node.SelectSingleNode("names/regdate").InnerText,
|
foreach (XmlNode node in doc.SelectNodes("/root/item"))
|
||||||
GuestCaption = node.SelectSingleNode("names/guest").InnerText,
|
{
|
||||||
GuestsCaption = node.SelectSingleNode("names/guests").InnerText,
|
var item = new PeopleNamesItem
|
||||||
};
|
{
|
||||||
items.Add(item);
|
Id = node.SelectSingleNode("id").InnerText,
|
||||||
|
SchemaName = node.SelectSingleNode("names/schemaname").InnerText,
|
||||||
|
GroupHeadCaption = node.SelectSingleNode("names/grouphead").InnerText,
|
||||||
|
GroupCaption = node.SelectSingleNode("names/group").InnerText,
|
||||||
|
GroupsCaption = node.SelectSingleNode("names/groups").InnerText,
|
||||||
|
UserCaption = node.SelectSingleNode("names/user").InnerText,
|
||||||
|
UsersCaption = node.SelectSingleNode("names/users").InnerText,
|
||||||
|
UserPostCaption = node.SelectSingleNode("names/userpost").InnerText,
|
||||||
|
RegDateCaption = node.SelectSingleNode("names/regdate").InnerText,
|
||||||
|
GuestCaption = node.SelectSingleNode("names/guest").InnerText,
|
||||||
|
GuestsCaption = node.SelectSingleNode("names/guests").InnerText,
|
||||||
|
};
|
||||||
|
items.Add(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ namespace ASC.Web.Core
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public WebItemManager(IContainer container, IConfiguration configuration, IOptionsMonitor<ILog> options)
|
public WebItemManager(ILifetimeScope container, IConfiguration configuration, IOptionsMonitor<ILog> options)
|
||||||
{
|
{
|
||||||
Container = container;
|
Container = container;
|
||||||
Configuration = configuration;
|
Configuration = configuration;
|
||||||
@ -126,13 +126,6 @@ namespace ASC.Web.Core
|
|||||||
LoadItems();
|
LoadItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
public WebItemManager(ILifetimeScope container, IConfiguration configuration, IOptionsMonitor<ILog> options)
|
|
||||||
: this(null, configuration, options)
|
|
||||||
{
|
|
||||||
Container = container;
|
|
||||||
LoadItems();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LoadItems()
|
public void LoadItems()
|
||||||
{
|
{
|
||||||
if (Container == null) return;
|
if (Container == null) return;
|
||||||
|
@ -35,6 +35,11 @@ using Microsoft.Extensions.DependencyInjection;
|
|||||||
|
|
||||||
namespace ASC.Web.Core.WhiteLabel
|
namespace ASC.Web.Core.WhiteLabel
|
||||||
{
|
{
|
||||||
|
public class AdditionalWhiteLabelSettingsWrapper
|
||||||
|
{
|
||||||
|
public AdditionalWhiteLabelSettings Settings { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class AdditionalWhiteLabelSettings : ISettings
|
public class AdditionalWhiteLabelSettings : ISettings
|
||||||
{
|
{
|
||||||
|
@ -34,7 +34,12 @@ using Microsoft.Extensions.DependencyInjection;
|
|||||||
|
|
||||||
|
|
||||||
namespace ASC.Web.Core.WhiteLabel
|
namespace ASC.Web.Core.WhiteLabel
|
||||||
{
|
{
|
||||||
|
public class CompanyWhiteLabelSettingsWrapper
|
||||||
|
{
|
||||||
|
public CompanyWhiteLabelSettings Settings { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class CompanyWhiteLabelSettings : ISettings
|
public class CompanyWhiteLabelSettings : ISettings
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
|
using Autofac.Extensions.DependencyInjection;
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
@ -17,6 +19,7 @@ namespace ASC.Web.Studio
|
|||||||
public static IHostBuilder CreateWebHostBuilder(string[] args)
|
public static IHostBuilder CreateWebHostBuilder(string[] args)
|
||||||
{
|
{
|
||||||
return Host.CreateDefaultBuilder(args)
|
return Host.CreateDefaultBuilder(args)
|
||||||
|
.UseServiceProviderFactory(new AutofacServiceProviderFactory())
|
||||||
.ConfigureWebHostDefaults(w =>
|
.ConfigureWebHostDefaults(w =>
|
||||||
{
|
{
|
||||||
w.UseStartup<Startup>();
|
w.UseStartup<Startup>();
|
||||||
@ -33,7 +36,7 @@ namespace ASC.Web.Studio
|
|||||||
config
|
config
|
||||||
.AddInMemoryCollection(new Dictionary<string, string>
|
.AddInMemoryCollection(new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
{"pathToConf", path}
|
{"pathToConf", path}
|
||||||
})
|
})
|
||||||
.AddJsonFile("appsettings.json")
|
.AddJsonFile("appsettings.json")
|
||||||
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true)
|
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true)
|
||||||
|
@ -6,6 +6,8 @@ using ASC.Data.Storage.Configuration;
|
|||||||
using ASC.Data.Storage.DiscStorage;
|
using ASC.Data.Storage.DiscStorage;
|
||||||
using ASC.FederatedLogin;
|
using ASC.FederatedLogin;
|
||||||
|
|
||||||
|
using Autofac;
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.HttpOverrides;
|
using Microsoft.AspNetCore.HttpOverrides;
|
||||||
@ -37,15 +39,16 @@ namespace ASC.Web.Studio
|
|||||||
.AddStorageHandlerService()
|
.AddStorageHandlerService()
|
||||||
.AddLoginHandlerService();
|
.AddLoginHandlerService();
|
||||||
|
|
||||||
services.AddMemoryCache();
|
services.AddMemoryCache();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ConfigureContainer(ContainerBuilder builder)
|
||||||
services.AddAutofac(Configuration, HostEnvironment.ContentRootPath);
|
{
|
||||||
}
|
builder.Register(Configuration, HostEnvironment.ContentRootPath);
|
||||||
|
}
|
||||||
|
|
||||||
public override void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
public override void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||||
{
|
{
|
||||||
|
|
||||||
app.UseForwardedHeaders(new ForwardedHeadersOptions
|
app.UseForwardedHeaders(new ForwardedHeadersOptions
|
||||||
{
|
{
|
||||||
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
|
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
|
||||||
|
Loading…
Reference in New Issue
Block a user