DI: refactoring. Web.Api
This commit is contained in:
parent
402c4d908d
commit
a35a457f6e
@ -42,6 +42,8 @@ using ASC.Common.Logging;
|
||||
using ASC.Core;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace TMResourceData
|
||||
@ -356,5 +358,14 @@ namespace TMResourceData
|
||||
|
||||
return resourceValue;
|
||||
}
|
||||
}
|
||||
|
||||
public static class WhiteLabelHelperFactory
|
||||
{
|
||||
public static IServiceCollection AddWhiteLabelHelperService(this IServiceCollection services)
|
||||
{
|
||||
services.TryAddSingleton<WhiteLabelHelper>();
|
||||
return services;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ using System;
|
||||
using System.Runtime.Serialization;
|
||||
using ASC.Core.Tenants;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
|
||||
namespace ASC.Core.Common.Settings
|
||||
{
|
||||
@ -134,6 +135,12 @@ namespace ASC.Core.Common.Settings
|
||||
.AddAuthContextService()
|
||||
.AddSettingsManagerService()
|
||||
.AddTenantManagerService();
|
||||
}
|
||||
|
||||
public static IServiceCollection AddSettingsService<T>(this IServiceCollection services) where T : class, ISettings
|
||||
{
|
||||
services.TryAddScoped<T>();
|
||||
return services.AddBaseSettingsService();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ using ASC.Common.Logging;
|
||||
using ASC.Common.Utils;
|
||||
using ASC.Common.Web;
|
||||
using ASC.Core;
|
||||
using ASC.Core.Common.Settings;
|
||||
using ASC.Core.Tenants;
|
||||
using ASC.Core.Users;
|
||||
using ASC.Data.Reassigns;
|
||||
@ -1584,7 +1585,7 @@ namespace ASC.Employee.Core.Controllers
|
||||
.AddMessageTargetService()
|
||||
.AddAccountLinkerStorageService()
|
||||
.AddFileSizeCommentService()
|
||||
.AddPasswordSettingsService()
|
||||
.AddSettingsService<PasswordSettings>()
|
||||
.AddCookiesManagerService()
|
||||
.AddUserPhotoManagerService()
|
||||
.AddCustomNamingPeopleService()
|
||||
|
@ -106,11 +106,11 @@ namespace ASC.People
|
||||
r.errorCount = 0;
|
||||
});
|
||||
|
||||
services.TryAddSingleton(typeof(ILog), typeof(LogNLog));
|
||||
|
||||
services
|
||||
.AddPeopleController()
|
||||
.AddGroupController();
|
||||
|
||||
services.TryAddSingleton(typeof(ILog), typeof(LogNLog));
|
||||
}
|
||||
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
|
@ -7,6 +7,7 @@ using ASC.Web.Api.Models;
|
||||
using ASC.Web.Api.Routing;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using static ASC.Security.Cryptography.EmailValidationKeyProvider;
|
||||
|
||||
namespace ASC.Web.Api.Controllers
|
||||
@ -115,4 +116,19 @@ namespace ASC.Web.Api.Controllers
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public static class AuthenticationControllerExtension
|
||||
{
|
||||
public static IServiceCollection AddAuthenticationController(this IServiceCollection services)
|
||||
{
|
||||
return services
|
||||
.AddUserManagerService()
|
||||
.AddTenantManagerService()
|
||||
.AddSecurityContextService()
|
||||
.AddTenantCookieSettingsService()
|
||||
.AddEmailValidationKeyProviderService()
|
||||
.AddAuthContextService()
|
||||
.AddAuthManager();
|
||||
}
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@ using ASC.Web.Api.Routing;
|
||||
using ASC.Web.Core;
|
||||
using ASC.Web.Core.WebZones;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace ASC.Web.Api.Controllers
|
||||
{
|
||||
@ -16,8 +17,8 @@ namespace ASC.Web.Api.Controllers
|
||||
public WebItemManagerSecurity WebItemManagerSecurity { get; }
|
||||
|
||||
public ModulesController(
|
||||
UserManager userManager,
|
||||
TenantManager tenantManager,
|
||||
UserManager userManager,
|
||||
TenantManager tenantManager,
|
||||
WebItemManagerSecurity webItemManagerSecurity)
|
||||
{
|
||||
UserManager = userManager;
|
||||
@ -37,5 +38,16 @@ namespace ASC.Web.Api.Controllers
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public static class ModulesControllerExtension
|
||||
{
|
||||
public static IServiceCollection AddModulesController(this IServiceCollection services)
|
||||
{
|
||||
return services
|
||||
.AddUserManagerService()
|
||||
.AddTenantManagerService()
|
||||
.AddWebItemManagerSecurity();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ using ASC.Web.Studio.Core.Notify;
|
||||
using ASC.Web.Studio.Utility;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace ASC.Web.Api.Controllers
|
||||
@ -151,4 +152,24 @@ namespace ASC.Web.Api.Controllers
|
||||
return CommonLinkUtility.GetFullAbsolutePath(virtualPath);
|
||||
}
|
||||
}
|
||||
|
||||
public static class PortalControllerFactory
|
||||
{
|
||||
public static IServiceCollection AddPortalController(this IServiceCollection services)
|
||||
{
|
||||
return services
|
||||
.AddUrlShortener()
|
||||
.AddMessageServiceService()
|
||||
.AddStudioNotifyServiceService()
|
||||
.AddApiContextService()
|
||||
.AddUserManagerService()
|
||||
.AddAuthContextService()
|
||||
.AddAuthContextService()
|
||||
.AddTenantManagerService()
|
||||
.AddEmailValidationKeyProviderService()
|
||||
.AddPaymentManagerService()
|
||||
.AddCommonLinkUtilityService()
|
||||
.AddPermissionContextService();
|
||||
}
|
||||
}
|
||||
}
|
@ -40,6 +40,7 @@ using ASC.Common.Logging;
|
||||
using ASC.Core;
|
||||
using ASC.Core.Billing;
|
||||
using ASC.Core.Common.Configuration;
|
||||
using ASC.Core.Common.Settings;
|
||||
using ASC.Core.Tenants;
|
||||
using ASC.Core.Users;
|
||||
using ASC.Data.Storage;
|
||||
@ -72,6 +73,7 @@ using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace ASC.Api.Settings
|
||||
@ -1320,4 +1322,59 @@ namespace ASC.Api.Settings
|
||||
return new { Url = hubUrl };
|
||||
}
|
||||
}
|
||||
|
||||
public static class SettingsControllerFactory
|
||||
{
|
||||
public static IServiceCollection AddSettingsController(this IServiceCollection services)
|
||||
{
|
||||
return services
|
||||
.AddMessageTargetService()
|
||||
.AddCoreConfigurationService()
|
||||
.AddIPRestrictionsService()
|
||||
.AddDisplayUserSettingsService()
|
||||
.AddSetupInfo()
|
||||
.AddCommonLinkUtilityService()
|
||||
.AddCoreBaseSettingsService()
|
||||
.AddTenantUtilService()
|
||||
.AddEmailValidationKeyProviderService()
|
||||
.AddMessageServiceService()
|
||||
.AddStudioNotifyServiceService()
|
||||
.AddApiContextService()
|
||||
.AddUserManagerService()
|
||||
.AddTenantManagerService()
|
||||
.AddTenantExtraService()
|
||||
.AddTenantStatisticsProviderService()
|
||||
.AddUserPhotoManagerService()
|
||||
.AddAuthContextService()
|
||||
.AddCookiesManagerService()
|
||||
.AddWebItemSecurity()
|
||||
.AddStudioNotifyHelperService()
|
||||
.AddLicenseReaderService()
|
||||
.AddPermissionContextService()
|
||||
.AddWebItemManager()
|
||||
.AddWebItemManagerSecurity()
|
||||
.AddCdnStorageSettingsService()
|
||||
.AddStorageSettingsService()
|
||||
.AddStorageFactoryService()
|
||||
.AddStorageFactoryConfigService()
|
||||
.AddSettingsService<TfaAppUserSettings>()
|
||||
.AddSettingsService<CollaboratorSettings>()
|
||||
.AddSettingsService<PersonalQuotaSettings>()
|
||||
.AddSettingsService<WizardSettings>()
|
||||
.AddSettingsService<CustomNavigationSettings>()
|
||||
.AddTenantInfoSettingsService()
|
||||
.AddSettingsService<PasswordSettings>()
|
||||
.AddSettingsService<StudioDefaultPageSettings>()
|
||||
.AddSettingsService<TfaAppAuthSettings>()
|
||||
.AddSettingsService<ColorThemesSettings>()
|
||||
.AddTenantWhiteLabelSettingsService()
|
||||
.AddStudioSmsNotificationSettingsService()
|
||||
.AddCompanyWhiteLabelSettingsService()
|
||||
.AddTfaManagerService()
|
||||
.AddStorageHelperService()
|
||||
.AddTenantLogoManagerService()
|
||||
.AddBuildVersionService()
|
||||
.AddStatisticManagerService();
|
||||
}
|
||||
}
|
||||
}
|
@ -40,6 +40,7 @@ using ASC.Web.Studio.Utility;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace ASC.Api.Settings
|
||||
{
|
||||
@ -246,5 +247,24 @@ namespace ASC.Api.Settings
|
||||
throw new BillingException(Resource.ErrorNotAllowedOption, "Smtp");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class SmtpSettingsControllerFactory
|
||||
{
|
||||
public static IServiceCollection AddSmtpSettingsController(this IServiceCollection services)
|
||||
{
|
||||
return services
|
||||
.AddMessageServiceService()
|
||||
.AddStudioNotifyServiceService()
|
||||
.AddApiContextService()
|
||||
.AddUserManagerService()
|
||||
.AddSecurityContextService()
|
||||
.AddPermissionContextService()
|
||||
.AddTenantManagerService()
|
||||
.AddCoreSettingsService()
|
||||
.AddCoreConfigurationService()
|
||||
.AddCoreBaseSettingsService()
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,8 @@
|
||||
|
||||
using System.Runtime.Serialization;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
|
||||
namespace ASC.Api.Settings
|
||||
{
|
||||
@ -93,5 +95,15 @@ namespace ASC.Api.Settings
|
||||
|
||||
return null;*/
|
||||
}
|
||||
}
|
||||
|
||||
public static class BuildVersionFactory
|
||||
{
|
||||
public static IServiceCollection AddBuildVersionService(this IServiceCollection services)
|
||||
{
|
||||
services.TryAddSingleton<BuildVersion>();
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,11 @@
|
||||
|
||||
using ASC.Api.Core;
|
||||
using ASC.Api.Core.Auth;
|
||||
using ASC.Api.Core.Core;
|
||||
using ASC.Api.Core.Middleware;
|
||||
using ASC.Api.Settings;
|
||||
using ASC.Common.Data;
|
||||
using ASC.Common.DependencyInjection;
|
||||
using ASC.Data.Reassigns;
|
||||
using ASC.Data.Storage.Configuration;
|
||||
using ASC.MessagingSystem;
|
||||
using ASC.Web.Core;
|
||||
using ASC.Web.Studio.Core.Notify;
|
||||
using ASC.Common.Logging;
|
||||
using ASC.Web.Api.Controllers;
|
||||
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
@ -74,14 +71,22 @@ namespace ASC.Web.Api
|
||||
|
||||
var container = services.AddAutofac(Configuration, HostEnvironment.ContentRootPath);
|
||||
|
||||
services.Configure<LogNLog>(r => r.Name = "ASC");
|
||||
services.Configure<LogNLog>("ASC", r => r.Name = "ASC");
|
||||
services.Configure<LogNLog>("ASC.Api", r => r.Name = "ASC.Api");
|
||||
|
||||
services.Configure<DbManager>(r => { });
|
||||
services.Configure<DbManager>("default", r => { });
|
||||
services.Configure<DbManager>("messages", r => { r.CommandTimeout = 180000; });
|
||||
|
||||
services.TryAddSingleton(typeof(ILog), typeof(LogNLog));
|
||||
|
||||
services
|
||||
.AddStorage()
|
||||
.AddWebItemManager();
|
||||
services.TryAddScoped<ApiContext>();
|
||||
services.TryAddScoped<StudioNotifyService>();
|
||||
services.TryAddScoped<MessageService>();
|
||||
services.TryAddScoped<QueueWorkerReassign>();
|
||||
services.TryAddScoped<QueueWorkerRemove>();
|
||||
.AddAuthenticationController()
|
||||
.AddModulesController()
|
||||
.AddPortalController()
|
||||
.AddSettingsController()
|
||||
.AddSmtpSettingsController();
|
||||
}
|
||||
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
|
@ -32,6 +32,8 @@ using ASC.Common.Logging;
|
||||
using ASC.Core;
|
||||
using ASC.Data.Storage;
|
||||
using ASC.Web.Core.Users;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace ASC.Web.Studio.UserControls.CustomNavigation
|
||||
@ -182,5 +184,17 @@ namespace ASC.Web.Studio.UserControls.CustomNavigation
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
return store.Save(fileName, stream).ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public static class StorageHelperFactory
|
||||
{
|
||||
public static IServiceCollection AddStorageHelperService(this IServiceCollection services)
|
||||
{
|
||||
services.TryAddScoped<StorageHelper>();
|
||||
return services
|
||||
.AddUserPhotoManagerService()
|
||||
.AddStorageFactoryService()
|
||||
.AddTenantManagerService();
|
||||
}
|
||||
}
|
||||
}
|
@ -30,6 +30,7 @@ using ASC.Core;
|
||||
using ASC.Core.Common.Settings;
|
||||
using ASC.Web.Core.Sms;
|
||||
using ASC.Web.Studio.Utility;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace ASC.Web.Studio.Core.SMS
|
||||
{
|
||||
@ -49,9 +50,9 @@ namespace ASC.Web.Studio.Core.SMS
|
||||
|
||||
|
||||
public StudioSmsNotificationSettings(
|
||||
AuthContext authContext,
|
||||
SettingsManager settingsManager,
|
||||
TenantManager tenantManager,
|
||||
AuthContext authContext,
|
||||
SettingsManager settingsManager,
|
||||
TenantManager tenantManager,
|
||||
TenantExtra tenantExtra,
|
||||
CoreBaseSettings coreBaseSettings,
|
||||
SetupInfo setupInfo) : base(authContext, settingsManager, tenantManager)
|
||||
@ -95,4 +96,16 @@ namespace ASC.Web.Studio.Core.SMS
|
||||
&& !quota.Open);
|
||||
}
|
||||
}
|
||||
|
||||
public static class StudioSmsNotificationSettingsFactory
|
||||
{
|
||||
public static IServiceCollection AddStudioSmsNotificationSettingsService(this IServiceCollection services)
|
||||
{
|
||||
return services
|
||||
.AddTenantExtraService()
|
||||
.AddCoreBaseSettingsService()
|
||||
.AddSetupInfo()
|
||||
.AddSettingsService<StudioSmsNotificationSettings>();
|
||||
}
|
||||
}
|
||||
}
|
@ -30,6 +30,8 @@ using System.Data;
|
||||
using ASC.Common.Data;
|
||||
using ASC.Common.Data.Sql;
|
||||
using ASC.Common.Data.Sql.Expressions;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
|
||||
namespace ASC.Web.Studio.Core.Statistic
|
||||
{
|
||||
@ -174,4 +176,14 @@ new UserVisit
|
||||
return DbManager;
|
||||
}
|
||||
}
|
||||
|
||||
public static class StatisticManagerFactory
|
||||
{
|
||||
public static IServiceCollection AddStatisticManagerService(this IServiceCollection services)
|
||||
{
|
||||
services.TryAddScoped<StatisticManager>();
|
||||
|
||||
return services.AddDbManagerService();
|
||||
}
|
||||
}
|
||||
}
|
@ -30,8 +30,9 @@ using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using ASC.Core;
|
||||
using ASC.Core.Common.Settings;
|
||||
using ASC.Web.Studio.Utility;
|
||||
|
||||
using ASC.Web.Studio.Utility;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace ASC.Web.Studio.Core.TFA
|
||||
{
|
||||
[Serializable]
|
||||
@ -137,5 +138,15 @@ namespace ASC.Web.Studio.Core.TFA
|
||||
&& !quota.Free
|
||||
&& !quota.Open);
|
||||
}
|
||||
}
|
||||
|
||||
public static class TfaAppUserSettingsFactory
|
||||
{
|
||||
public static IServiceCollection AddTfaAppUserSettingsService(this IServiceCollection services)
|
||||
{
|
||||
return services
|
||||
.AddCoreBaseSettingsService()
|
||||
.AddSettingsService<TfaAppUserSettings>();
|
||||
}
|
||||
}
|
||||
}
|
@ -35,12 +35,14 @@ using ASC.Common.Caching;
|
||||
using ASC.Common.Utils;
|
||||
using ASC.Core;
|
||||
using ASC.Core.Common.Security;
|
||||
using ASC.Core.Common.Settings;
|
||||
using ASC.Core.Users;
|
||||
using ASC.Web.Core;
|
||||
using ASC.Web.Core.PublicResources;
|
||||
using Google.Authenticator;
|
||||
|
||||
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
|
||||
namespace ASC.Web.Studio.Core.TFA
|
||||
{
|
||||
[Serializable]
|
||||
@ -187,5 +189,21 @@ namespace ASC.Web.Studio.Core.TFA
|
||||
{
|
||||
return Signature.Create(TfaAppUserSettings.GetSalt(user.ID)).Substring(0, 10);
|
||||
}
|
||||
}
|
||||
|
||||
public static class TfaManagerFactory
|
||||
{
|
||||
public static IServiceCollection AddTfaManagerService(this IServiceCollection services)
|
||||
{
|
||||
services.TryAddScoped<TfaManager>();
|
||||
|
||||
return services
|
||||
.AddSettingsService<TfaAppAuthSettings>()
|
||||
.AddTfaAppUserSettingsService()
|
||||
.AddSetupInfo()
|
||||
.AddSignatureService()
|
||||
.AddCookiesManagerService()
|
||||
.AddSecurityContextService();
|
||||
}
|
||||
}
|
||||
}
|
@ -30,6 +30,7 @@ using System.Net.Mail;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using ASC.Core;
|
||||
using ASC.Core.Common.Settings;
|
||||
using ASC.Core.Tenants;
|
||||
using ASC.Core.Users;
|
||||
using ASC.IPSecurity;
|
||||
@ -369,7 +370,7 @@ namespace ASC.Web.Core.Users
|
||||
.AddIPSecurityService()
|
||||
.AddTenantUtilService()
|
||||
.AddCustomNamingPeopleService()
|
||||
.AddPasswordSettingsService()
|
||||
.AddSettingsService<PasswordSettings>()
|
||||
.AddStudioNotifyServiceService()
|
||||
.AddUserManagerService()
|
||||
.AddSecurityContextService()
|
||||
|
@ -29,8 +29,6 @@ using System.Runtime.Serialization;
|
||||
using ASC.Core;
|
||||
using ASC.Core.Common.Settings;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
|
||||
namespace ASC.Web.Core.Utility
|
||||
{
|
||||
@ -97,14 +95,4 @@ namespace ASC.Web.Core.Utility
|
||||
return _default;
|
||||
}
|
||||
}
|
||||
|
||||
public static class PasswordSettingsFactory
|
||||
{
|
||||
public static IServiceCollection AddPasswordSettingsService(this IServiceCollection services)
|
||||
{
|
||||
services.TryAddScoped<PasswordSettings>();
|
||||
|
||||
return services.AddBaseSettingsService();
|
||||
}
|
||||
}
|
||||
}
|
@ -4,8 +4,10 @@ using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using ASC.FederatedLogin.LoginProviders;
|
||||
using ASC.Web.Studio.Utility;
|
||||
using ASC.Web.Studio.Utility;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
|
||||
namespace ASC.Web.Core.Utility
|
||||
{
|
||||
@ -97,5 +99,14 @@ namespace ASC.Web.Core.Utility
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class UrlShortenerExtension
|
||||
{
|
||||
public static IServiceCollection AddUrlShortener(this IServiceCollection services)
|
||||
{
|
||||
services.TryAddSingleton<UrlShortener>();
|
||||
return services;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ using System;
|
||||
using System.Runtime.Serialization;
|
||||
using ASC.Core;
|
||||
using ASC.Core.Common.Settings;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace ASC.Web.Core.WhiteLabel
|
||||
@ -111,5 +112,15 @@ namespace ASC.Web.Core.WhiteLabel
|
||||
}
|
||||
|
||||
public CoreSettings CoreSettings { get; }
|
||||
}
|
||||
|
||||
public static class CompanyWhiteLabelSettingsFactory
|
||||
{
|
||||
public static IServiceCollection AddCompanyWhiteLabelSettingsService(this IServiceCollection services)
|
||||
{
|
||||
return services
|
||||
.AddCoreSettingsService()
|
||||
.AddSettingsService<CompanyWhiteLabelSettings>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,8 +32,9 @@ using System.Runtime.Serialization;
|
||||
using ASC.Core;
|
||||
using ASC.Core.Common.Settings;
|
||||
using ASC.Data.Storage;
|
||||
using ASC.Web.Core.Utility.Skins;
|
||||
using ASC.Web.Core.Utility.Skins;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace ASC.Web.Core.WhiteLabel
|
||||
{
|
||||
@ -53,9 +54,9 @@ namespace ASC.Web.Core.WhiteLabel
|
||||
{
|
||||
}
|
||||
public TenantInfoSettings(
|
||||
AuthContext authContext,
|
||||
SettingsManager settingsManager,
|
||||
WebImageSupplier webImageSupplier,
|
||||
AuthContext authContext,
|
||||
SettingsManager settingsManager,
|
||||
WebImageSupplier webImageSupplier,
|
||||
TenantManager tenantManager,
|
||||
StorageFactory storageFactory,
|
||||
IConfiguration configuration) : base(authContext, settingsManager, tenantManager)
|
||||
@ -169,5 +170,16 @@ namespace ASC.Web.Core.WhiteLabel
|
||||
public IConfiguration Configuration { get; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public static class TenantInfoSettingsFactory
|
||||
{
|
||||
public static IServiceCollection AddTenantInfoSettingsService(this IServiceCollection services)
|
||||
{
|
||||
return services
|
||||
.AddWebImageSupplierService()
|
||||
.AddStorageFactoryService()
|
||||
.AddSettingsService<TenantInfoSettings>();
|
||||
}
|
||||
}
|
||||
}
|
@ -31,12 +31,13 @@ using ASC.Common.Caching;
|
||||
using ASC.Core;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
|
||||
namespace ASC.Web.Core.WhiteLabel
|
||||
{
|
||||
public class TenantLogoManager
|
||||
{
|
||||
|
||||
{
|
||||
private string CacheKey
|
||||
{
|
||||
get { return "letterlogodata" + TenantManager.GetCurrentTenant().TenantId; }
|
||||
@ -198,5 +199,18 @@ namespace ASC.Web.Core.WhiteLabel
|
||||
{
|
||||
CacheNotify.Publish(new TenantLogoCacheItem() { Key = CacheKey }, CacheNotifyAction.Remove);
|
||||
}
|
||||
}
|
||||
|
||||
public static class TenantLogoManagerFactory
|
||||
{
|
||||
public static IServiceCollection AddTenantLogoManagerService(this IServiceCollection services)
|
||||
{
|
||||
services.TryAddScoped<TenantLogoManager>();
|
||||
|
||||
return services
|
||||
.AddTenantWhiteLabelSettingsService()
|
||||
.AddTenantInfoSettingsService()
|
||||
.AddTenantManagerService();
|
||||
}
|
||||
}
|
||||
}
|
@ -38,6 +38,7 @@ using ASC.Core.Common.WhiteLabel;
|
||||
using ASC.Data.Storage;
|
||||
using ASC.Web.Core.Users;
|
||||
using ASC.Web.Core.Utility.Skins;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Options;
|
||||
using TMResourceData;
|
||||
|
||||
@ -580,5 +581,18 @@ namespace ASC.Web.Core.WhiteLabel
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public static class TenantWhiteLabelSettingsFactory
|
||||
{
|
||||
public static IServiceCollection AddTenantWhiteLabelSettingsService(this IServiceCollection services)
|
||||
{
|
||||
return services
|
||||
.AddUserPhotoManagerService()
|
||||
.AddWebImageSupplierService()
|
||||
.AddStorageFactoryService()
|
||||
.AddWhiteLabelHelperService()
|
||||
.AddSettingsService<TenantWhiteLabelSettings>();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user