Merge pull request #509 from ONLYOFFICE/feature/asc-audit-trail-refactor

Feature/asc audit trail refactor
This commit is contained in:
Alexey Bannov 2022-02-11 15:43:46 +03:00 committed by GitHub
commit 66c8af352d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 1650 additions and 1647 deletions

View File

@ -18,7 +18,7 @@ global using System.Threading;
global using System.Threading.Tasks;
global using System.Web;
global using System.Xml.Linq;
global using StackExchange.Redis.Extensions.Newtonsoft;
global using ASC.Api.Core;
global using ASC.Api.Core.Auth;
global using ASC.Api.Core.Convention;
@ -81,3 +81,4 @@ global using NLog;
global using NLog.Extensions.Logging;
global using StackExchange.Redis.Extensions.Core.Configuration;
global using StackExchange.Redis.Extensions.Newtonsoft;

View File

@ -5,7 +5,7 @@
public class MessagesContext : BaseDbContext
{
public DbSet<AuditEvent> AuditEvents { get; set; }
public DbSet<LoginEvents> LoginEvents { get; set; }
public DbSet<LoginEvent> LoginEvents { get; set; }
public DbSet<User> Users { get; set; }
protected override Dictionary<Provider, Func<BaseDbContext>> ProviderContext

View File

@ -40,7 +40,7 @@
.HasColumnName("date")
.HasColumnType("datetime");
entity.Property(e => e.Description)
entity.Property(e => e.DescriptionRaw)
.HasColumnName("description")
.HasColumnType("varchar(20000)")
.HasCharSet("utf8")
@ -105,7 +105,7 @@
entity.Property(e => e.Date).HasColumnName("date");
entity.Property(e => e.Description)
entity.Property(e => e.DescriptionRaw)
.HasColumnName("description")
.HasMaxLength(20000)
.HasDefaultValueSql("NULL");

View File

@ -1,9 +1,10 @@
namespace ASC.Core.Common.EF.Model
{
public class LoginEvents : MessageEvent
public class LoginEvent : MessageEvent
{
public string Login { get; set; }
}
public static class LoginEventsExtension
{
public static ModelBuilderWrapper AddLoginEvents(this ModelBuilderWrapper modelBuilder)
@ -15,7 +16,7 @@
}
public static void MySqlAddLoginEvents(this ModelBuilder modelBuilder)
{
modelBuilder.Entity<LoginEvents>(entity =>
modelBuilder.Entity<LoginEvent>(entity =>
{
entity.ToTable("login_events");
@ -39,7 +40,7 @@
.HasColumnName("date")
.HasColumnType("datetime");
entity.Property(e => e.Description)
entity.Property(e => e.DescriptionRaw)
.HasColumnName("description")
.HasColumnType("varchar(500)")
.HasCharSet("utf8")
@ -81,7 +82,7 @@
}
public static void PgSqlAddLoginEvents(this ModelBuilder modelBuilder)
{
modelBuilder.Entity<LoginEvents>(entity =>
modelBuilder.Entity<LoginEvent>(entity =>
{
entity.ToTable("login_events", "onlyoffice");
@ -102,7 +103,7 @@
entity.Property(e => e.Date).HasColumnName("date");
entity.Property(e => e.Description)
entity.Property(e => e.DescriptionRaw)
.HasColumnName("description")
.HasMaxLength(500)
.HasDefaultValueSql("NULL");

View File

@ -11,6 +11,6 @@
public Guid UserId { get; set; }
public string Page { get; set; }
public int Action { get; set; }
public string Description { get; set; }
public string DescriptionRaw { get; set; }
}
}

View File

@ -149,7 +149,7 @@ namespace ASC.MessagingSystem.DbSender
private static void AddLoginEvent(EventMessage message, MessagesContext dbContext)
{
var le = new LoginEvents
var le = new LoginEvent
{
Ip = message.IP,
Login = message.Initiator,
@ -164,7 +164,7 @@ namespace ASC.MessagingSystem.DbSender
if (message.Description != null && message.Description.Count > 0)
{
le.Description =
le.DescriptionRaw =
JsonConvert.SerializeObject(message.Description, new JsonSerializerSettings
{
DateTimeZoneHandling = DateTimeZoneHandling.Utc
@ -193,7 +193,7 @@ namespace ASC.MessagingSystem.DbSender
if (message.Description != null && message.Description.Count > 0)
{
ae.Description =
ae.DescriptionRaw =
JsonConvert.SerializeObject(GetSafeDescription(message.Description), new JsonSerializerSettings
{
DateTimeZoneHandling = DateTimeZoneHandling.Utc

View File

@ -0,0 +1,14 @@
namespace ASC.AuditTrail.Attributes;
[AttributeUsage(AttributeTargets.Property)]
public class EventAttribute : Attribute
{
public string Resource { get; private set; }
public int Order { get; private set; }
public EventAttribute(string resource, int order = 0)
{
Resource = resource;
Order = order;
}
}

View File

@ -1,143 +0,0 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
namespace ASC.AuditTrail
{
[Scope]
public class AuditEventsRepository
{
private MessageTarget MessageTarget { get; set; }
private UserFormatter UserFormatter { get; set; }
private Lazy<AuditTrailContext> LazyAuditTrailContext { get; }
private AuditTrailContext AuditTrailContext { get => LazyAuditTrailContext.Value; }
private AuditActionMapper AuditActionMapper { get; }
public AuditEventsRepository(MessageTarget messageTarget, UserFormatter userFormatter, DbContextManager<AuditTrailContext> dbContextManager, AuditActionMapper auditActionMapper)
{
MessageTarget = messageTarget;
UserFormatter = userFormatter;
LazyAuditTrailContext = new Lazy<AuditTrailContext>(() => dbContextManager.Value );
AuditActionMapper = auditActionMapper;
}
public IEnumerable<AuditEvent> GetLast(int tenant, int chunk)
{
return Get(tenant, null, null, chunk);
}
public IEnumerable<AuditEvent> Get(int tenant, DateTime from, DateTime to)
{
return Get(tenant, from, to, null);
}
private sealed class Query
{
public Core.Common.EF.Model.AuditEvent AuditEvent { get; set; }
public User User { get; set; }
}
private IEnumerable<AuditEvent> Get(int tenant, DateTime? fromDate, DateTime? to, int? limit)
{
var query =
from q in AuditTrailContext.AuditEvents
from p in AuditTrailContext.Users.Where(p => q.UserId == p.Id).DefaultIfEmpty()
where q.TenantId == tenant
orderby q.Date descending
select new Query { AuditEvent = q, User = p };
if (fromDate.HasValue && to.HasValue)
{
query = query.Where(q => q.AuditEvent.Date >= fromDate && q.AuditEvent.Date <= to);
}
if (limit.HasValue)
{
query = query.Take((int)limit);
}
return query.AsEnumerable().Select(ToAuditEvent).ToList();
}
public int GetCount(int tenant, DateTime? from = null, DateTime? to = null)
{
IQueryable<Core.Common.EF.Model.AuditEvent> query = AuditTrailContext.AuditEvents
.Where(a => a.TenantId == tenant)
.OrderByDescending(a => a.Date);
if (from.HasValue && to.HasValue)
{
query = query.Where(a => a.Date >= from && a.Date <= to);
}
return query.Count();
}
private AuditEvent ToAuditEvent(Query query)
{
try
{
var evt = new AuditEvent
{
Id = query.AuditEvent.Id,
IP = query.AuditEvent.Ip,
Initiator = query.AuditEvent.Initiator,
Browser = query.AuditEvent.Browser,
Platform = query.AuditEvent.Platform,
Date = query.AuditEvent.Date,
TenantId = query.AuditEvent.TenantId,
UserId = query.AuditEvent.UserId,
Page = query.AuditEvent.Page,
Action = query.AuditEvent.Action
};
if (query.AuditEvent.Description != null)
{
evt.Description = JsonConvert.DeserializeObject<IList<string>>(
query.AuditEvent.Description,
new JsonSerializerSettings { DateTimeZoneHandling = DateTimeZoneHandling.Utc });
}
evt.Target = MessageTarget.Parse(query.AuditEvent.Target);
evt.UserName = (query.User.FirstName != null && query.User.LastName != null) ? UserFormatter.GetUserName(query.User.FirstName, query.User.LastName) :
evt.UserId == Core.Configuration.Constants.CoreSystem.ID ? AuditReportResource.SystemAccount :
evt.UserId == Core.Configuration.Constants.Guest.ID ? AuditReportResource.GuestAccount :
evt.Initiator ?? AuditReportResource.UnknownAccount;
evt.ActionText = AuditActionMapper.GetActionText(evt);
evt.ActionTypeText = AuditActionMapper.GetActionTypeText(evt);
evt.Product = AuditActionMapper.GetProductText(evt);
evt.Module = AuditActionMapper.GetModuleText(evt);
return evt;
}
catch (Exception)
{
}
return null;
}
}
}

View File

@ -23,53 +23,57 @@
*
*/
namespace ASC.AuditTrail
namespace ASC.AuditTrail;
[Scope]
public class AuditReportCreator
{
[Scope]
public class AuditReportCreator
private readonly GlobalFolderHelper _globalFolderHelper;
private readonly FileUploader _fileUploader;
private readonly FilesLinkUtility _filesLinkUtility;
private readonly CommonLinkUtility _commonLinkUtility;
private readonly ILog _logger;
public AuditReportCreator(
GlobalFolderHelper globalFolderHelper,
IOptionsMonitor<ILog> options,
FileUploader fileUploader,
FilesLinkUtility filesLinkUtility,
CommonLinkUtility commonLinkUtility)
{
private ILog Log { get; }
private GlobalFolderHelper GlobalFolderHelper { get; }
private FileUploader FileUploader { get; }
private FilesLinkUtility FilesLinkUtility { get; }
private CommonLinkUtility CommonLinkUtility { get; }
_globalFolderHelper = globalFolderHelper;
_logger = options.CurrentValue;
_fileUploader = fileUploader;
_filesLinkUtility = filesLinkUtility;
_commonLinkUtility = commonLinkUtility;
}
public AuditReportCreator(GlobalFolderHelper globalFolderHelper, IOptionsMonitor<ILog> options, FileUploader fileUploader, FilesLinkUtility filesLinkUtility, CommonLinkUtility commonLinkUtility)
public string CreateCsvReport<TEvent>(IEnumerable<TEvent> events, string reportName) where TEvent : BaseEvent
{
try
{
GlobalFolderHelper = globalFolderHelper;
Log = options.CurrentValue;
FileUploader = fileUploader;
FilesLinkUtility = filesLinkUtility;
CommonLinkUtility = commonLinkUtility;
using var stream = new MemoryStream();
using var writer = new StreamWriter(stream, Encoding.UTF8);
using var csv = new CsvWriter(writer, CultureInfo.CurrentCulture);
csv.Configuration.RegisterClassMap(new BaseEventMap<TEvent>());
csv.WriteHeader<TEvent>();
csv.NextRecord();
csv.WriteRecords(events);
writer.Flush();
var file = _fileUploader.Exec(_globalFolderHelper.FolderMy, reportName, stream.Length, stream, true);
var fileUrl = _commonLinkUtility.GetFullAbsolutePath(_filesLinkUtility.GetFileWebEditorUrl(file.ID));
fileUrl += string.Format("&options={{\"codePage\":{0}}}", Encoding.UTF8.CodePage);
return fileUrl;
}
public string CreateCsvReport<TEvent>(IEnumerable<TEvent> events, string reportName) where TEvent : BaseEvent
catch (Exception ex)
{
try
{
using (var stream = new MemoryStream())
using (var writer = new StreamWriter(stream, Encoding.UTF8))
using (var csv = new CsvWriter(writer, CultureInfo.CurrentCulture))
{
csv.Configuration.RegisterClassMap(new BaseEventMap<TEvent>());
csv.WriteHeader<TEvent>();
csv.NextRecord();
csv.WriteRecords(events);
writer.Flush();
var file = FileUploader.Exec(GlobalFolderHelper.FolderMy, reportName, stream.Length, stream, true);
var fileUrl = CommonLinkUtility.GetFullAbsolutePath(FilesLinkUtility.GetFileWebEditorUrl(file.ID));
fileUrl += string.Format("&options={{\"codePage\":{0}}}", Encoding.UTF8.CodePage);
return fileUrl;
}
}
catch (Exception ex)
{
Log.Error("Error while generating login report: " + ex);
throw;
}
_logger.Error("Error while generating login report: " + ex);
throw;
}
}
}

View File

@ -1,93 +0,0 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2020
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
namespace ASC.AuditTrail
{
public class BaseEvent
{
public int Id { get; set; }
public int TenantId { get; set; }
public Guid UserId { get; set; }
public bool Mobile { get; set; }
public IList<string> Description { get; set; }
[Event("IpCol")]
public string IP { get; set; }
[Event("BrowserCol")]
public string Browser { get; set; }
[Event("PlatformCol")]
public string Platform { get; set; }
[Event("DateCol")]
public DateTime Date { get; set; }
[Event("UserCol")]
public string UserName { get; set; }
[Event("PageCol")]
public string Page { get; set; }
[Event("ActionCol")]
public string ActionText { get; set; }
}
internal class BaseEventMap<T> : ClassMap<T> where T : BaseEvent
{
public BaseEventMap()
{
var eventType = typeof(T);
var eventProps = eventType
.GetProperties()
.Where(r => r.GetCustomAttribute<EventAttribute>() != null)
.OrderBy(r=> r.GetCustomAttribute<EventAttribute>().Order);
foreach (var prop in eventProps)
{
var attr = prop.GetCustomAttribute<EventAttribute>().Resource;
Map(eventType, prop).Name(AuditReportResource.ResourceManager.GetString(attr));
}
}
}
[AttributeUsage(AttributeTargets.Property)]
internal class EventAttribute : Attribute
{
public string Resource { get; private set; }
public int Order { get; private set; }
public EventAttribute(string resource, int order = 0)
{
Resource = resource;
Order = order;
}
}
}

View File

@ -4,6 +4,7 @@ global using System.Globalization;
global using System.IO;
global using System.Linq;
global using System.Text;
global using System.Reflection;
global using ASC.AuditTrail.Mappers;
global using ASC.Common;
@ -13,6 +14,14 @@ global using ASC.Core.Common.EF.Context;
global using ASC.Core.Users;
global using ASC.MessagingSystem;
global using ASC.Web.Studio.Utility;
global using ASC.AuditTrail.Attributes;
global using ASC.Core.Common.EF.Model;
global using ASC.Web.Core.Files;
global using ASC.Web.Files.Classes;
global using ASC.Web.Files.Utils;
global using ASC.AuditTrail.Models;
global using ASC.AuditTrail.Models.Mappings;
global using ASC.Common.Mapping;
global using Autofac;
@ -21,14 +30,8 @@ global using Microsoft.Extensions.Options;
global using Newtonsoft.Json;
global using ASC.Web.Core.Files;
global using ASC.Web.Files.Classes;
global using ASC.Web.Files.Utils;
global using AutoMapper;
global using CsvHelper;
global using System.Reflection;
global using CsvHelper.Configuration;
global using ASC.Core.Common.EF.Model;

View File

@ -1,126 +0,0 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2020
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
namespace ASC.AuditTrail.Data
{
[Scope]
public class LoginEventsRepository
{
private UserFormatter UserFormatter { get; }
private AuditActionMapper AuditActionMapper { get; }
private MessagesContext MessagesContext { get => LazyMessagesContext.Value; }
private Lazy<MessagesContext> LazyMessagesContext { get; }
public LoginEventsRepository(UserFormatter userFormatter, AuditActionMapper auditActionMapper, DbContextManager<MessagesContext> dbMessagesContext)
{
UserFormatter = userFormatter;
AuditActionMapper = auditActionMapper;
LazyMessagesContext = new Lazy<MessagesContext>(() => dbMessagesContext.Value);
}
private sealed class Query
{
public LoginEvents LoginEvents { get; set; }
public User User { get; set; }
}
public IEnumerable<LoginEvent> GetLast(int tenant, int chunk)
{
var query =
(from b in MessagesContext.LoginEvents
from p in MessagesContext.Users.Where(p => b.UserId == p.Id).DefaultIfEmpty()
where b.TenantId == tenant
orderby b.Date descending
select new Query { LoginEvents = b, User = p })
.Take(chunk);
return query.AsEnumerable().Select(ToLoginEvent).ToList();
}
public IEnumerable<LoginEvent> Get(int tenant, DateTime fromDate, DateTime to)
{
var query =
from q in MessagesContext.LoginEvents
from p in MessagesContext.Users.Where(p => q.UserId == p.Id).DefaultIfEmpty()
where q.TenantId == tenant
where q.Date >= fromDate
where q.Date <= to
orderby q.Date descending
select new Query { LoginEvents = q, User = p };
return query.AsEnumerable().Select(ToLoginEvent).ToList();
}
public int GetCount(int tenant, DateTime? from = null, DateTime? to = null)
{
var query = MessagesContext.LoginEvents
.Where(l => l.TenantId == tenant);
if (from.HasValue && to.HasValue)
{
query = query.Where(l => l.Date >= from && l.Date <= to);
}
return query.Count();
}
private LoginEvent ToLoginEvent(Query query)
{
var evt = new LoginEvent
{
Id = query.LoginEvents.Id,
IP = query.LoginEvents.Ip,
Login = query.LoginEvents.Login,
Browser = query.LoginEvents.Browser,
Platform = query.LoginEvents.Platform,
Date = query.LoginEvents.Date,
TenantId = query.LoginEvents.TenantId,
UserId = query.LoginEvents.UserId,
Page = query.LoginEvents.Page,
Action = query.LoginEvents.Action
};
if (query.LoginEvents.Description != null)
{
evt.Description = JsonConvert.DeserializeObject<IList<string>>(
query.LoginEvents.Description,
new JsonSerializerSettings
{
DateTimeZoneHandling = DateTimeZoneHandling.Utc
});
}
evt.UserName = (!string.IsNullOrEmpty(query.User?.FirstName) && !string.IsNullOrEmpty(query.User?.LastName))
? UserFormatter.GetUserName(query.User.FirstName, query.User.LastName)
: !string.IsNullOrWhiteSpace(evt.Login)
? evt.Login
: evt.UserId == Core.Configuration.Constants.Guest.ID
? AuditReportResource.GuestAccount
: AuditReportResource.UnknownAccount;
evt.ActionText = AuditActionMapper.GetActionText(evt);
return evt;
}
}
}

View File

@ -23,115 +23,118 @@
*
*/
namespace ASC.AuditTrail.Mappers
namespace ASC.AuditTrail.Mappers;
[Singletone]
public class AuditActionMapper
{
[Singletone]
public class AuditActionMapper
private readonly Dictionary<MessageAction, MessageMaps> _actions;
private readonly ILog _logger;
public AuditActionMapper(IOptionsMonitor<ILog> options)
{
private Dictionary<MessageAction, MessageMaps> Actions { get; }
private ILog Log { get; }
_actions = new Dictionary<MessageAction, MessageMaps>();
_logger = options.CurrentValue;
public AuditActionMapper(IOptionsMonitor<ILog> options)
_actions = _actions
.Union(LoginActionsMapper.GetMaps())
.Union(ProjectsActionsMapper.GetMaps())
.Union(CrmActionMapper.GetMaps())
.Union(PeopleActionMapper.GetMaps())
.Union(DocumentsActionMapper.GetMaps())
.Union(SettingsActionsMapper.GetMaps())
.Union(OthersActionsMapper.GetMaps())
.ToDictionary(x => x.Key, x => x.Value);
}
public string GetActionText(AuditEventDto evt)
{
var action = (MessageAction)evt.Action;
if (!_actions.ContainsKey(action))
{
Actions = new Dictionary<MessageAction, MessageMaps>();
Log = options.CurrentValue;
_logger.Error(string.Format("There is no action text for \"{0}\" type of event", action));
Actions = Actions
.Union(LoginActionsMapper.GetMaps())
.Union(ProjectsActionsMapper.GetMaps())
.Union(CrmActionMapper.GetMaps())
.Union(PeopleActionMapper.GetMaps())
.Union(DocumentsActionMapper.GetMaps())
.Union(SettingsActionsMapper.GetMaps())
.Union(OthersActionsMapper.GetMaps())
.ToDictionary(x => x.Key, x => x.Value);
return string.Empty;
}
public string GetActionText(AuditEvent evt)
try
{
var action = (MessageAction)evt.Action;
if (!Actions.ContainsKey(action))
{
Log.Error(string.Format("There is no action text for \"{0}\" type of event", action));
return string.Empty;
}
try
{
var actionText = Actions[(MessageAction)evt.Action].GetActionText();
var actionText = _actions[(MessageAction)evt.Action].GetActionText();
if (evt.Description == null || evt.Description.Count == 0) return actionText;
var description = evt.Description
.Select(t => t.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
.Select(split => string.Join(", ", split.Select(ToLimitedText))).ToArray();
var description = evt.Description
.Select(t => t.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
.Select(split => string.Join(", ", split.Select(ToLimitedText))).ToArray();
return string.Format(actionText, description);
}
catch
{
//log.Error(string.Format("Error while building action text for \"{0}\" type of event", action));
return string.Empty;
}
return string.Format(actionText, description);
}
public string GetActionText(LoginEvent evt)
catch
{
var action = (MessageAction)evt.Action;
if (!Actions.ContainsKey(action))
{
//log.Error(string.Format("There is no action text for \"{0}\" type of event", action));
return string.Empty;
}
try
{
var actionText = Actions[(MessageAction)evt.Action].GetActionText();
if (evt.Description == null || evt.Description.Count == 0) return actionText;
var description = evt.Description
.Select(t => t.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
.Select(split => string.Join(", ", split.Select(ToLimitedText))).ToArray();
return string.Format(actionText, description);
}
catch
{
//log.Error(string.Format("Error while building action text for \"{0}\" type of event", action));
return string.Empty;
}
}
public string GetActionTypeText(AuditEvent evt)
{
var action = (MessageAction)evt.Action;
return !Actions.ContainsKey(action)
? string.Empty
: Actions[(MessageAction)evt.Action].GetActionTypeText();
}
public string GetProductText(AuditEvent evt)
{
var action = (MessageAction)evt.Action;
return !Actions.ContainsKey(action)
? string.Empty
: Actions[(MessageAction)evt.Action].GetProduct();
}
public string GetModuleText(AuditEvent evt)
{
var action = (MessageAction)evt.Action;
return !Actions.ContainsKey(action)
? string.Empty
: Actions[(MessageAction)evt.Action].GetModule();
}
private string ToLimitedText(string text)
{
if (text == null) return null;
return text.Length < 50 ? text : $"{text.Substring(0, 47)}...";
//log.Error(string.Format("Error while building action text for \"{0}\" type of event", action));
return string.Empty;
}
}
public string GetActionText(LoginEventDto evt)
{
var action = (MessageAction)evt.Action;
if (!_actions.ContainsKey(action))
{
//log.Error(string.Format("There is no action text for \"{0}\" type of event", action));
return string.Empty;
}
try
{
var actionText = _actions[(MessageAction)evt.Action].GetActionText();
if (evt.Description == null || evt.Description.Count == 0) return actionText;
var description = evt.Description
.Select(t => t.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
.Select(split => string.Join(", ", split.Select(ToLimitedText))).ToArray();
return string.Format(actionText, description);
}
catch
{
//log.Error(string.Format("Error while building action text for \"{0}\" type of event", action));
return string.Empty;
}
}
public string GetActionTypeText(AuditEventDto evt)
{
var action = (MessageAction)evt.Action;
return !_actions.ContainsKey(action)
? string.Empty
: _actions[(MessageAction)evt.Action].GetActionTypeText();
}
public string GetProductText(AuditEventDto evt)
{
var action = (MessageAction)evt.Action;
return !_actions.ContainsKey(action)
? string.Empty
: _actions[(MessageAction)evt.Action].GetProduct();
}
public string GetModuleText(AuditEventDto evt)
{
var action = (MessageAction)evt.Action;
return !_actions.ContainsKey(action)
? string.Empty
: _actions[(MessageAction)evt.Action].GetModule();
}
private string ToLimitedText(string text)
{
if (text == null) return null;
return text.Length < 50 ? text : $"{text.Substring(0, 47)}...";
}
}

View File

@ -23,14 +23,13 @@
*
*/
namespace ASC.AuditTrail.Mappers
namespace ASC.AuditTrail.Mappers;
internal static class CrmActionMapper
{
internal static class CrmActionMapper
{
public static Dictionary<MessageAction, MessageMaps> GetMaps()
public static Dictionary<MessageAction, MessageMaps> GetMaps() =>
new Dictionary<MessageAction, MessageMaps>
{
return new Dictionary<MessageAction, MessageMaps>
{
#region companies
{
@ -1614,8 +1613,6 @@ namespace ASC.AuditTrail.Mappers
}
},
#endregion
};
}
}
#endregion
};
}

View File

@ -23,402 +23,399 @@
*
*/
namespace ASC.AuditTrail.Mappers
namespace ASC.AuditTrail.Mappers;
internal static class DocumentsActionMapper
{
internal static class DocumentsActionMapper
{
public static Dictionary<MessageAction, MessageMaps> GetMaps()
public static Dictionary<MessageAction, MessageMaps> GetMaps() =>
new Dictionary<MessageAction, MessageMaps>
{
return new Dictionary<MessageAction, MessageMaps>
{
MessageAction.FileCreated, new MessageMaps
{
{
MessageAction.FileCreated, new MessageMaps
{
ActionTypeTextResourceName = "CreateActionType",
ActionTextResourceName = "FileCreated",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileRenamed, new MessageMaps
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "FileRenamed",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileUpdated, new MessageMaps
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "FileUpdated",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.UserFileUpdated, new MessageMaps
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "UserFileUpdated",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileCreatedVersion, new MessageMaps
{
ActionTypeTextResourceName = "CreateActionType",
ActionTextResourceName = "FileCreatedVersion",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileDeletedVersion, new MessageMaps
{
ActionTypeTextResourceName = "DeleteActionType",
ActionTextResourceName = "FileDeletedVersion",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileRestoreVersion, new MessageMaps
{
ActionTypeTextResourceName = "CreateActionType",
ActionTextResourceName = "FileRestoreVersion",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileUpdatedRevisionComment, new MessageMaps
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "FileUpdatedRevisionComment",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileLocked, new MessageMaps
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "FileLocked",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileUnlocked, new MessageMaps
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "FileUnlocked",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileUpdatedAccess, new MessageMaps
{
ActionTypeTextResourceName = "UpdateAccessActionType",
ActionTextResourceName = "FileUpdatedAccess",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileDownloaded, new MessageMaps
{
ActionTypeTextResourceName = "DownloadActionType",
ActionTextResourceName = "FileDownloaded",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileDownloadedAs, new MessageMaps
{
ActionTypeTextResourceName = "DownloadActionType",
ActionTextResourceName = "FileDownloadedAs",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileUploaded, new MessageMaps
{
ActionTypeTextResourceName = "UploadActionType",
ActionTextResourceName = "FileUploaded",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileImported, new MessageMaps
{
ActionTypeTextResourceName = "ImportActionType",
ActionTextResourceName = "FileImported",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileCopied, new MessageMaps
{
ActionTypeTextResourceName = "CopyActionType",
ActionTextResourceName = "FileCopied",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileCopiedWithOverwriting, new MessageMaps
{
ActionTypeTextResourceName = "CopyActionType",
ActionTextResourceName = "FileCopiedWithOverwriting",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileMoved, new MessageMaps
{
ActionTypeTextResourceName = "MoveActionType",
ActionTextResourceName = "FileMoved",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileMovedWithOverwriting, new MessageMaps
{
ActionTypeTextResourceName = "MoveActionType",
ActionTextResourceName = "FileMovedWithOverwriting",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileMovedToTrash, new MessageMaps
{
ActionTypeTextResourceName = "MoveActionType",
ActionTextResourceName = "FileMovedToTrash",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileDeleted, new MessageMaps
{
ActionTypeTextResourceName = "DeleteActionType",
ActionTextResourceName = "FileDeleted",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FolderCreated, new MessageMaps
{
ActionTypeTextResourceName = "CreateActionType",
ActionTextResourceName = "FolderCreated",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FoldersModule"
}
},
{
MessageAction.FolderRenamed, new MessageMaps
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "FolderRenamed",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FoldersModule"
}
},
{
MessageAction.FolderUpdatedAccess, new MessageMaps
{
ActionTypeTextResourceName = "UpdateAccessActionType",
ActionTextResourceName = "FolderUpdatedAccess",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FoldersModule"
}
},
{
MessageAction.FolderCopied, new MessageMaps
{
ActionTypeTextResourceName = "CopyActionType",
ActionTextResourceName = "FolderCopied",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FoldersModule"
}
},
{
MessageAction.FolderCopiedWithOverwriting, new MessageMaps
{
ActionTypeTextResourceName = "CopyActionType",
ActionTextResourceName = "FolderCopiedWithOverwriting",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FoldersModule"
}
},
{
MessageAction.FolderMoved, new MessageMaps
{
ActionTypeTextResourceName = "MoveActionType",
ActionTextResourceName = "FolderMoved",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FoldersModule"
}
},
{
MessageAction.FolderMovedWithOverwriting, new MessageMaps
{
ActionTypeTextResourceName = "MoveActionType",
ActionTextResourceName = "FolderMovedWithOverwriting",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FoldersModule"
}
},
{
MessageAction.FolderMovedToTrash, new MessageMaps
{
ActionTypeTextResourceName = "MoveActionType",
ActionTextResourceName = "FolderMovedToTrash",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FoldersModule"
}
},
{
MessageAction.FolderDeleted, new MessageMaps
{
ActionTypeTextResourceName = "DeleteActionType",
ActionTextResourceName = "FolderDeleted",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FoldersModule"
}
},
{
MessageAction.ThirdPartyCreated, new MessageMaps
{
ActionTypeTextResourceName = "CreateActionType",
ActionTextResourceName = "ThirdPartyCreated",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "DocumentsSettingsModule"
}
},
{
MessageAction.ThirdPartyUpdated, new MessageMaps
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "ThirdPartyUpdated",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "DocumentsSettingsModule"
}
},
{
MessageAction.ThirdPartyDeleted, new MessageMaps
{
ActionTypeTextResourceName = "DeleteActionType",
ActionTextResourceName = "ThirdPartyDeleted",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "DocumentsSettingsModule"
}
},
{
MessageAction.DocumentsThirdPartySettingsUpdated, new MessageMaps
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "DocumentsThirdPartySettingsUpdated",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "DocumentsSettingsModule"
}
},
{
MessageAction.DocumentsOverwritingSettingsUpdated, new MessageMaps
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "DocumentsOverwritingSettingsUpdated",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "DocumentsSettingsModule"
}
},
{
MessageAction.DocumentsForcesave, new MessageMaps
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "DocumentsForcesave",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "DocumentsSettingsModule"
}
},
{
MessageAction.DocumentsStoreForcesave, new MessageMaps
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "DocumentsStoreForcesave",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "DocumentsSettingsModule"
}
},
{
MessageAction.DocumentsUploadingFormatsSettingsUpdated, new MessageMaps
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "DocumentsUploadingFormatsSettingsUpdated",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "DocumentsSettingsModule"
}
},
{
MessageAction.FileConverted, new MessageMaps
{
ActionTypeTextResourceName = "CreateActionType",
ActionTextResourceName = "FileConverted",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileSendAccessLink, new MessageMaps
{
ActionTypeTextResourceName = "SendActionType",
ActionTextResourceName = "FileSendAccessLink",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileChangeOwner, new MessageMaps
{
ActionTypeTextResourceName = "SendActionType",
ActionTextResourceName = "FileChangeOwner",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.DocumentSignComplete, new MessageMaps
{
ActionTypeTextResourceName = "SendActionType",
ActionTextResourceName = "FilesDocumentSigned",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.DocumentSendToSign, new MessageMaps
{
ActionTypeTextResourceName = "SendActionType",
ActionTextResourceName = "FilesRequestSign",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
};
}
}
ActionTypeTextResourceName = "CreateActionType",
ActionTextResourceName = "FileCreated",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileRenamed, new MessageMaps
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "FileRenamed",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileUpdated, new MessageMaps
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "FileUpdated",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.UserFileUpdated, new MessageMaps
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "UserFileUpdated",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileCreatedVersion, new MessageMaps
{
ActionTypeTextResourceName = "CreateActionType",
ActionTextResourceName = "FileCreatedVersion",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileDeletedVersion, new MessageMaps
{
ActionTypeTextResourceName = "DeleteActionType",
ActionTextResourceName = "FileDeletedVersion",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileRestoreVersion, new MessageMaps
{
ActionTypeTextResourceName = "CreateActionType",
ActionTextResourceName = "FileRestoreVersion",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileUpdatedRevisionComment, new MessageMaps
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "FileUpdatedRevisionComment",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileLocked, new MessageMaps
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "FileLocked",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileUnlocked, new MessageMaps
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "FileUnlocked",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileUpdatedAccess, new MessageMaps
{
ActionTypeTextResourceName = "UpdateAccessActionType",
ActionTextResourceName = "FileUpdatedAccess",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileDownloaded, new MessageMaps
{
ActionTypeTextResourceName = "DownloadActionType",
ActionTextResourceName = "FileDownloaded",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileDownloadedAs, new MessageMaps
{
ActionTypeTextResourceName = "DownloadActionType",
ActionTextResourceName = "FileDownloadedAs",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileUploaded, new MessageMaps
{
ActionTypeTextResourceName = "UploadActionType",
ActionTextResourceName = "FileUploaded",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileImported, new MessageMaps
{
ActionTypeTextResourceName = "ImportActionType",
ActionTextResourceName = "FileImported",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileCopied, new MessageMaps
{
ActionTypeTextResourceName = "CopyActionType",
ActionTextResourceName = "FileCopied",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileCopiedWithOverwriting, new MessageMaps
{
ActionTypeTextResourceName = "CopyActionType",
ActionTextResourceName = "FileCopiedWithOverwriting",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileMoved, new MessageMaps
{
ActionTypeTextResourceName = "MoveActionType",
ActionTextResourceName = "FileMoved",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileMovedWithOverwriting, new MessageMaps
{
ActionTypeTextResourceName = "MoveActionType",
ActionTextResourceName = "FileMovedWithOverwriting",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileMovedToTrash, new MessageMaps
{
ActionTypeTextResourceName = "MoveActionType",
ActionTextResourceName = "FileMovedToTrash",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileDeleted, new MessageMaps
{
ActionTypeTextResourceName = "DeleteActionType",
ActionTextResourceName = "FileDeleted",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FolderCreated, new MessageMaps
{
ActionTypeTextResourceName = "CreateActionType",
ActionTextResourceName = "FolderCreated",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FoldersModule"
}
},
{
MessageAction.FolderRenamed, new MessageMaps
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "FolderRenamed",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FoldersModule"
}
},
{
MessageAction.FolderUpdatedAccess, new MessageMaps
{
ActionTypeTextResourceName = "UpdateAccessActionType",
ActionTextResourceName = "FolderUpdatedAccess",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FoldersModule"
}
},
{
MessageAction.FolderCopied, new MessageMaps
{
ActionTypeTextResourceName = "CopyActionType",
ActionTextResourceName = "FolderCopied",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FoldersModule"
}
},
{
MessageAction.FolderCopiedWithOverwriting, new MessageMaps
{
ActionTypeTextResourceName = "CopyActionType",
ActionTextResourceName = "FolderCopiedWithOverwriting",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FoldersModule"
}
},
{
MessageAction.FolderMoved, new MessageMaps
{
ActionTypeTextResourceName = "MoveActionType",
ActionTextResourceName = "FolderMoved",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FoldersModule"
}
},
{
MessageAction.FolderMovedWithOverwriting, new MessageMaps
{
ActionTypeTextResourceName = "MoveActionType",
ActionTextResourceName = "FolderMovedWithOverwriting",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FoldersModule"
}
},
{
MessageAction.FolderMovedToTrash, new MessageMaps
{
ActionTypeTextResourceName = "MoveActionType",
ActionTextResourceName = "FolderMovedToTrash",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FoldersModule"
}
},
{
MessageAction.FolderDeleted, new MessageMaps
{
ActionTypeTextResourceName = "DeleteActionType",
ActionTextResourceName = "FolderDeleted",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FoldersModule"
}
},
{
MessageAction.ThirdPartyCreated, new MessageMaps
{
ActionTypeTextResourceName = "CreateActionType",
ActionTextResourceName = "ThirdPartyCreated",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "DocumentsSettingsModule"
}
},
{
MessageAction.ThirdPartyUpdated, new MessageMaps
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "ThirdPartyUpdated",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "DocumentsSettingsModule"
}
},
{
MessageAction.ThirdPartyDeleted, new MessageMaps
{
ActionTypeTextResourceName = "DeleteActionType",
ActionTextResourceName = "ThirdPartyDeleted",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "DocumentsSettingsModule"
}
},
{
MessageAction.DocumentsThirdPartySettingsUpdated, new MessageMaps
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "DocumentsThirdPartySettingsUpdated",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "DocumentsSettingsModule"
}
},
{
MessageAction.DocumentsOverwritingSettingsUpdated, new MessageMaps
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "DocumentsOverwritingSettingsUpdated",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "DocumentsSettingsModule"
}
},
{
MessageAction.DocumentsForcesave, new MessageMaps
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "DocumentsForcesave",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "DocumentsSettingsModule"
}
},
{
MessageAction.DocumentsStoreForcesave, new MessageMaps
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "DocumentsStoreForcesave",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "DocumentsSettingsModule"
}
},
{
MessageAction.DocumentsUploadingFormatsSettingsUpdated, new MessageMaps
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "DocumentsUploadingFormatsSettingsUpdated",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "DocumentsSettingsModule"
}
},
{
MessageAction.FileConverted, new MessageMaps
{
ActionTypeTextResourceName = "CreateActionType",
ActionTextResourceName = "FileConverted",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileSendAccessLink, new MessageMaps
{
ActionTypeTextResourceName = "SendActionType",
ActionTextResourceName = "FileSendAccessLink",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.FileChangeOwner, new MessageMaps
{
ActionTypeTextResourceName = "SendActionType",
ActionTextResourceName = "FileChangeOwner",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.DocumentSignComplete, new MessageMaps
{
ActionTypeTextResourceName = "SendActionType",
ActionTextResourceName = "FilesDocumentSigned",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
},
{
MessageAction.DocumentSendToSign, new MessageMaps
{
ActionTypeTextResourceName = "SendActionType",
ActionTextResourceName = "FilesRequestSign",
ProductResourceName = "DocumentsProduct",
ModuleResourceName = "FilesModule"
}
}
};
}

View File

@ -23,42 +23,39 @@
*
*/
namespace ASC.AuditTrail.Mappers
namespace ASC.AuditTrail.Mappers;
internal static class LoginActionsMapper
{
internal static class LoginActionsMapper
{
public static Dictionary<MessageAction, MessageMaps> GetMaps()
public static Dictionary<MessageAction, MessageMaps> GetMaps() =>
new Dictionary<MessageAction, MessageMaps>
{
return new Dictionary<MessageAction, MessageMaps>
{
{MessageAction.LoginSuccess, new MessageMaps {ActionTextResourceName = "LoginSuccess"}},
{MessageAction.LoginSuccessViaSocialAccount, new MessageMaps {ActionTextResourceName = "LoginSuccessSocialAccount"}},
{MessageAction.LoginSuccessViaSocialApp, new MessageMaps {ActionTextResourceName = "LoginSuccessSocialApp"}},
{MessageAction.LoginSuccessViaSms, new MessageMaps {ActionTextResourceName = "LoginSuccessViaSms"}},
{MessageAction.LoginSuccessViaApi, new MessageMaps {ActionTextResourceName = "LoginSuccessViaApi"}},
{MessageAction.LoginSuccessViaApiSms, new MessageMaps {ActionTextResourceName = "LoginSuccessViaApiSms"}},
{MessageAction.LoginSuccessViaApiTfa, new MessageMaps {ActionTextResourceName = "LoginSuccessViaApiTfa"}},
{MessageAction.LoginSuccessViaApiSocialAccount, new MessageMaps {ActionTextResourceName = "LoginSuccessViaSocialAccount"}},
{MessageAction.LoginSuccessViaSSO, new MessageMaps {ActionTextResourceName = "LoginSuccessViaSSO"}},
{MessageAction.LoginSuccesViaTfaApp, new MessageMaps {ActionTextResourceName = "LoginSuccesViaTfaApp"}},
{MessageAction.LoginFailInvalidCombination, new MessageMaps {ActionTextResourceName = "LoginFailInvalidCombination"}},
{MessageAction.LoginFailSocialAccountNotFound, new MessageMaps {ActionTextResourceName = "LoginFailSocialAccountNotFound"}},
{MessageAction.LoginFailDisabledProfile, new MessageMaps {ActionTextResourceName = "LoginFailDisabledProfile"}},
{MessageAction.LoginFail, new MessageMaps {ActionTextResourceName = "LoginFail"}},
{MessageAction.LoginFailViaSms, new MessageMaps {ActionTextResourceName = "LoginFailViaSms"}},
{MessageAction.LoginFailViaApi, new MessageMaps {ActionTextResourceName = "LoginFailViaApi"}},
{MessageAction.LoginFailViaApiSms, new MessageMaps {ActionTextResourceName = "LoginFailViaApiSms"}},
{MessageAction.LoginFailViaApiTfa, new MessageMaps {ActionTextResourceName = "LoginFailViaApiTfa"}},
{MessageAction.LoginFailViaApiSocialAccount, new MessageMaps {ActionTextResourceName = "LoginFailViaApiSocialAccount"}},
{MessageAction.LoginFailViaTfaApp, new MessageMaps {ActionTextResourceName = "LoginFailViaTfaApp"}},
{MessageAction.LoginFailIpSecurity, new MessageMaps {ActionTextResourceName = "LoginFailIpSecurity"}},
{MessageAction.LoginFailViaSSO, new MessageMaps {ActionTextResourceName = "LoginFailViaSSO"}},
{MessageAction.LoginFailBruteForce, new MessageMaps {ActionTextResourceName = "LoginFailBruteForce"}},
{MessageAction.LoginFailRecaptcha, new MessageMaps {ActionTextResourceName = "LoginFailRecaptcha"}},
{MessageAction.Logout, new MessageMaps {ActionTextResourceName = "Logout"}},
{MessageAction.SessionStarted, new MessageMaps {ActionTextResourceName = "SessionStarted"}},
{MessageAction.SessionCompleted, new MessageMaps {ActionTextResourceName = "SessionCompleted"}}
};
}
}
{ MessageAction.LoginSuccess, new MessageMaps { ActionTextResourceName = "LoginSuccess"} },
{ MessageAction.LoginSuccessViaSocialAccount, new MessageMaps { ActionTextResourceName = "LoginSuccessSocialAccount"} },
{ MessageAction.LoginSuccessViaSocialApp, new MessageMaps { ActionTextResourceName = "LoginSuccessSocialApp"} },
{ MessageAction.LoginSuccessViaSms, new MessageMaps { ActionTextResourceName = "LoginSuccessViaSms"} },
{ MessageAction.LoginSuccessViaApi, new MessageMaps { ActionTextResourceName = "LoginSuccessViaApi"} },
{ MessageAction.LoginSuccessViaApiSms, new MessageMaps { ActionTextResourceName = "LoginSuccessViaApiSms"} },
{ MessageAction.LoginSuccessViaApiTfa, new MessageMaps { ActionTextResourceName = "LoginSuccessViaApiTfa"} },
{ MessageAction.LoginSuccessViaApiSocialAccount, new MessageMaps { ActionTextResourceName = "LoginSuccessViaSocialAccount"} },
{ MessageAction.LoginSuccessViaSSO, new MessageMaps { ActionTextResourceName = "LoginSuccessViaSSO"} },
{ MessageAction.LoginSuccesViaTfaApp, new MessageMaps { ActionTextResourceName = "LoginSuccesViaTfaApp"} },
{ MessageAction.LoginFailInvalidCombination, new MessageMaps { ActionTextResourceName = "LoginFailInvalidCombination" } },
{ MessageAction.LoginFailSocialAccountNotFound, new MessageMaps { ActionTextResourceName = "LoginFailSocialAccountNotFound" } },
{ MessageAction.LoginFailDisabledProfile, new MessageMaps { ActionTextResourceName = "LoginFailDisabledProfile" } },
{ MessageAction.LoginFail, new MessageMaps { ActionTextResourceName = "LoginFail" } },
{ MessageAction.LoginFailViaSms, new MessageMaps { ActionTextResourceName = "LoginFailViaSms" } },
{ MessageAction.LoginFailViaApi, new MessageMaps { ActionTextResourceName = "LoginFailViaApi" } },
{ MessageAction.LoginFailViaApiSms, new MessageMaps { ActionTextResourceName = "LoginFailViaApiSms" } },
{ MessageAction.LoginFailViaApiTfa, new MessageMaps { ActionTextResourceName = "LoginFailViaApiTfa" } },
{ MessageAction.LoginFailViaApiSocialAccount, new MessageMaps { ActionTextResourceName = "LoginFailViaApiSocialAccount" } },
{ MessageAction.LoginFailViaTfaApp, new MessageMaps { ActionTextResourceName = "LoginFailViaTfaApp" } },
{ MessageAction.LoginFailIpSecurity, new MessageMaps { ActionTextResourceName = "LoginFailIpSecurity" } },
{ MessageAction.LoginFailViaSSO, new MessageMaps { ActionTextResourceName = "LoginFailViaSSO"}},
{ MessageAction.LoginFailBruteForce, new MessageMaps { ActionTextResourceName = "LoginFailBruteForce" } },
{ MessageAction.LoginFailRecaptcha, new MessageMaps { ActionTextResourceName = "LoginFailRecaptcha" } },
{ MessageAction.Logout, new MessageMaps { ActionTextResourceName = "Logout" } },
{ MessageAction.SessionStarted, new MessageMaps { ActionTextResourceName = "SessionStarted" } },
{ MessageAction.SessionCompleted, new MessageMaps { ActionTextResourceName = "SessionCompleted" } }
};
}

View File

@ -26,63 +26,60 @@
*
*/
namespace ASC.AuditTrail.Mappers;
namespace ASC.AuditTrail.Mappers
internal class MessageMaps
{
internal class MessageMaps
public string ActionTypeTextResourceName { get; set; }
public string ActionTextResourceName { get; set; }
public string ProductResourceName { get; set; }
public string ModuleResourceName { get; set; }
public string GetActionTypeText()
{
public string ActionTypeTextResourceName { get; set; }
public string ActionTextResourceName { get; set; }
public string ProductResourceName { get; set; }
public string ModuleResourceName { get; set; }
public string GetActionTypeText()
try
{
try
{
return AuditReportResource.ResourceManager.GetString(ActionTypeTextResourceName);
}
catch
{
return null;
}
return AuditReportResource.ResourceManager.GetString(ActionTypeTextResourceName);
}
public string GetActionText()
catch
{
try
{
return AuditReportResource.ResourceManager.GetString(ActionTextResourceName);
}
catch
{
return null;
}
return null;
}
}
public string GetProduct()
public string GetActionText()
{
try
{
try
{
return AuditReportResource.ResourceManager.GetString(ProductResourceName);
}
catch
{
return null;
}
return AuditReportResource.ResourceManager.GetString(ActionTextResourceName);
}
public string GetModule()
catch
{
try
{
return AuditReportResource.ResourceManager.GetString(ModuleResourceName);
}
catch
{
return null;
}
return null;
}
}
public string GetProduct()
{
try
{
return AuditReportResource.ResourceManager.GetString(ProductResourceName);
}
catch
{
return null;
}
}
public string GetModule()
{
try
{
return AuditReportResource.ResourceManager.GetString(ModuleResourceName);
}
catch
{
return null;
}
}
}

View File

@ -23,14 +23,13 @@
*
*/
namespace ASC.AuditTrail.Mappers
namespace ASC.AuditTrail.Mappers;
internal static class OthersActionsMapper
{
internal static class OthersActionsMapper
{
public static Dictionary<MessageAction, MessageMaps> GetMaps()
public static Dictionary<MessageAction, MessageMaps> GetMaps() =>
new Dictionary<MessageAction, MessageMaps>
{
return new Dictionary<MessageAction, MessageMaps>
{
{
MessageAction.ContactAdminMailSent, new MessageMaps
{
@ -39,7 +38,5 @@ namespace ASC.AuditTrail.Mappers
ProductResourceName = "OthersProduct"
}
}
};
}
}
};
}

View File

@ -23,175 +23,174 @@
*
*/
namespace ASC.AuditTrail.Mappers
namespace ASC.AuditTrail.Mappers;
internal static class PeopleActionMapper
{
internal static class PeopleActionMapper
{
public static Dictionary<MessageAction, MessageMaps> GetMaps()
public static Dictionary<MessageAction, MessageMaps> GetMaps() =>
new Dictionary<MessageAction, MessageMaps>
{
return new Dictionary<MessageAction, MessageMaps>
{
{
MessageAction.UserCreated, new MessageMaps
{
{
ActionTypeTextResourceName = "CreateActionType",
ActionTextResourceName = "UserCreated",
ProductResourceName = "PeopleProduct",
ModuleResourceName = "UsersModule"
}
}
},
{
MessageAction.GuestCreated, new MessageMaps
{
{
ActionTypeTextResourceName = "CreateActionType",
ActionTextResourceName = "GuestCreated",
ProductResourceName = "PeopleProduct",
ModuleResourceName = "UsersModule"
}
}
},
{
MessageAction.UserCreatedViaInvite, new MessageMaps
{
{
ActionTypeTextResourceName = "CreateActionType",
ActionTextResourceName = "UserCreatedViaInvite",
ProductResourceName = "PeopleProduct",
ModuleResourceName = "UsersModule"
}
}
},
{
MessageAction.GuestCreatedViaInvite, new MessageMaps
{
{
ActionTypeTextResourceName = "CreateActionType",
ActionTextResourceName = "GuestCreatedViaInvite",
ProductResourceName = "PeopleProduct",
ModuleResourceName = "UsersModule"
}
}
},
{
MessageAction.UserActivated, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "UserActivated",
ProductResourceName = "PeopleProduct",
ModuleResourceName = "UsersModule"
}
}
},
{
MessageAction.GuestActivated, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "GuestActivated",
ProductResourceName = "PeopleProduct",
ModuleResourceName = "UsersModule"
}
}
},
{
MessageAction.UserUpdated, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "UserUpdated",
ProductResourceName = "PeopleProduct",
ModuleResourceName = "UsersModule"
}
}
},
{
MessageAction.UserUpdatedMobileNumber, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "UserUpdatedMobileNumber",
ProductResourceName = "PeopleProduct",
ModuleResourceName = "UsersModule"
}
}
},
{
MessageAction.UserUpdatedLanguage, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "UserUpdatedLanguage",
ProductResourceName = "PeopleProduct",
ModuleResourceName = "UsersModule"
}
}
},
{
MessageAction.UserAddedAvatar, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "UserAddedAvatar",
ProductResourceName = "PeopleProduct",
ModuleResourceName = "UsersModule"
}
}
},
{
MessageAction.UserDeletedAvatar, new MessageMaps
{
{
ActionTypeTextResourceName = "DeleteActionType",
ActionTextResourceName = "UserDeletedAvatar",
ProductResourceName = "PeopleProduct",
ModuleResourceName = "UsersModule"
}
}
},
{
MessageAction.UserUpdatedAvatarThumbnails, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "UserUpdatedAvatarThumbnails",
ProductResourceName = "PeopleProduct",
ModuleResourceName = "UsersModule"
}
}
},
{
MessageAction.UserLinkedSocialAccount, new MessageMaps
{
{
ActionTypeTextResourceName = "LinkActionType",
ActionTextResourceName = "UserLinkedSocialAccount",
ProductResourceName = "PeopleProduct",
ModuleResourceName = "UsersModule"
}
}
},
{
MessageAction.UserUnlinkedSocialAccount, new MessageMaps
{
{
ActionTypeTextResourceName = "UnlinkActionType",
ActionTextResourceName = "UserUnlinkedSocialAccount",
ProductResourceName = "PeopleProduct",
ModuleResourceName = "UsersModule"
}
}
},
{
MessageAction.UserSentActivationInstructions, new MessageMaps
{
{
ActionTypeTextResourceName = "SendActionType",
ActionTextResourceName = "UserSentActivationInstructions",
ProductResourceName = "PeopleProduct",
ModuleResourceName = "UsersModule"
}
}
},
{
MessageAction.UserSentEmailChangeInstructions, new MessageMaps
{
{
ActionTypeTextResourceName = "SendActionType",
ActionTextResourceName = "UserSentEmailInstructions",
ProductResourceName = "PeopleProduct",
ModuleResourceName = "UsersModule"
}
}
},
{
MessageAction.UserSentPasswordChangeInstructions, new MessageMaps
{
{
ActionTypeTextResourceName = "SendActionType",
ActionTextResourceName = "UserSentPasswordInstructions",
ProductResourceName = "PeopleProduct",
ModuleResourceName = "UsersModule"
}
}
},
{
MessageAction.UserSentDeleteInstructions, new MessageMaps
{
{
ActionTypeTextResourceName = "SendActionType",
ActionTextResourceName = "UserSentDeleteInstructions",
ProductResourceName = "PeopleProduct",
ModuleResourceName = "UsersModule"
}
}
},
{
MessageAction.UserUpdatedEmail, new MessageMaps
@ -204,149 +203,147 @@ namespace ASC.AuditTrail.Mappers
},
{
MessageAction.UserUpdatedPassword, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "UserUpdatedPassword",
ProductResourceName = "PeopleProduct",
ModuleResourceName = "UsersModule"
}
}
},
{
MessageAction.UserDeleted, new MessageMaps
{
{
ActionTypeTextResourceName = "DeleteActionType",
ActionTextResourceName = "UserDeleted",
ProductResourceName = "PeopleProduct",
ModuleResourceName = "UsersModule"
}
}
},
{
MessageAction.UsersUpdatedType, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "UsersUpdatedType",
ProductResourceName = "PeopleProduct",
ModuleResourceName = "UsersModule"
}
}
},
{
MessageAction.UsersUpdatedStatus, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "UsersUpdatedStatus",
ProductResourceName = "PeopleProduct",
ModuleResourceName = "UsersModule"
}
}
},
{
MessageAction.UsersSentActivationInstructions, new MessageMaps
{
{
ActionTypeTextResourceName = "SendActionType",
ActionTextResourceName = "UsersSentActivationInstructions",
ProductResourceName = "PeopleProduct",
ModuleResourceName = "UsersModule"
}
}
},
{
MessageAction.UsersDeleted, new MessageMaps
{
{
ActionTypeTextResourceName = "DeleteActionType",
ActionTextResourceName = "UsersDeleted",
ProductResourceName = "PeopleProduct",
ModuleResourceName = "UsersModule"
}
}
},
{
MessageAction.SentInviteInstructions, new MessageMaps
{
{
ActionTypeTextResourceName = "SendActionType",
ActionTextResourceName = "SentInviteInstructions",
ProductResourceName = "PeopleProduct",
ModuleResourceName = "UsersModule"
}
}
},
{
MessageAction.UserImported, new MessageMaps
{
{
ActionTypeTextResourceName = "ImportActionType",
ActionTextResourceName = "UserImported",
ProductResourceName = "PeopleProduct",
ModuleResourceName = "UsersModule"
}
}
},
{
MessageAction.GuestImported, new MessageMaps
{
{
ActionTypeTextResourceName = "ImportActionType",
ActionTextResourceName = "GuestImported",
ProductResourceName = "PeopleProduct",
ModuleResourceName = "UsersModule"
}
}
},
{
MessageAction.GroupCreated, new MessageMaps
{
{
ActionTypeTextResourceName = "CreateActionType",
ActionTextResourceName = "GroupCreated",
ProductResourceName = "PeopleProduct",
ModuleResourceName = "GroupsModule"
}
}
},
{
MessageAction.GroupUpdated, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "GroupUpdated",
ProductResourceName = "PeopleProduct",
ModuleResourceName = "GroupsModule"
}
}
},
{
MessageAction.GroupDeleted, new MessageMaps
{
{
ActionTypeTextResourceName = "DeleteActionType",
ActionTextResourceName = "GroupDeleted",
ProductResourceName = "PeopleProduct",
ModuleResourceName = "GroupsModule"
}
}
},
{
MessageAction.UserDataReassigns, new MessageMaps
{
{
ActionTypeTextResourceName = "ReassignsActionType",
ActionTextResourceName = "UserDataReassigns",
ProductResourceName = "PeopleProduct",
ModuleResourceName = "UsersModule"
}
}
},
{
MessageAction.UserDataRemoving, new MessageMaps
{
{
ActionTypeTextResourceName = "DeleteActionType",
ActionTextResourceName = "UserDataRemoving",
ProductResourceName = "PeopleProduct",
ModuleResourceName = "UsersModule"
}
}
},
{
MessageAction.UserConnectedTfaApp, new MessageMaps
{
{
ActionTypeTextResourceName = "LinkActionType",
ActionTextResourceName = "UserTfaGenerateCodes",
ProductResourceName = "PeopleProduct",
ModuleResourceName = "UsersModule"
}
}
},
{
MessageAction.UserDisconnectedTfaApp, new MessageMaps
{
{
ActionTypeTextResourceName = "DeleteActionType",
ActionTextResourceName = "UserTfaDisconnected",
ProductResourceName = "PeopleProduct",
ModuleResourceName = "UsersModule"
}
}
}
};
}
}
};
}

View File

@ -23,78 +23,77 @@
*
*/
namespace ASC.AuditTrail.Mappers
namespace ASC.AuditTrail.Mappers;
internal static class ProjectsActionsMapper
{
internal static class ProjectsActionsMapper
{
public static Dictionary<MessageAction, MessageMaps> GetMaps()
public static Dictionary<MessageAction, MessageMaps> GetMaps() =>
new Dictionary<MessageAction, MessageMaps>
{
return new Dictionary<MessageAction, MessageMaps>
{
#region projects
{
MessageAction.ProjectCreated, new MessageMaps
{
{
ActionTypeTextResourceName = "CreateActionType",
ActionTextResourceName = "ProjectCreated",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "ProjectsModule"
}
}
},
{
MessageAction.ProjectCreatedFromTemplate, new MessageMaps
{
{
ActionTypeTextResourceName = "CreateActionType",
ActionTextResourceName = "ProjectCreatedFromTemplate",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "ProjectsModule"
}
}
},
{
MessageAction.ProjectUpdated, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "ProjectUpdated",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "ProjectsModule"
}
}
},
{
MessageAction.ProjectUpdatedStatus, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "ProjectUpdatedStatus",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "ProjectsModule"
}
}
},
{
MessageAction.ProjectFollowed, new MessageMaps
{
{
ActionTypeTextResourceName = "FollowActionType",
ActionTextResourceName = "ProjectFollowed",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "ProjectsModule"
}
}
},
{
MessageAction.ProjectUnfollowed, new MessageMaps
{
{
ActionTypeTextResourceName = "UnfollowActionType",
ActionTextResourceName = "ProjectUnfollowed",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "ProjectsModule"
}
}
},
{
MessageAction.ProjectDeleted, new MessageMaps
{
{
ActionTypeTextResourceName = "DeleteActionType",
ActionTextResourceName = "ProjectDeleted",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "ProjectsModule"
}
}
},
#endregion
@ -103,30 +102,30 @@ namespace ASC.AuditTrail.Mappers
{
MessageAction.ProjectDeletedMember, new MessageMaps
{
{
ActionTypeTextResourceName = "DeleteActionType",
ActionTextResourceName = "ProjectDeletedMember",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "ProjectsModule"
}
}
},
{
MessageAction.ProjectUpdatedTeam, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "ProjectUpdatedTeam",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "ProjectsModule"
}
}
},
{
MessageAction.ProjectUpdatedMemberRights, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateAccessActionType",
ActionTextResourceName = "ProjectUpdatedMemberRights",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "ProjectsModule"
}
}
},
#endregion
@ -135,48 +134,48 @@ namespace ASC.AuditTrail.Mappers
{
MessageAction.ProjectLinkedCompany, new MessageMaps
{
{
ActionTypeTextResourceName = "LinkActionType",
ActionTextResourceName = "ProjectLinkedCompany",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "ProjectsModule"
}
}
},
{
MessageAction.ProjectUnlinkedCompany, new MessageMaps
{
{
ActionTypeTextResourceName = "UnlinkActionType",
ActionTextResourceName = "ProjectUnlinkedCompany",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "ProjectsModule"
}
}
},
{
MessageAction.ProjectLinkedPerson, new MessageMaps
{
{
ActionTypeTextResourceName = "LinkActionType",
ActionTextResourceName = "ProjectLinkedPerson",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "ProjectsModule"
}
}
},
{
MessageAction.ProjectUnlinkedPerson, new MessageMaps
{
{
ActionTypeTextResourceName = "UnlinkActionType",
ActionTextResourceName = "ProjectUnlinkedPerson",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "ProjectsModule"
}
}
},
{
MessageAction.ProjectLinkedContacts, new MessageMaps
{
{
ActionTypeTextResourceName = "LinkActionType",
ActionTextResourceName = "ProjectLinkedContacts",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "ProjectsModule"
}
}
},
#endregion
@ -185,39 +184,39 @@ namespace ASC.AuditTrail.Mappers
{
MessageAction.MilestoneCreated, new MessageMaps
{
{
ActionTypeTextResourceName = "CreateActionType",
ActionTextResourceName = "MilestoneCreated",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "MilestonesModule"
}
}
},
{
MessageAction.MilestoneUpdated, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "MilestoneUpdated",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "MilestonesModule"
}
}
},
{
MessageAction.MilestoneUpdatedStatus, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "MilestoneUpdatedStatus",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "MilestonesModule"
}
}
},
{
MessageAction.MilestoneDeleted, new MessageMaps
{
{
ActionTypeTextResourceName = "DeleteActionType",
ActionTextResourceName = "MilestoneDeleted",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "MilestonesModule"
}
}
},
#endregion
@ -226,138 +225,138 @@ namespace ASC.AuditTrail.Mappers
{
MessageAction.TaskCreated, new MessageMaps
{
{
ActionTypeTextResourceName = "CreateActionType",
ActionTextResourceName = "TaskCreated",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "TasksModule"
}
}
},
{
MessageAction.TaskCreatedFromDiscussion, new MessageMaps
{
{
ActionTypeTextResourceName = "CreateActionType",
ActionTextResourceName = "TaskCreatedFromDiscussion",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "TasksModule"
}
}
},
{
MessageAction.TaskUpdated, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "TaskUpdated",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "TasksModule"
}
}
},
{
MessageAction.TaskUpdatedStatus, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "TaskUpdatedStatus",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "TasksModule"
}
}
},
{
MessageAction.TaskMovedToMilestone, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "TaskMovedToMilestone",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "TasksModule"
}
}
},
{
MessageAction.TaskUnlinkedMilestone, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "TaskUnlinkedMilestone",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "TasksModule"
}
}
},
{
MessageAction.TaskUpdatedFollowing, new MessageMaps
{
{
ActionTypeTextResourceName = "FollowActionType",
ActionTextResourceName = "TaskUpdatedFollowing",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "TasksModule"
}
}
},
{
MessageAction.TaskAttachedFiles, new MessageMaps
{
{
ActionTypeTextResourceName = "AttachActionType",
ActionTextResourceName = "TaskAttachedFiles",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "TasksModule"
}
}
},
{
MessageAction.TaskDetachedFile, new MessageMaps
{
{
ActionTypeTextResourceName = "DetachActionType",
ActionTextResourceName = "TaskDetachedFile",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "TasksModule"
}
}
},
{
MessageAction.TasksLinked, new MessageMaps
{
{
ActionTypeTextResourceName = "LinkActionType",
ActionTextResourceName = "TasksLinked",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "TasksModule"
}
}
},
{
MessageAction.TasksUnlinked, new MessageMaps
{
{
ActionTypeTextResourceName = "UnlinkActionType",
ActionTextResourceName = "TasksUnlinked",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "TasksModule"
}
}
},
{
MessageAction.TaskDeleted, new MessageMaps
{
{
ActionTypeTextResourceName = "DeleteActionType",
ActionTextResourceName = "TaskDeleted",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "TasksModule"
}
}
},
{
MessageAction.TaskCommentCreated, new MessageMaps
{
{
ActionTypeTextResourceName = "CreateActionType",
ActionTextResourceName = "TaskCommentCreated",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "TasksModule"
}
}
},
{
MessageAction.TaskCommentUpdated, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "TaskCommentUpdated",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "TasksModule"
}
}
},
{
MessageAction.TaskCommentDeleted, new MessageMaps
{
{
ActionTypeTextResourceName = "DeleteActionType",
ActionTextResourceName = "TaskCommentDeleted",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "TasksModule"
}
}
},
#endregion
@ -366,39 +365,39 @@ namespace ASC.AuditTrail.Mappers
{
MessageAction.SubtaskCreated, new MessageMaps
{
{
ActionTypeTextResourceName = "CreateActionType",
ActionTextResourceName = "SubtaskCreated",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "TasksModule"
}
}
},
{
MessageAction.SubtaskUpdated, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "SubtaskUpdated",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "TasksModule"
}
}
},
{
MessageAction.SubtaskUpdatedStatus, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "SubtaskUpdatedStatus",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "TasksModule"
}
}
},
{
MessageAction.SubtaskDeleted, new MessageMaps
{
{
ActionTypeTextResourceName = "DeleteActionType",
ActionTextResourceName = "SubtaskDeleted",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "TasksModule"
}
}
},
#endregion
@ -407,84 +406,84 @@ namespace ASC.AuditTrail.Mappers
{
MessageAction.DiscussionCreated, new MessageMaps
{
{
ActionTypeTextResourceName = "CreateActionType",
ActionTextResourceName = "DiscussionCreated",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "DiscussionsModule"
}
}
},
{
MessageAction.DiscussionUpdated, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "DiscussionUpdated",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "DiscussionsModule"
}
}
},
{
MessageAction.DiscussionUpdatedFollowing, new MessageMaps
{
{
ActionTypeTextResourceName = "FollowActionType",
ActionTextResourceName = "DiscussionUpdatedFollowing",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "DiscussionsModule"
}
}
},
{
MessageAction.DiscussionAttachedFiles, new MessageMaps
{
{
ActionTypeTextResourceName = "AttachActionType",
ActionTextResourceName = "DiscussionAttachedFiles",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "DiscussionsModule"
}
}
},
{
MessageAction.DiscussionDetachedFile, new MessageMaps
{
{
ActionTypeTextResourceName = "DetachActionType",
ActionTextResourceName = "DiscussionDetachedFile",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "DiscussionsModule"
}
}
},
{
MessageAction.DiscussionDeleted, new MessageMaps
{
{
ActionTypeTextResourceName = "DeleteActionType",
ActionTextResourceName = "DiscussionDeleted",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "DiscussionsModule"
}
}
},
{
MessageAction.DiscussionCommentCreated, new MessageMaps
{
{
ActionTypeTextResourceName = "CreateActionType",
ActionTextResourceName = "DiscussionCommentCreated",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "DiscussionsModule"
}
}
},
{
MessageAction.DiscussionCommentUpdated, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "DiscussionCommentUpdated",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "DiscussionsModule"
}
}
},
{
MessageAction.DiscussionCommentDeleted, new MessageMaps
{
{
ActionTypeTextResourceName = "DeleteActionType",
ActionTextResourceName = "DiscussionCommentDeleted",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "DiscussionsModule"
}
}
},
#endregion
@ -493,39 +492,39 @@ namespace ASC.AuditTrail.Mappers
{
MessageAction.TaskTimeCreated, new MessageMaps
{
{
ActionTypeTextResourceName = "CreateActionType",
ActionTextResourceName = "TaskTimeCreated",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "TimeTrackingModule"
}
}
},
{
MessageAction.TaskTimeUpdated, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "TaskTimeUpdated",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "TimeTrackingModule"
}
}
},
{
MessageAction.TaskTimesUpdatedStatus, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "TaskTimesUpdatedStatus",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "TimeTrackingModule"
}
}
},
{
MessageAction.TaskTimesDeleted, new MessageMaps
{
{
ActionTypeTextResourceName = "DeleteActionType",
ActionTextResourceName = "TaskTimesDeleted",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "TimeTrackingModule"
}
}
},
#endregion
@ -534,30 +533,30 @@ namespace ASC.AuditTrail.Mappers
{
MessageAction.ReportTemplateCreated, new MessageMaps
{
{
ActionTypeTextResourceName = "CreateActionType",
ActionTextResourceName = "ReportTemplateCreated",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "ReportsModule"
}
}
},
{
MessageAction.ReportTemplateUpdated, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "ReportTemplateUpdated",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "ReportsModule"
}
}
},
{
MessageAction.ReportTemplateDeleted, new MessageMaps
{
{
ActionTypeTextResourceName = "DeleteActionType",
ActionTextResourceName = "ReportTemplateDeleted",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "ReportsModule"
}
}
},
#endregion
@ -566,43 +565,41 @@ namespace ASC.AuditTrail.Mappers
{
MessageAction.ProjectTemplateCreated, new MessageMaps
{
{
ActionTypeTextResourceName = "CreateActionType",
ActionTextResourceName = "ProjectTemplateCreated",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "ProjectsSettingsModule"
}
}
},
{
MessageAction.ProjectTemplateUpdated, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "ProjectTemplateUpdated",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "ProjectsSettingsModule"
}
}
},
{
MessageAction.ProjectTemplateDeleted, new MessageMaps
{
{
ActionTypeTextResourceName = "DeleteActionType",
ActionTextResourceName = "ProjectTemplateDeleted",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "ProjectsSettingsModule"
}
}
},
{
MessageAction.ProjectsImportedFromBasecamp, new MessageMaps
{
{
ActionTypeTextResourceName = "ImportActionType",
ActionTextResourceName = "ProjectsImportedFromBasecamp",
ProductResourceName = "ProjectsProduct",
ModuleResourceName = "ProjectsModule"
}
}
},
#endregion
};
}
}
#endregion
};
}

