diff --git a/common/ASC.Api.Core/ASC.Api.Core.csproj b/common/ASC.Api.Core/ASC.Api.Core.csproj
index 8e5bd68555..9393ddacfa 100644
--- a/common/ASC.Api.Core/ASC.Api.Core.csproj
+++ b/common/ASC.Api.Core/ASC.Api.Core.csproj
@@ -16,12 +16,12 @@
+
+
-
-
diff --git a/common/ASC.Api.Core/Core/BaseStartup.cs b/common/ASC.Api.Core/Core/BaseStartup.cs
index b56bf7a2bc..7e38d3b5c4 100644
--- a/common/ASC.Api.Core/Core/BaseStartup.cs
+++ b/common/ASC.Api.Core/Core/BaseStartup.cs
@@ -8,7 +8,9 @@ using ASC.Api.Core.Middleware;
using ASC.Common;
using ASC.Common.Caching;
using ASC.Common.DependencyInjection;
+using ASC.Common.Logging;
using ASC.Common.Mapping;
+using ASC.Common.Utils;
using Autofac;
@@ -25,12 +27,15 @@ using Microsoft.AspNetCore.Mvc.Authorization;
using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Hosting;
-
+using Microsoft.Extensions.Hosting;
+
+using NLog;
+using NLog.Extensions.Logging;
+
namespace ASC.Api.Core
+{
+ public abstract class BaseStartup
{
- public abstract class BaseStartup
- {
public IConfiguration Configuration { get; }
public IHostEnvironment HostEnvironment { get; }
public virtual JsonConverter[] Converters { get; }
@@ -48,7 +53,7 @@ namespace ASC.Api.Core
DIHelper = new DIHelper();
}
- public virtual void ConfigureServices(IServiceCollection services)
+ public virtual void ConfigureServices(IServiceCollection services)
{
services.AddCustomHealthCheck(Configuration);
services.AddHttpContextAccessor();
@@ -163,5 +168,17 @@ namespace ASC.Api.Core
{
builder.Register(Configuration, LoadProducts, LoadConsumers);
}
+ }
+
+ public static class LogNLogConfigureExtenstion
+ {
+ public static IHostBuilder ConfigureNLogLogging(this IHostBuilder hostBuilder)
+ {
+ return hostBuilder.ConfigureLogging((hostBuildexContext, r) =>
+ {
+ _ = new ConfigureLogNLog(hostBuildexContext.Configuration, new ConfigurationExtension(hostBuildexContext.Configuration));
+ r.AddNLog(LogManager.Configuration);
+ });
+ }
}
}
\ No newline at end of file
diff --git a/common/ASC.Common/ASC.Common.csproj b/common/ASC.Common/ASC.Common.csproj
index 10c9d71c4b..d35d72e5a7 100644
--- a/common/ASC.Common/ASC.Common.csproj
+++ b/common/ASC.Common/ASC.Common.csproj
@@ -52,7 +52,7 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-->
-
+
diff --git a/common/ASC.Core.Common/Caching/CachedUserService.cs b/common/ASC.Core.Common/Caching/CachedUserService.cs
index f86b3d3992..6674eeecc2 100644
--- a/common/ASC.Core.Common/Caching/CachedUserService.cs
+++ b/common/ASC.Core.Common/Caching/CachedUserService.cs
@@ -246,7 +246,9 @@ namespace ASC.Core.Caching
}
public UserInfo GetUser(int tenant, Guid id)
- {
+ {
+ if (id.Equals(Guid.Empty)) return null;
+
if (CoreBaseSettings.Personal)
{
return GetUserForPersonal(tenant, id);
@@ -279,7 +281,7 @@ namespace ASC.Core.Caching
///
private UserInfo GetUserForPersonal(int tenant, Guid id)
{
- if (!CoreBaseSettings.Personal) return GetUser(tenant, id);
+ if (!CoreBaseSettings.Personal) return GetUser(tenant, id);
var key = UserServiceCache.GetUserCacheKeyForPersonal(tenant, id);
var user = Cache.Get(key);
diff --git a/common/ASC.Core.Common/Context/Impl/UserManager.cs b/common/ASC.Core.Common/Context/Impl/UserManager.cs
index f300162a1a..d6a0d13548 100644
--- a/common/ASC.Core.Common/Context/Impl/UserManager.cs
+++ b/common/ASC.Core.Common/Context/Impl/UserManager.cs
@@ -286,36 +286,6 @@ namespace ASC.Core
}
}
return findUsers.ToArray();
- }
-
- public UserInfo SaveUserInfo(UserInfo u)
- {
- if (IsSystemUser(u.ID)) return SystemUsers[u.ID];
- if (u.ID == Guid.Empty) PermissionContext.DemandPermissions(Constants.Action_AddRemoveUser);
- else PermissionContext.DemandPermissions(new UserSecurityProvider(u.ID), Constants.Action_EditUser);
-
- if (Constants.MaxEveryoneCount <= GetUsersByGroup(Constants.GroupEveryone.ID).Length)
- {
- throw new TenantQuotaException("Maximum number of users exceeded");
- }
-
- if (u.Status == EmployeeStatus.Active)
- {
- var q = TenantManager.GetTenantQuota(Tenant.TenantId);
- if (q.ActiveUsers < GetUsersByGroup(Constants.GroupUser.ID).Length)
- {
- throw new TenantQuotaException(string.Format("Exceeds the maximum active users ({0})", q.ActiveUsers));
- }
- }
-
- if (u.Status == EmployeeStatus.Terminated && u.ID == TenantManager.GetCurrentTenant().OwnerId)
- {
- throw new InvalidOperationException("Can not disable tenant owner.");
- }
-
- var newUser = UserService.SaveUser(Tenant.TenantId, u);
-
- return newUser;
}
public UserInfo SaveUserInfo(UserInfo u, bool isVisitor = false)
diff --git a/common/services/ASC.ApiSystem/Program.cs b/common/services/ASC.ApiSystem/Program.cs
index 53b4778c65..718420fe80 100644
--- a/common/services/ASC.ApiSystem/Program.cs
+++ b/common/services/ASC.ApiSystem/Program.cs
@@ -30,6 +30,7 @@ using System.IO;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
+using ASC.Api.Core;
using ASC.Common.Utils;
using Autofac.Extensions.DependencyInjection;
@@ -100,6 +101,7 @@ namespace ASC.ApiSystem
{"pathToConf", path}
});
- });
+ })
+ .ConfigureNLogLogging();
}
}
diff --git a/common/services/ASC.ClearEvents/Program.cs b/common/services/ASC.ClearEvents/Program.cs
index 2706ad6db2..2214cf7600 100644
--- a/common/services/ASC.ClearEvents/Program.cs
+++ b/common/services/ASC.ClearEvents/Program.cs
@@ -26,8 +26,9 @@
using System.Collections.Generic;
using System.IO;
-using System.Threading.Tasks;
-
+using System.Threading.Tasks;
+
+using ASC.Api.Core;
using ASC.Common;
using ASC.Common.Caching;
using ASC.Common.DependencyInjection;
@@ -89,6 +90,7 @@ namespace ASC.Thumbnails.Svc
.ConfigureContainer((context, builder) =>
{
builder.Register(context.Configuration, false, false);
- });
+ })
+ .ConfigureNLogLogging();
}
}
diff --git a/common/services/ASC.Data.Backup/Program.cs b/common/services/ASC.Data.Backup/Program.cs
index bccee04c6a..5ab5e7e6c2 100644
--- a/common/services/ASC.Data.Backup/Program.cs
+++ b/common/services/ASC.Data.Backup/Program.cs
@@ -4,6 +4,7 @@ using System.IO;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
+using ASC.Api.Core;
using ASC.Common.Utils;
using Autofac.Extensions.DependencyInjection;
@@ -75,7 +76,8 @@ namespace ASC.Data.Backup
{"pathToConf", path }
}
);
- });
+ })
+ .ConfigureNLogLogging();
}
}
diff --git a/common/services/ASC.Data.Storage.Encryption/Program.cs b/common/services/ASC.Data.Storage.Encryption/Program.cs
index f630a09f6a..2531e23012 100644
--- a/common/services/ASC.Data.Storage.Encryption/Program.cs
+++ b/common/services/ASC.Data.Storage.Encryption/Program.cs
@@ -28,6 +28,7 @@ using System.IO;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
+using ASC.Api.Core;
using ASC.Common.Utils;
using Autofac.Extensions.DependencyInjection;
@@ -98,6 +99,7 @@ namespace ASC.Data.Storage.Encryption
.AddJsonFile("kafka.json")
.AddJsonFile($"kafka.{env}.json", true)
.AddEnvironmentVariables();
- });
+ })
+ .ConfigureNLogLogging();
}
}
diff --git a/common/services/ASC.Data.Storage.Migration/Program.cs b/common/services/ASC.Data.Storage.Migration/Program.cs
index 0745ee9b7f..28437e4dca 100644
--- a/common/services/ASC.Data.Storage.Migration/Program.cs
+++ b/common/services/ASC.Data.Storage.Migration/Program.cs
@@ -73,6 +73,7 @@ namespace ASC.Data.Storage.Migration
.ConfigureContainer((context, builder) =>
{
builder.Register(context.Configuration);
- });
+ })
+ .ConfigureNLogLogging();
}
}
diff --git a/common/services/ASC.Notify/Program.cs b/common/services/ASC.Notify/Program.cs
index 043ea28a60..446c307620 100644
--- a/common/services/ASC.Notify/Program.cs
+++ b/common/services/ASC.Notify/Program.cs
@@ -82,6 +82,7 @@ namespace ASC.Notify
.ConfigureContainer((context, builder) =>
{
builder.Register(context.Configuration);
- });
+ })
+ .ConfigureNLogLogging();
}
}
diff --git a/common/services/ASC.Radicale/Program.cs b/common/services/ASC.Radicale/Program.cs
index 4b834fff67..7c2233f604 100644
--- a/common/services/ASC.Radicale/Program.cs
+++ b/common/services/ASC.Radicale/Program.cs
@@ -24,23 +24,23 @@
*/
+using System.Collections.Generic;
+using System.IO;
+using System.Threading.Tasks;
+
+using ASC.Api.Core;
using ASC.Common;
using ASC.Common.Caching;
-using ASC.Common.Logging;
-
+using ASC.Common.DependencyInjection;
+using ASC.Common.Utils;
+
using Autofac;
using Autofac.Extensions.DependencyInjection;
-
+
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
-using System.Collections.Generic;
-using System.IO;
-using System.Threading.Tasks;
-
-using ASC.Common.DependencyInjection;
-using ASC.Common.Utils;
namespace ASC.Radicale
{
@@ -98,6 +98,7 @@ namespace ASC.Radicale
.ConfigureContainer((context, builder) =>
{
builder.Register(context.Configuration, false, false);
- });
+ })
+ .ConfigureNLogLogging();
}
}
diff --git a/common/services/ASC.Socket.IO.Svc/Program.cs b/common/services/ASC.Socket.IO.Svc/Program.cs
index c8393385bf..c231c363cf 100644
--- a/common/services/ASC.Socket.IO.Svc/Program.cs
+++ b/common/services/ASC.Socket.IO.Svc/Program.cs
@@ -99,7 +99,8 @@ namespace ASC.Socket.IO.Svc
.ConfigureContainer((context, builder) =>
{
builder.Register(context.Configuration, false, false);
- });
+ })
+ .ConfigureNLogLogging();
}
}
diff --git a/common/services/ASC.SsoAuth.Svc/ASC.SsoAuth.Svc.csproj b/common/services/ASC.SsoAuth.Svc/ASC.SsoAuth.Svc.csproj
index 0ee0598cde..bf7d9ae020 100644
--- a/common/services/ASC.SsoAuth.Svc/ASC.SsoAuth.Svc.csproj
+++ b/common/services/ASC.SsoAuth.Svc/ASC.SsoAuth.Svc.csproj
@@ -21,7 +21,6 @@
-
diff --git a/common/services/ASC.SsoAuth.Svc/Program.cs b/common/services/ASC.SsoAuth.Svc/Program.cs
index 40940e5cff..52fb9be582 100644
--- a/common/services/ASC.SsoAuth.Svc/Program.cs
+++ b/common/services/ASC.SsoAuth.Svc/Program.cs
@@ -100,7 +100,8 @@ namespace ASC.Socket.IO.Svc
.ConfigureContainer((context, builder) =>
{
builder.Register(context.Configuration, false, false);
- });
+ })
+ .ConfigureNLogLogging();
}
}
diff --git a/common/services/ASC.Studio.Notify/Program.cs b/common/services/ASC.Studio.Notify/Program.cs
index 218704d328..bb96e7fbb2 100644
--- a/common/services/ASC.Studio.Notify/Program.cs
+++ b/common/services/ASC.Studio.Notify/Program.cs
@@ -76,6 +76,7 @@ namespace ASC.Studio.Notify
.ConfigureContainer((context, builder) =>
{
builder.Register(context.Configuration);
- });
+ })
+ .ConfigureNLogLogging();
}
}
diff --git a/common/services/ASC.TelegramService/Program.cs b/common/services/ASC.TelegramService/Program.cs
index 237602576e..03398d5f3c 100644
--- a/common/services/ASC.TelegramService/Program.cs
+++ b/common/services/ASC.TelegramService/Program.cs
@@ -28,6 +28,7 @@ using System.IO;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
+using ASC.Api.Core;
using ASC.Common.Utils;
using Autofac.Extensions.DependencyInjection;
@@ -98,6 +99,7 @@ namespace ASC.TelegramService
.AddJsonFile("kafka.json")
.AddJsonFile($"kafka.{env}.json", true)
.AddEnvironmentVariables();
- });
+ })
+ .ConfigureNLogLogging();
}
}
diff --git a/common/services/ASC.Thumbnails.Svc/Program.cs b/common/services/ASC.Thumbnails.Svc/Program.cs
index 38a30dd882..a1543a6767 100644
--- a/common/services/ASC.Thumbnails.Svc/Program.cs
+++ b/common/services/ASC.Thumbnails.Svc/Program.cs
@@ -98,6 +98,7 @@ namespace ASC.Thumbnails.Svc
.ConfigureContainer((context, builder) =>
{
builder.Register(context.Configuration, false, false);
- });
+ })
+ .ConfigureNLogLogging();
}
}
diff --git a/common/services/ASC.UrlShortener.Svc/Program.cs b/common/services/ASC.UrlShortener.Svc/Program.cs
index 039b0bbc76..f3a8c32cce 100644
--- a/common/services/ASC.UrlShortener.Svc/Program.cs
+++ b/common/services/ASC.UrlShortener.Svc/Program.cs
@@ -99,6 +99,7 @@ namespace ASC.UrlShortener.Svc
.ConfigureContainer((context, builder) =>
{
builder.Register(context.Configuration, false, false);
- });
+ })
+ .ConfigureNLogLogging();
}
}
diff --git a/config/nlog.config b/config/nlog.config
index d208716642..7cb96b2927 100644
--- a/config/nlog.config
+++ b/config/nlog.config
@@ -14,12 +14,12 @@
-
+
-
+
\ No newline at end of file
diff --git a/products/ASC.CRM/BackgroundTasks/Program.cs b/products/ASC.CRM/BackgroundTasks/Program.cs
index b35079dddd..0c604e1163 100644
--- a/products/ASC.CRM/BackgroundTasks/Program.cs
+++ b/products/ASC.CRM/BackgroundTasks/Program.cs
@@ -2,6 +2,7 @@
using System.IO;
using System.Threading.Tasks;
+using ASC.Api.Core;
using ASC.Common;
using ASC.Common.Caching;
using ASC.Common.DependencyInjection;
@@ -83,6 +84,7 @@ namespace ASC.CRM.BackgroundTasks
.ConfigureContainer((context, builder) =>
{
builder.Register(context.Configuration, true, false, "search.json");
- });
+ })
+ .ConfigureNLogLogging();
}
}
diff --git a/products/ASC.CRM/Server/Program.cs b/products/ASC.CRM/Server/Program.cs
index 8e70bacd1d..b2613fdcb9 100644
--- a/products/ASC.CRM/Server/Program.cs
+++ b/products/ASC.CRM/Server/Program.cs
@@ -1,12 +1,11 @@
using System;
using System.Collections.Generic;
using System.IO;
-using System.Runtime.InteropServices;
-
-using ASC.Common.DependencyInjection;
-using ASC.Common.Utils;
-
-using Autofac;
+using System.Runtime.InteropServices;
+
+using ASC.Api.Core;
+using ASC.Common.Utils;
+
using Autofac.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Hosting;
@@ -74,6 +73,7 @@ namespace ASC.CRM
{
{"pathToConf", path}
});
- });
+ })
+ .ConfigureNLogLogging();
}
}
diff --git a/products/ASC.Calendar/Server/Program.cs b/products/ASC.Calendar/Server/Program.cs
index f91b50e739..064490e334 100644
--- a/products/ASC.Calendar/Server/Program.cs
+++ b/products/ASC.Calendar/Server/Program.cs
@@ -1,7 +1,9 @@
using System.Collections.Generic;
using System.IO;
-using System.Threading.Tasks;
-
+using System.Threading.Tasks;
+
+using ASC.Api.Core;
+
using Autofac.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Hosting;
@@ -47,7 +49,8 @@ namespace ASC.Calendar
.AddJsonFile("kafka.json")
.AddJsonFile($"kafka.{hostingContext.HostingEnvironment.EnvironmentName}.json", true)
.AddEnvironmentVariables()
- .AddCommandLine(args);
- });
+ .AddCommandLine(args);
+ })
+ .ConfigureNLogLogging();
}
}
diff --git a/products/ASC.Files/Server/Program.cs b/products/ASC.Files/Server/Program.cs
index f77229ebc7..a113b31af3 100644
--- a/products/ASC.Files/Server/Program.cs
+++ b/products/ASC.Files/Server/Program.cs
@@ -4,6 +4,7 @@ using System.IO;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
+using ASC.Api.Core;
using ASC.Common.Utils;
using Autofac.Extensions.DependencyInjection;
@@ -73,6 +74,7 @@ namespace ASC.Files
{
{"pathToConf", path}
});
- });
+ })
+ .ConfigureNLogLogging();
}
}
diff --git a/products/ASC.Files/Service/Program.cs b/products/ASC.Files/Service/Program.cs
index 7293f93924..3272485a06 100644
--- a/products/ASC.Files/Service/Program.cs
+++ b/products/ASC.Files/Service/Program.cs
@@ -89,6 +89,7 @@ namespace ASC.Files.Service
.ConfigureContainer((context, builder) =>
{
builder.Register(context.Configuration, true, false, "search.json", "feed.json");
- });
+ })
+ .ConfigureNLogLogging();
}
}
diff --git a/products/ASC.Mail/Server/Program.cs b/products/ASC.Mail/Server/Program.cs
index c28b41b694..c20c70705c 100644
--- a/products/ASC.Mail/Server/Program.cs
+++ b/products/ASC.Mail/Server/Program.cs
@@ -1,8 +1,10 @@
using System.Collections.Generic;
using System.IO;
-using System.Threading.Tasks;
-
+using System.Threading.Tasks;
+
+using ASC.Api.Core;
+
using Autofac.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Hosting;
@@ -51,6 +53,7 @@ namespace ASC.Mail
{
{"pathToConf", path}
});
- });
+ })
+ .ConfigureNLogLogging();
}
}
diff --git a/products/ASC.People/Server/Program.cs b/products/ASC.People/Server/Program.cs
index ad38283077..12409ef8af 100644
--- a/products/ASC.People/Server/Program.cs
+++ b/products/ASC.People/Server/Program.cs
@@ -4,6 +4,7 @@ using System.IO;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
+using ASC.Api.Core;
using ASC.Common.Utils;
using Autofac.Extensions.DependencyInjection;
@@ -75,7 +76,8 @@ namespace ASC.People
{"pathToConf", path }
}
);
- });
+ })
+ .ConfigureNLogLogging();
}
}
}
\ No newline at end of file
diff --git a/products/ASC.Projects/Server/Program.cs b/products/ASC.Projects/Server/Program.cs
index 03825b906a..c7d02eb957 100644
--- a/products/ASC.Projects/Server/Program.cs
+++ b/products/ASC.Projects/Server/Program.cs
@@ -5,6 +5,7 @@ using System.IO;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
+using ASC.Api.Core;
using ASC.Common.Utils;
using Autofac.Extensions.DependencyInjection;
@@ -74,6 +75,7 @@ namespace ASC.Projects
{
{"pathToConf", path}
});
- });
+ })
+ .ConfigureNLogLogging();
}
}
diff --git a/web/ASC.Web.Api/Program.cs b/web/ASC.Web.Api/Program.cs
index 6d45dda336..f79fc93f87 100644
--- a/web/ASC.Web.Api/Program.cs
+++ b/web/ASC.Web.Api/Program.cs
@@ -4,6 +4,7 @@ using System.IO;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
+using ASC.Api.Core;
using ASC.Common.Utils;
using Autofac.Extensions.DependencyInjection;
@@ -11,7 +12,6 @@ using Autofac.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
-
namespace ASC.Web.Api
{
@@ -75,6 +75,7 @@ namespace ASC.Web.Api
{"pathToConf", path }
}
);
- });
+ })
+ .ConfigureNLogLogging();
}
}
diff --git a/web/ASC.Web.Studio/Program.cs b/web/ASC.Web.Studio/Program.cs
index c80746edd5..fb8a125ffb 100644
--- a/web/ASC.Web.Studio/Program.cs
+++ b/web/ASC.Web.Studio/Program.cs
@@ -4,6 +4,7 @@ using System.IO;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
+using ASC.Api.Core;
using ASC.Common.Utils;
using Autofac.Extensions.DependencyInjection;
@@ -75,6 +76,7 @@ namespace ASC.Web.Studio
}
);
- });
+ })
+ .ConfigureNLogLogging();
}
}