View File

@ -23,456 +23,453 @@
*
*/
namespace ASC.AuditTrail.Mappers
namespace ASC.AuditTrail.Mappers;
internal static class SettingsActionsMapper
{
internal static class SettingsActionsMapper
{
public static Dictionary<MessageAction, MessageMaps> GetMaps()
public static Dictionary<MessageAction, MessageMaps> GetMaps() =>
new Dictionary<MessageAction, MessageMaps>
{
return new Dictionary<MessageAction, MessageMaps>
{
{
MessageAction.LanguageSettingsUpdated, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "LanguageSettingsUpdated",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "GeneralModule"
}
}
},
{
MessageAction.TimeZoneSettingsUpdated, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "TimeZoneSettingsUpdated",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "GeneralModule"
}
}
},
{
MessageAction.DnsSettingsUpdated, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "DnsSettingsUpdated",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "GeneralModule"
}
}
},
{
MessageAction.TrustedMailDomainSettingsUpdated, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "TrustedMailDomainSettingsUpdated",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "GeneralModule"
}
}
},
{
MessageAction.PasswordStrengthSettingsUpdated, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "PasswordStrengthSettingsUpdated",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "GeneralModule"
}
}
},
{
MessageAction.TwoFactorAuthenticationSettingsUpdated, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "TwoFactorAuthenticationSettingsUpdated",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "GeneralModule"
}
}
},
{
MessageAction.TwoFactorAuthenticationDisabled, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "TwoFactorAuthenticationSettingsDisabled",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "GeneralModule"
}
}
},
{
MessageAction.TwoFactorAuthenticationEnabledBySms, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "TwoFactorAuthenticationSettingsEnabledBySms",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "GeneralModule"
}
}
},
{
MessageAction.TwoFactorAuthenticationEnabledByTfaApp, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "TwoFactorAuthenticationSettingsEnabledByTfaApp",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "GeneralModule"
}
}
},
{
MessageAction.AdministratorMessageSettingsUpdated, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "AdministratorMessageSettingsUpdated",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "GeneralModule"
}
}
},
{
MessageAction.DefaultStartPageSettingsUpdated, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "DefaultStartPageSettingsUpdated",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "GeneralModule"
}
}
},
{
MessageAction.ProductsListUpdated, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "ProductsListUpdated",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "ProductsModule"
}
}
},
{
MessageAction.OwnerUpdated, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "OwnerChanged",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "ProductsModule"
}
}
},
{
MessageAction.AdministratorAdded, new MessageMaps
{
{
ActionTypeTextResourceName = "CreateActionType",
ActionTextResourceName = "AdministratorAdded",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "ProductsModule"
}
}
},
{
MessageAction.UsersOpenedProductAccess, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateAccessActionType",
ActionTextResourceName = "ProductAccessOpenedForUsers",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "ProductsModule"
}
}
},
{
MessageAction.GroupsOpenedProductAccess, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateAccessActionType",
ActionTextResourceName = "ProductAccessOpenedForGroups",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "ProductsModule"
}
}
},
{
MessageAction.ProductAccessOpened, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateAccessActionType",
ActionTextResourceName = "ProductAccessOpened",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "ProductsModule"
}
}
},
{
MessageAction.ProductAccessRestricted, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateAccessActionType",
ActionTextResourceName = "ProductAccessRestricted",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "ProductsModule"
}
}
},
{
MessageAction.ProductAddedAdministrator, new MessageMaps
{
{
ActionTypeTextResourceName = "CreateActionType",
ActionTextResourceName = "ProductAddedAdministrator",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "ProductsModule"
}
}
},
{
MessageAction.ProductDeletedAdministrator, new MessageMaps
{
{
ActionTypeTextResourceName = "DeleteActionType",
ActionTextResourceName = "ProductDeletedAdministrator",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "ProductsModule"
}
}
},
{
MessageAction.AdministratorDeleted, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateAccessActionType",
ActionTextResourceName = "AdministratorDeleted",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "ProductsModule"
}
}
},
{
MessageAction.AdministratorOpenedFullAccess, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateAccessActionType",
ActionTextResourceName = "AdministratorOpenedFullAccess",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "ProductsModule"
}
}
},
{
MessageAction.GreetingSettingsUpdated, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "GreetingSettingsUpdated",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "ProductsModule"
}
}
},
{
MessageAction.TeamTemplateChanged, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "TeamTemplateChanged",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "ProductsModule"
}
}
},
{
MessageAction.ColorThemeChanged, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "ColorThemeChanged",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "ProductsModule"
}
}
},
{
MessageAction.OwnerSentPortalDeactivationInstructions, new MessageMaps
{
{
ActionTypeTextResourceName = "SendActionType",
ActionTextResourceName = "OwnerSentPortalDeactivationInstructions",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "ProductsModule"
}
}
},
{
MessageAction.OwnerSentPortalDeleteInstructions, new MessageMaps
{
{
ActionTypeTextResourceName = "SendActionType",
ActionTextResourceName = "OwnerSentPortalDeleteInstructions",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "ProductsModule"
}
}
},
{
MessageAction.LoginHistoryReportDownloaded, new MessageMaps
{
{
ActionTypeTextResourceName = "DownloadActionType",
ActionTextResourceName = "LoginHistoryReportDownloaded",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "ProductsModule"
}
}
},
{
MessageAction.AuditTrailReportDownloaded, new MessageMaps
{
{
ActionTypeTextResourceName = "DownloadActionType",
ActionTextResourceName = "AuditTrailReportDownloaded",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "ProductsModule"
}
}
},
{
MessageAction.PortalDeactivated, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "PortalDeactivated",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "ProductsModule"
}
}
},
{
MessageAction.PortalDeleted, new MessageMaps
{
{
ActionTypeTextResourceName = "DeleteActionType",
ActionTextResourceName = "PortalDeleted",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "ProductsModule"
}
}
},
{
MessageAction.OwnerSentChangeOwnerInstructions, new MessageMaps
{
{
ActionTypeTextResourceName = "SendActionType",
ActionTextResourceName = "OwnerSentChangeOwnerInstructions",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "ProductsModule"
}
}
},
{
MessageAction.SSOEnabled, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "SSOEnabled",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "ProductsModule"
}
}
},
{
MessageAction.SSODisabled, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "SSODisabled",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "ProductsModule"
}
}
},
{
MessageAction.PortalAccessSettingsUpdated, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "PortalAccessSettingsUpdated",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "ProductsModule"
}
}
},
{
MessageAction.DocumentServiceLocationSetting, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "DocumentServiceLocationSetting",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "ProductsModule"
}
}
},
{
MessageAction.AuthorizationKeysSetting, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "AuthorizationKeysSetting",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "ProductsModule"
}
}
},
{
MessageAction.FullTextSearchSetting, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "FullTextSearchSetting",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "ProductsModule"
}
}
},
{
MessageAction.StartTransferSetting, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "StartTransferSetting",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "ProductsModule"
}
}
},
{
MessageAction.StartBackupSetting, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "StartBackupSetting",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "ProductsModule"
}
}
},
{
MessageAction.LicenseKeyUploaded, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "LicenseKeyUploaded",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "ProductsModule"
}
}
},
{
MessageAction.StartStorageEncryption, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "StartStorageEncryption",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "ProductsModule"
}
}
},
{
MessageAction.StartStorageDecryption, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "StartStorageDecryption",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "ProductsModule"
}
}
},
{
MessageAction.CookieSettingsUpdated, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "CookieSettingsUpdated",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "ProductsModule"
}
}
},
{
MessageAction.MailServiceSettingsUpdated, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "MailServiceSettingsUpdated",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "ProductsModule"
}
}
},
{
MessageAction.CustomNavigationSettingsUpdated, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "CustomNavigationSettingsUpdated",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "ProductsModule"
}
}
},
{
MessageAction.AuditSettingsUpdated, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "AuditSettingsUpdated",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "ProductsModule"
}
}
},
{
MessageAction.PrivacyRoomEnable, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "PrivacyRoomEnable",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "ProductsModule"
}
}
},
{
MessageAction.PrivacyRoomDisable, new MessageMaps
{
{
ActionTypeTextResourceName = "UpdateActionType",
ActionTextResourceName = "PrivacyRoomDisable",
ProductResourceName = "SettingsProduct",
ModuleResourceName = "ProductsModule"
}
}
}
};
}
}
};
}

View File

@ -23,25 +23,32 @@
*
*/
namespace ASC.AuditTrail
namespace ASC.AuditTrail.Models;
public class AuditEventDto : BaseEvent, IMapFrom<AuditEventQuery>
{
public class AuditEvent : BaseEvent
public string Initiator { get; set; }
[Event("ActionIdCol", 33)]
public int Action { get; set; }
[Event("ActionTypeCol", 30)]
public string ActionTypeText { get; set; }
[Event("ProductCol", 31)]
public string Product { get; set; }
[Event("ModuleCol", 32)]
public string Module { get; set; }
[Event("TargetIdCol", 34)]
public MessageTarget Target { get; set; }
public void Mapping(Profile profile)
{
public string Initiator { get; set; }
profile.CreateMap<AuditEvent, AuditEventDto>();
[Event("ActionIdCol", 33)]
public int Action { get; set; }
[Event("ActionTypeCol", 30)]
public string ActionTypeText { get; set; }
[Event("ProductCol", 31)]
public string Product { get; set; }
[Event("ModuleCol", 32)]
public string Module { get; set; }
[Event("TargetIdCol", 34)]
public MessageTarget Target { get; set; }
profile.CreateMap<AuditEventQuery, AuditEventDto>()
.ConvertUsing<EventTypeConverter>();
}
}

View File

@ -0,0 +1,9 @@
namespace ASC.AuditTrail.Models;
public class AuditEventQuery
{
public AuditEvent Event { get; set; }
public string UserName { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
}

View File

@ -0,0 +1,74 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2020
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
namespace ASC.AuditTrail.Models;
public class BaseEvent
{
public int Id { get; set; }
public int TenantId { get; set; }
public Guid UserId { get; set; }
public bool Mobile { get; set; }
public IList<string> Description { get; set; }
[Event("IpCol")]
public string Ip { get; set; }
[Event("BrowserCol")]
public string Browser { get; set; }
[Event("PlatformCol")]
public string Platform { get; set; }
[Event("DateCol")]
public DateTime Date { get; set; }
[Event("UserCol")]
public string UserName { get; set; }
[Event("PageCol")]
public string Page { get; set; }
[Event("ActionCol")]
public string ActionText { get; set; }
}
internal class BaseEventMap<T> : ClassMap<T> where T : BaseEvent
{
public BaseEventMap()
{
var eventType = typeof(T);
var eventProps = eventType
.GetProperties()
.Where(r => r.GetCustomAttribute<EventAttribute>() != null)
.OrderBy(r => r.GetCustomAttribute<EventAttribute>().Order);
foreach (var prop in eventProps)
{
var attr = prop.GetCustomAttribute<EventAttribute>().Resource;
Map(eventType, prop).Name(AuditReportResource.ResourceManager.GetString(attr));
}
}
}

View File

@ -23,15 +23,18 @@
*
*/
namespace ASC.AuditTrail.Models;
namespace ASC.AuditTrail
public class LoginEventDto : BaseEvent, IMapFrom<LoginEventQuery>
{
public class LoginEvent : BaseEvent
{
public string Login { get; set; }
public string Login { get; set; }
public int Action { get; set; }
public int Action { get; set; }
public void Mapping(Profile profile)
{
profile.CreateMap<LoginEvent, LoginEventDto>();
profile.CreateMap<LoginEventQuery, LoginEventDto>()
.ConvertUsing<EventTypeConverter>();
}
}

View File

@ -0,0 +1,9 @@
namespace ASC.AuditTrail.Models;
public class LoginEventQuery
{
public LoginEvent Event { get; set; }
public string UserName { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
}

View File

@ -0,0 +1,74 @@
namespace ASC.AuditTrail.Models.Mappings;
public class EventTypeConverter : ITypeConverter<LoginEventQuery, LoginEventDto>,
ITypeConverter<AuditEventQuery, AuditEventDto>
{
private readonly UserFormatter _userFormatter;
private readonly AuditActionMapper _auditActionMapper;
private readonly MessageTarget _messageTarget;
public EventTypeConverter(
UserFormatter userFormatter,
AuditActionMapper actionMapper,
MessageTarget messageTarget)
{
_userFormatter = userFormatter;
_auditActionMapper = actionMapper;
_messageTarget = messageTarget;
}
public LoginEventDto Convert(LoginEventQuery source, LoginEventDto destination, ResolutionContext context)
{
var result = context.Mapper.Map<LoginEventDto>(source.Event);
if (source.Event.DescriptionRaw != null)
{
result.Description = JsonConvert.DeserializeObject<IList<string>>(source.Event.DescriptionRaw,
new JsonSerializerSettings
{
DateTimeZoneHandling = DateTimeZoneHandling.Utc
});
}
result.UserName = (!string.IsNullOrEmpty(source.FirstName) && !string.IsNullOrEmpty(source.LastName))
? _userFormatter.GetUserName(source.FirstName, source.LastName)
: !string.IsNullOrWhiteSpace(source.Event.Login)
? source.Event.Login
: source.Event.UserId == Core.Configuration.Constants.Guest.ID
? AuditReportResource.GuestAccount
: AuditReportResource.UnknownAccount;
result.ActionText = _auditActionMapper.GetActionText(result);
return result;
}
public AuditEventDto Convert(AuditEventQuery source, AuditEventDto destination, ResolutionContext context)
{
var result = context.Mapper.Map<AuditEventDto>(source.Event);
if (source.Event.DescriptionRaw != null)
{
result.Description = JsonConvert.DeserializeObject<IList<string>>(
JsonConvert.ToString(source.Event.DescriptionRaw),
new JsonSerializerSettings
{
DateTimeZoneHandling = DateTimeZoneHandling.Utc
});
}
result.Target = _messageTarget.Parse(source.Event.Target);
result.UserName = (source.FirstName != null && source.LastName != null) ? _userFormatter.GetUserName(source.FirstName, source.LastName) :
source.Event.UserId == Core.Configuration.Constants.CoreSystem.ID ? AuditReportResource.SystemAccount :
source.Event.UserId == Core.Configuration.Constants.Guest.ID ? AuditReportResource.GuestAccount :
source.Event.Initiator ?? AuditReportResource.UnknownAccount;
result.ActionText = _auditActionMapper.GetActionText(result);
result.ActionTypeText = _auditActionMapper.GetActionTypeText(result);
result.Product = _auditActionMapper.GetProductText(result);
result.Module = _auditActionMapper.GetModuleText(result);
return result;
}
}

View File

@ -0,0 +1,95 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 <EFBFBD> 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 <EFBFBD> 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
namespace ASC.AuditTrail.Repositories;
[Scope]
public class AuditEventsRepository
{
private AuditTrailContext AuditTrailContext => _lazyAuditTrailContext.Value;
private readonly Lazy<AuditTrailContext> _lazyAuditTrailContext;
private readonly IMapper _mapper;
public AuditEventsRepository(
DbContextManager<AuditTrailContext> dbContextManager,
IMapper mapper)
{
_lazyAuditTrailContext = new Lazy<AuditTrailContext>(() => dbContextManager.Value);
_mapper = mapper;
}
public IEnumerable<AuditEventDto> GetLast(int tenant, int chunk)
{
return Get(tenant, null, null, chunk);
}
public IEnumerable<AuditEventDto> Get(int tenant, DateTime from, DateTime to)
{
return Get(tenant, from, to, null);
}
public int GetCount(int tenant, DateTime? from = null, DateTime? to = null)
{
IQueryable<AuditEvent> query = AuditTrailContext.AuditEvents
.Where(a => a.TenantId == tenant)
.OrderByDescending(a => a.Date);
if (from.HasValue && to.HasValue)
{
query = query.Where(a => a.Date >= from & a.Date <= to);
}
return query.Count();
}
private IEnumerable<AuditEventDto> Get(int tenant, DateTime? fromDate, DateTime? to, int? limit)
{
var query =
from q in AuditTrailContext.AuditEvents
from p in AuditTrailContext.Users.Where(p => q.UserId == p.Id).DefaultIfEmpty()
where q.TenantId == tenant
orderby q.Date descending
select new AuditEventQuery
{
Event = q,
FirstName = p.FirstName,
LastName = p.LastName,
UserName = p.UserName
};
if (fromDate.HasValue && to.HasValue)
{
query = query.Where(q => q.Event.Date >= fromDate & q.Event.Date <= to);
}
if (limit.HasValue)
{
query = query.Take((int)limit);
}
return _mapper.Map<List<AuditEventQuery>, IEnumerable<AuditEventDto>>(query.ToList());
}
}

View File

@ -0,0 +1,95 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2020
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
namespace ASC.AuditTrail.Repositories;
[Scope]
public class LoginEventsRepository
{
private MessagesContext MessagesContext => _lazyMessagesContext.Value;
private readonly Lazy<MessagesContext> _lazyMessagesContext;
private readonly IMapper _mapper;
public LoginEventsRepository(
DbContextManager<MessagesContext> dbMessagesContext,
IMapper mapper)
{
_lazyMessagesContext = new Lazy<MessagesContext>(() => dbMessagesContext.Value);
_mapper = mapper;
}
public IEnumerable<LoginEventDto> GetLast(int tenant, int chunk)
{
var query =
(from b in MessagesContext.LoginEvents
from p in MessagesContext.Users.Where(p => b.UserId == p.Id).DefaultIfEmpty()
where b.TenantId == tenant
orderby b.Date descending
select new LoginEventQuery
{
Event = b,
UserName = p.UserName,
FirstName = p.FirstName,
LastName = p.LastName
})
.Take(chunk);
return _mapper.Map<List<LoginEventQuery>, IEnumerable<LoginEventDto>>(query.ToList());
}
public IEnumerable<LoginEventDto> Get(int tenant, DateTime fromDate, DateTime to)
{
var query =
from q in MessagesContext.LoginEvents
from p in MessagesContext.Users.Where(p => q.UserId == p.Id).DefaultIfEmpty()
where q.TenantId == tenant
where q.Date >= fromDate
where q.Date <= to
orderby q.Date descending
select new LoginEventQuery
{
Event = q,
UserName = p.UserName,
FirstName = p.FirstName,
LastName = p.LastName
};
return _mapper.Map<List<LoginEventQuery>, IEnumerable<LoginEventDto>>(query.ToList());
}
public int GetCount(int tenant, DateTime? from = null, DateTime? to = null)
{
var query = MessagesContext.LoginEvents
.Where(l => l.TenantId == tenant);
if (from.HasValue && to.HasValue)
{
query = query.Where(l => l.Date >= from & l.Date <= to);
}
return query.Count();
}
}

View File

@ -10,7 +10,6 @@ global using System.Net.Mail;
global using System.Net.Sockets;
global using System.Runtime.InteropServices;
global using System.Security;
global using System.Security.Authentication;
global using System.ServiceModel.Security;
global using System.Text.Json;
global using System.Text.Json.Serialization;
@ -26,7 +25,7 @@ global using ASC.Api.Settings;
global using ASC.Api.Settings.Smtp;
global using ASC.Api.Utils;
global using ASC.AuditTrail;
global using ASC.AuditTrail.Data;
global using ASC.AuditTrail.Models;
global using ASC.Common;
global using ASC.Common.Caching;
global using ASC.Common.Logging;
@ -84,6 +83,7 @@ global using ASC.Web.Studio.UserControls.Statistics;
global using ASC.Web.Studio.Utility;
global using ASC.Webhooks.Core;
global using ASC.Webhooks.Core.Dao.Models;
global using ASC.AuditTrail.Repositories;
global using Autofac.Extensions.DependencyInjection;
@ -104,7 +104,4 @@ global using Microsoft.Extensions.Options;
global using MimeKit;
global using StackExchange.Redis.Extensions.Core.Configuration;
global using StackExchange.Redis.Extensions.Newtonsoft;
global using static ASC.Security.Cryptography.EmailValidationKeyProvider;