Merge pull request #92 from ONLYOFFICE/features/ASC.AuditTrail
Features/asc.audit trail
This commit is contained in:
commit
b59a5a5069
@ -68,6 +68,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Data.Storage.Encryption
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.TelegramService", "common\services\ASC.TelegramService\ASC.TelegramService.csproj", "{95CE7371-17B6-4EEE-8E38-2FDE6347E955}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ASC.AuditTrail", "common\services\ASC.AuditTrail\ASC.AuditTrail.csproj", "{2C111161-B7C5-4869-9F52-EA725E64BA40}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{0E35EB77-EC53-44C2-99EB-3D845C79675D}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
.editorconfig = .editorconfig
|
||||
@ -203,6 +205,10 @@ Global
|
||||
{95CE7371-17B6-4EEE-8E38-2FDE6347E955}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{95CE7371-17B6-4EEE-8E38-2FDE6347E955}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{95CE7371-17B6-4EEE-8E38-2FDE6347E955}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2C111161-B7C5-4869-9F52-EA725E64BA40}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2C111161-B7C5-4869-9F52-EA725E64BA40}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2C111161-B7C5-4869-9F52-EA725E64BA40}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2C111161-B7C5-4869-9F52-EA725E64BA40}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
33
common/ASC.Core.Common/EF/Context/AuditTrailContext.cs
Normal file
33
common/ASC.Core.Common/EF/Context/AuditTrailContext.cs
Normal file
@ -0,0 +1,33 @@
|
||||
|
||||
using ASC.Common;
|
||||
using ASC.Core.Common.EF.Model;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace ASC.Core.Common.EF.Context
|
||||
{
|
||||
public class AuditTrailContext : BaseDbContext
|
||||
{
|
||||
public DbSet<User> User { get; set; }
|
||||
public DbSet<LoginEvents> LoginEvents { get; set; }
|
||||
public DbSet<AuditEvent> AuditEvents { get; set; }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
ModelBuilderWrapper
|
||||
.From(modelBuilder, Provider)
|
||||
.AddUser()
|
||||
.AddLoginEvents()
|
||||
.AddAuditEvent()
|
||||
.AddDbFunction();
|
||||
}
|
||||
}
|
||||
|
||||
public static class AuditTrailContextExtension
|
||||
{
|
||||
public static DIHelper AddAuditTrailContextService(this DIHelper services)
|
||||
{
|
||||
return services.AddDbContextManagerService<AuditTrailContext>();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
using ASC.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using ASC.Common;
|
||||
using ASC.Core.Common.EF.Model;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ASC.Core.Common.EF.Context
|
||||
{
|
||||
public class MySqlMessagesContext : MessagesContext { }
|
||||
@ -31,14 +31,13 @@ namespace ASC.Core.Common.EF.Context
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.AddDbFunction();
|
||||
|
||||
ModelBuilderWrapper
|
||||
.From(modelBuilder, Provider)
|
||||
.AddDbTenant()
|
||||
.AddWebstudioSettings()
|
||||
.AddAuditEvent()
|
||||
.AddLoginEvents();
|
||||
.AddLoginEvents()
|
||||
.AddDbFunction();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
using ASC.Core.Common.EF.Model;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
using Microsoft.EntityFrameworkCore.Query.SqlExpressions;
|
||||
@ -15,31 +17,4 @@ namespace ASC.Core.Common.EF
|
||||
return column + path;
|
||||
}
|
||||
}
|
||||
|
||||
public static class DbFunctionExtension
|
||||
{
|
||||
public static void AddDbFunction(this ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder
|
||||
.HasDbFunction(typeof(JsonExtensions).GetMethod(nameof(JsonExtensions.JsonValue)))
|
||||
.HasTranslation(e =>
|
||||
{
|
||||
var res = new List<SqlExpression>();
|
||||
if (e is List<SqlExpression> list)
|
||||
{
|
||||
if (list[0] is SqlConstantExpression key)
|
||||
{
|
||||
res.Add(new SqlFragmentExpression($"`{key.Value}`"));
|
||||
}
|
||||
|
||||
if (list[1] is SqlConstantExpression val)
|
||||
{
|
||||
res.Add(new SqlConstantExpression(Expression.Constant($"$.{val.Value}"), val.TypeMapping));
|
||||
}
|
||||
}
|
||||
|
||||
return SqlFunctionExpression.Create("JSON_EXTRACT", res, typeof(string), null);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Query.SqlExpressions;
|
||||
|
||||
namespace ASC.Core.Common.EF.Model
|
||||
{
|
||||
@ -37,5 +39,29 @@ namespace ASC.Core.Common.EF.Model
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public void AddDbFunction()
|
||||
{
|
||||
ModelBuilder
|
||||
.HasDbFunction(typeof(JsonExtensions).GetMethod(nameof(JsonExtensions.JsonValue)))
|
||||
.HasTranslation(e =>
|
||||
{
|
||||
var res = new List<SqlExpression>();
|
||||
if (e is List<SqlExpression> list)
|
||||
{
|
||||
if (list[0] is SqlConstantExpression key)
|
||||
{
|
||||
res.Add(new SqlFragmentExpression($"`{key.Value}`"));
|
||||
}
|
||||
|
||||
if (list[1] is SqlConstantExpression val)
|
||||
{
|
||||
res.Add(new SqlConstantExpression(Expression.Constant($"$.{val.Value}"), val.TypeMapping));
|
||||
}
|
||||
}
|
||||
|
||||
return SqlFunctionExpression.Create("JSON_EXTRACT", res, typeof(string), null);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ namespace ASC.Core.Common.EF.Model
|
||||
public string Alias { get; set; }
|
||||
public string MappedDomain { get; set; }
|
||||
public int Version { get; set; }
|
||||
|
||||
public DateTime? Version_Changed { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
|
@ -300,7 +300,7 @@ namespace ASC.MessagingSystem.DbSender
|
||||
.Where(r => r.Date < DateTime.UtcNow.AddDays(
|
||||
ef.WebstudioSettings
|
||||
.Where(a => a.TenantId == r.TenantId && a.Id == TenantAuditSettings.Guid)
|
||||
.Select(r => Convert.ToDouble(JsonExtensions.JsonValue(nameof(r.Data).ToLower(), settings) ?? TenantAuditSettings.MaxLifeTime.ToString()))
|
||||
.Select(r => -Convert.ToDouble(JsonExtensions.JsonValue(nameof(r.Data).ToLower(), settings) ?? TenantAuditSettings.MaxLifeTime.ToString()))
|
||||
.FirstOrDefault()))
|
||||
.Take(1000);
|
||||
|
||||
|
55
common/services/ASC.AuditTrail/ASC.AuditTrail.csproj
Normal file
55
common/services/ASC.AuditTrail/ASC.AuditTrail.csproj
Normal file
@ -0,0 +1,55 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<ApplicationIcon />
|
||||
<OutputType>Library</OutputType>
|
||||
<StartupObject />
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<DebugType>none</DebugType>
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<NoWarn>1701;1702;NU1701;</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CsvHelper" Version="15.0.6" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\products\ASC.Files\Core\ASC.Files.Core.csproj" />
|
||||
<ProjectReference Include="..\..\ASC.MessagingSystem\ASC.MessagingSystem.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="AuditReportResource.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>AuditReportResource.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="AuditReportResource.resx">
|
||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>AuditReportResource.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="AuditReportResource.ru.resx">
|
||||
<DependentUpon>AuditReportResource.resx</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="AuditReportResource.de.resx">
|
||||
<DependentUpon>AuditReportResource.resx</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="AuditReportResource.es.resx">
|
||||
<DependentUpon>AuditReportResource.resx</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="AuditReportResource.fr.resx">
|
||||
<DependentUpon>AuditReportResource.resx</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="AuditReportResource.it.resx">
|
||||
<DependentUpon>AuditReportResource.resx</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
50
common/services/ASC.AuditTrail/AuditEvent.cs
Normal file
50
common/services/ASC.AuditTrail/AuditEvent.cs
Normal file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
*
|
||||
* (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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
using ASC.MessagingSystem;
|
||||
|
||||
namespace ASC.AuditTrail
|
||||
{
|
||||
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; }
|
||||
}
|
||||
}
|
169
common/services/ASC.AuditTrail/AuditEventsRepository.cs
Normal file
169
common/services/ASC.AuditTrail/AuditEventsRepository.cs
Normal file
@ -0,0 +1,169 @@
|
||||
/*
|
||||
*
|
||||
* (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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
using ASC.AuditTrail.Mappers;
|
||||
using ASC.Common;
|
||||
using ASC.Core.Common.EF;
|
||||
using ASC.Core.Common.EF.Context;
|
||||
using ASC.Core.Users;
|
||||
using ASC.MessagingSystem;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace ASC.AuditTrail
|
||||
{
|
||||
public class AuditEventsRepository
|
||||
{
|
||||
private MessageTarget MessageTarget { get; set; }
|
||||
private UserFormatter UserFormatter { get; set; }
|
||||
private AuditTrailContext AuditTrailContext { get; }
|
||||
private AuditActionMapper AuditActionMapper { get; }
|
||||
|
||||
public AuditEventsRepository(MessageTarget messageTarget, UserFormatter userFormatter, DbContextManager<AuditTrailContext> dbContextManager, AuditActionMapper auditActionMapper)
|
||||
{
|
||||
MessageTarget = messageTarget;
|
||||
UserFormatter = userFormatter;
|
||||
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 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.User.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>>(
|
||||
Convert.ToString(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;
|
||||
}
|
||||
}
|
||||
|
||||
public static class AuditEventsRepositoryExtension
|
||||
{
|
||||
public static DIHelper AddAuditEventsRepositoryService(this DIHelper services)
|
||||
{
|
||||
_ = services.TryAddScoped<AuditEventsRepository>();
|
||||
return services
|
||||
.AddUserFormatter()
|
||||
.AddAuditTrailContextService()
|
||||
.AddMessageTargetService()
|
||||
.AddAuditActionMapperService();
|
||||
}
|
||||
}
|
||||
}
|
108
common/services/ASC.AuditTrail/AuditReportCreator.cs
Normal file
108
common/services/ASC.AuditTrail/AuditReportCreator.cs
Normal file
@ -0,0 +1,108 @@
|
||||
/*
|
||||
*
|
||||
* (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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
using ASC.Common;
|
||||
using ASC.Common.Logging;
|
||||
using ASC.Web.Core.Files;
|
||||
using ASC.Web.Files.Classes;
|
||||
using ASC.Web.Files.Utils;
|
||||
using ASC.Web.Studio.Utility;
|
||||
|
||||
using CsvHelper;
|
||||
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace ASC.AuditTrail
|
||||
{
|
||||
public class AuditReportCreator
|
||||
{
|
||||
private ILog Log { get; }
|
||||
private GlobalFolderHelper GlobalFolderHelper { get; }
|
||||
private FileUploader FileUploader { get; }
|
||||
private FilesLinkUtility FilesLinkUtility { get; }
|
||||
private CommonLinkUtility CommonLinkUtility { get; }
|
||||
|
||||
public AuditReportCreator(GlobalFolderHelper globalFolderHelper, IOptionsMonitor<ILog> options, FileUploader fileUploader, FilesLinkUtility filesLinkUtility, CommonLinkUtility commonLinkUtility)
|
||||
{
|
||||
GlobalFolderHelper = globalFolderHelper;
|
||||
Log = options.CurrentValue;
|
||||
FileUploader = fileUploader;
|
||||
FilesLinkUtility = filesLinkUtility;
|
||||
CommonLinkUtility = commonLinkUtility;
|
||||
}
|
||||
|
||||
public string CreateCsvReport<TEvent>(IEnumerable<TEvent> events, string reportName) where TEvent : BaseEvent
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var stream = new MemoryStream())
|
||||
using (var writer = new StreamWriter(stream, Encoding.UTF8))
|
||||
using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
|
||||
{
|
||||
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={{\"delimiter\":{0},\"codePage\":{1}}}",
|
||||
(int)FileUtility.CsvDelimiter.Comma,
|
||||
Encoding.UTF8.CodePage);
|
||||
return fileUrl;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error("Error while generating login report: " + ex);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class AuditReportCreatorExtension
|
||||
{
|
||||
public static DIHelper AddAuditReportCreatorService(this DIHelper services)
|
||||
{
|
||||
_ = services.TryAddScoped<AuditReportCreator>();
|
||||
return services
|
||||
.AddGlobalFolderHelperService()
|
||||
.AddFileUploaderService()
|
||||
.AddFilesLinkUtilityService()
|
||||
.AddCommonLinkUtilityService();
|
||||
}
|
||||
}
|
||||
}
|
4275
common/services/ASC.AuditTrail/AuditReportResource.Designer.cs
generated
Normal file
4275
common/services/ASC.AuditTrail/AuditReportResource.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
1465
common/services/ASC.AuditTrail/AuditReportResource.de.resx
Normal file
1465
common/services/ASC.AuditTrail/AuditReportResource.de.resx
Normal file
File diff suppressed because it is too large
Load Diff
1465
common/services/ASC.AuditTrail/AuditReportResource.es.resx
Normal file
1465
common/services/ASC.AuditTrail/AuditReportResource.es.resx
Normal file
File diff suppressed because it is too large
Load Diff
1466
common/services/ASC.AuditTrail/AuditReportResource.fr.resx
Normal file
1466
common/services/ASC.AuditTrail/AuditReportResource.fr.resx
Normal file
File diff suppressed because it is too large
Load Diff
1450
common/services/ASC.AuditTrail/AuditReportResource.it.resx
Normal file
1450
common/services/ASC.AuditTrail/AuditReportResource.it.resx
Normal file
File diff suppressed because it is too large
Load Diff
1465
common/services/ASC.AuditTrail/AuditReportResource.resx
Normal file
1465
common/services/ASC.AuditTrail/AuditReportResource.resx
Normal file
File diff suppressed because it is too large
Load Diff
1465
common/services/ASC.AuditTrail/AuditReportResource.ru.resx
Normal file
1465
common/services/ASC.AuditTrail/AuditReportResource.ru.resx
Normal file
File diff suppressed because it is too large
Load Diff
102
common/services/ASC.AuditTrail/BaseEvent.cs
Normal file
102
common/services/ASC.AuditTrail/BaseEvent.cs
Normal file
@ -0,0 +1,102 @@
|
||||
/*
|
||||
*
|
||||
* (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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using CsvHelper.Configuration;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
37
common/services/ASC.AuditTrail/LoginEvent.cs
Normal file
37
common/services/ASC.AuditTrail/LoginEvent.cs
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
*
|
||||
* (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 LoginEvent : BaseEvent
|
||||
{
|
||||
public string Login { get; set; }
|
||||
|
||||
public int Action { get; set; }
|
||||
}
|
||||
}
|
158
common/services/ASC.AuditTrail/LoginEventsRepository.cs
Normal file
158
common/services/ASC.AuditTrail/LoginEventsRepository.cs
Normal file
@ -0,0 +1,158 @@
|
||||
/*
|
||||
*
|
||||
* (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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using ASC.AuditTrail.Mappers;
|
||||
using ASC.Common;
|
||||
using ASC.Common.Logging;
|
||||
using ASC.Core.Common.EF;
|
||||
using ASC.Core.Common.EF.Context;
|
||||
using ASC.Core.Common.EF.Model;
|
||||
using ASC.Core.Users;
|
||||
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace ASC.AuditTrail.Data
|
||||
{
|
||||
public class LoginEventsRepository
|
||||
{
|
||||
private UserFormatter UserFormatter { get; }
|
||||
private AuditTrailContext AuditTrailContext { get; }
|
||||
private AuditActionMapper AuditActionMapper { get; }
|
||||
|
||||
public LoginEventsRepository(UserFormatter userFormatter, DbContextManager<AuditTrailContext> dbContextManager, AuditActionMapper auditActionMapper)
|
||||
{
|
||||
UserFormatter = userFormatter;
|
||||
AuditTrailContext = dbContextManager.Value;
|
||||
AuditActionMapper = auditActionMapper;
|
||||
}
|
||||
|
||||
private 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 AuditTrailContext.LoginEvents
|
||||
from p in AuditTrailContext.User.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 AuditTrailContext.LoginEvents
|
||||
from p in AuditTrailContext.User.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 = AuditTrailContext.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;
|
||||
}
|
||||
}
|
||||
|
||||
public static class LoginEventsRepositoryExtension
|
||||
{
|
||||
public static DIHelper AddLoginEventsRepositoryService(this DIHelper services)
|
||||
{
|
||||
if (services.TryAddScoped<LoginEventsRepository>())
|
||||
{
|
||||
return services
|
||||
.AddUserFormatter()
|
||||
.AddAuditTrailContextService()
|
||||
.AddAuditActionMapperService();
|
||||
}
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
}
|
154
common/services/ASC.AuditTrail/Mappers/AuditActionMapper.cs
Normal file
154
common/services/ASC.AuditTrail/Mappers/AuditActionMapper.cs
Normal file
@ -0,0 +1,154 @@
|
||||
/*
|
||||
*
|
||||
* (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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using ASC.MessagingSystem;
|
||||
using System.Linq;
|
||||
using Microsoft.Extensions.Options;
|
||||
using ASC.Common.Logging;
|
||||
using ASC.Common;
|
||||
|
||||
namespace ASC.AuditTrail.Mappers
|
||||
{
|
||||
public class AuditActionMapper
|
||||
{
|
||||
private Dictionary<MessageAction, MessageMaps> Actions { get; }
|
||||
private ILog Log { get; }
|
||||
|
||||
public AuditActionMapper(IOptionsMonitor<ILog> options)
|
||||
{
|
||||
Actions = new Dictionary<MessageAction, MessageMaps>();
|
||||
Log = options.CurrentValue;
|
||||
|
||||
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(AuditEvent 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.Any()) 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 GetActionText(LoginEvent 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.Any()) 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 : string.Format("{0}...", text.Substring(0, 47));
|
||||
}
|
||||
}
|
||||
|
||||
public static class AuditActionMapperExtension
|
||||
{
|
||||
public static DIHelper AddAuditActionMapperService(this DIHelper services)
|
||||
{
|
||||
_ = services.TryAddSingleton<AuditActionMapper>();
|
||||
return services;
|
||||
}
|
||||
}
|
||||
}
|
1627
common/services/ASC.AuditTrail/Mappers/CrmActionMapper.cs
Normal file
1627
common/services/ASC.AuditTrail/Mappers/CrmActionMapper.cs
Normal file
File diff suppressed because it is too large
Load Diff
429
common/services/ASC.AuditTrail/Mappers/DocumentsActionMapper.cs
Normal file
429
common/services/ASC.AuditTrail/Mappers/DocumentsActionMapper.cs
Normal file
@ -0,0 +1,429 @@
|
||||
/*
|
||||
*
|
||||
* (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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
using System.Collections.Generic;
|
||||
using ASC.MessagingSystem;
|
||||
|
||||
namespace ASC.AuditTrail.Mappers
|
||||
{
|
||||
internal class DocumentsActionMapper
|
||||
{
|
||||
public static Dictionary<MessageAction, MessageMaps> GetMaps()
|
||||
{
|
||||
return new Dictionary<MessageAction, 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"
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
70
common/services/ASC.AuditTrail/Mappers/LoginActionMapper.cs
Normal file
70
common/services/ASC.AuditTrail/Mappers/LoginActionMapper.cs
Normal file
@ -0,0 +1,70 @@
|
||||
/*
|
||||
*
|
||||
* (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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
using System.Collections.Generic;
|
||||
using ASC.MessagingSystem;
|
||||
|
||||
namespace ASC.AuditTrail.Mappers
|
||||
{
|
||||
internal class LoginActionsMapper
|
||||
{
|
||||
public static Dictionary<MessageAction, MessageMaps> GetMaps()
|
||||
{
|
||||
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"}}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
88
common/services/ASC.AuditTrail/Mappers/MessageMaps.cs
Normal file
88
common/services/ASC.AuditTrail/Mappers/MessageMaps.cs
Normal file
@ -0,0 +1,88 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System Limited 2010-2020
|
||||
/*
|
||||
*
|
||||
* (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.Mappers
|
||||
{
|
||||
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()
|
||||
{
|
||||
try
|
||||
{
|
||||
return AuditReportResource.ResourceManager.GetString(ActionTypeTextResourceName);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public string GetActionText()
|
||||
{
|
||||
try
|
||||
{
|
||||
return AuditReportResource.ResourceManager.GetString(ActionTextResourceName);
|
||||
}
|
||||
catch
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
51
common/services/ASC.AuditTrail/Mappers/OthersActionMapper.cs
Normal file
51
common/services/ASC.AuditTrail/Mappers/OthersActionMapper.cs
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
*
|
||||
* (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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
using System.Collections.Generic;
|
||||
using ASC.MessagingSystem;
|
||||
|
||||
namespace ASC.AuditTrail.Mappers
|
||||
{
|
||||
internal class OthersActionsMapper
|
||||
{
|
||||
public static Dictionary<MessageAction, MessageMaps> GetMaps()
|
||||
{
|
||||
return new Dictionary<MessageAction, MessageMaps>
|
||||
{
|
||||
{
|
||||
MessageAction.ContactAdminMailSent, new MessageMaps
|
||||
{
|
||||
ActionTypeTextResourceName = "SendActionType",
|
||||
ActionTextResourceName = "ContactAdminMailSent",
|
||||
ProductResourceName = "OthersProduct"
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
358
common/services/ASC.AuditTrail/Mappers/PeopleActionMapper.cs
Normal file
358
common/services/ASC.AuditTrail/Mappers/PeopleActionMapper.cs
Normal file
@ -0,0 +1,358 @@
|
||||
/*
|
||||
*
|
||||
* (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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
using System.Collections.Generic;
|
||||
using ASC.MessagingSystem;
|
||||
|
||||
namespace ASC.AuditTrail.Mappers
|
||||
{
|
||||
internal class PeopleActionMapper
|
||||
{
|
||||
public static Dictionary<MessageAction, MessageMaps> GetMaps()
|
||||
{
|
||||
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
|
||||
{
|
||||
ActionTypeTextResourceName = "UpdateActionType",
|
||||
ActionTextResourceName = "UserUpdatedEmail",
|
||||
ProductResourceName = "PeopleProduct",
|
||||
ModuleResourceName = "UsersModule"
|
||||
}
|
||||
},
|
||||
{
|
||||
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"
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
613
common/services/ASC.AuditTrail/Mappers/ProjectsActionMapper.cs
Normal file
613
common/services/ASC.AuditTrail/Mappers/ProjectsActionMapper.cs
Normal file
@ -0,0 +1,613 @@
|
||||
/*
|
||||
*
|
||||
* (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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
using System.Collections.Generic;
|
||||
using ASC.MessagingSystem;
|
||||
|
||||
namespace ASC.AuditTrail.Mappers
|
||||
{
|
||||
internal class ProjectsActionsMapper
|
||||
{
|
||||
public static Dictionary<MessageAction, MessageMaps> GetMaps()
|
||||
{
|
||||
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
|
||||
|
||||
#region team
|
||||
|
||||
{
|
||||
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
|
||||
|
||||
#region contacts
|
||||
|
||||
{
|
||||
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
|
||||
|
||||
#region milestones
|
||||
|
||||
{
|
||||
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
|
||||
|
||||
#region tasks
|
||||
|
||||
{
|
||||
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
|
||||
|
||||
#region subtasks
|
||||
|
||||
{
|
||||
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
|
||||
|
||||
#region discussions
|
||||
|
||||
{
|
||||
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
|
||||
|
||||
#region time tracking
|
||||
|
||||
{
|
||||
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
|
||||
|
||||
#region reports
|
||||
|
||||
{
|
||||
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
|
||||
|
||||
#region settings
|
||||
|
||||
{
|
||||
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
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
483
common/services/ASC.AuditTrail/Mappers/SettingsActionMapper.cs
Normal file
483
common/services/ASC.AuditTrail/Mappers/SettingsActionMapper.cs
Normal file
@ -0,0 +1,483 @@
|
||||
/*
|
||||
*
|
||||
* (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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
using System.Collections.Generic;
|
||||
using ASC.MessagingSystem;
|
||||
|
||||
namespace ASC.AuditTrail.Mappers
|
||||
{
|
||||
internal class SettingsActionsMapper
|
||||
{
|
||||
public static Dictionary<MessageAction, MessageMaps> GetMaps()
|
||||
{
|
||||
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"
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:59977/",
|
||||
"sslPort": 44344
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"ASC.AuditTrail": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "https://localhost:5001;http://localhost:5000"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,16 +1,25 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System Limited 2010-2020
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* (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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -1,16 +1,25 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System Limited 2010-2020
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* (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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -34,6 +34,7 @@
|
||||
<ProjectReference Include="..\..\common\ASC.Core.Common\ASC.Core.Common.csproj" />
|
||||
<ProjectReference Include="..\..\common\ASC.Data.Reassigns\ASC.Data.Reassigns.csproj" />
|
||||
<ProjectReference Include="..\..\common\ASC.Data.Storage\ASC.Data.Storage.csproj" />
|
||||
<ProjectReference Include="..\..\common\services\ASC.AuditTrail\ASC.AuditTrail.csproj" />
|
||||
<ProjectReference Include="..\..\common\services\ASC.Data.Backup\ASC.Data.Backup.csproj" />
|
||||
<ProjectReference Include="..\ASC.Web.Core\ASC.Web.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
170
web/ASC.Web.Api/Controllers/SecurityController.cs
Normal file
170
web/ASC.Web.Api/Controllers/SecurityController.cs
Normal file
@ -0,0 +1,170 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using ASC.Api.Security;
|
||||
using ASC.AuditTrail;
|
||||
using ASC.AuditTrail.Data;
|
||||
using ASC.Common;
|
||||
using ASC.Core;
|
||||
using ASC.Core.Billing;
|
||||
using ASC.Core.Common.Settings;
|
||||
using ASC.Core.Tenants;
|
||||
using ASC.MessagingSystem;
|
||||
using ASC.Web.Api.Routing;
|
||||
using ASC.Web.Core.PublicResources;
|
||||
using ASC.Web.Studio.Core;
|
||||
using ASC.Web.Studio.Utility;
|
||||
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace ASC.Web.Api.Controllers
|
||||
{
|
||||
[DefaultRoute]
|
||||
[ApiController]
|
||||
public class SecurityController : ControllerBase
|
||||
{
|
||||
private PermissionContext PermissionContext { get; }
|
||||
private CoreBaseSettings CoreBaseSettings { get; }
|
||||
private TenantExtra TenantExtra { get; }
|
||||
private TenantManager TenantManager { get; }
|
||||
private MessageService MessageService { get; }
|
||||
private LoginEventsRepository LoginEventsRepository { get; }
|
||||
private AuditEventsRepository AuditEventsRepository { get; }
|
||||
private AuditReportCreator AuditReportCreator { get; }
|
||||
private SettingsManager SettingsManager { get; }
|
||||
|
||||
public SecurityController(
|
||||
PermissionContext permissionContext,
|
||||
CoreBaseSettings coreBaseSettings,
|
||||
TenantExtra tenantExtra,
|
||||
TenantManager tenantManager,
|
||||
MessageService messageService,
|
||||
LoginEventsRepository loginEventsRepository,
|
||||
AuditEventsRepository auditEventsRepository,
|
||||
AuditReportCreator auditReportCreator,
|
||||
SettingsManager settingsManager)
|
||||
{
|
||||
PermissionContext = permissionContext;
|
||||
CoreBaseSettings = coreBaseSettings;
|
||||
TenantExtra = tenantExtra;
|
||||
TenantManager = tenantManager;
|
||||
MessageService = messageService;
|
||||
LoginEventsRepository = loginEventsRepository;
|
||||
AuditEventsRepository = auditEventsRepository;
|
||||
AuditReportCreator = auditReportCreator;
|
||||
SettingsManager = settingsManager;
|
||||
}
|
||||
|
||||
[Read("audit/login/last")]
|
||||
public IEnumerable<EventWrapper> GetLastLoginEvents()
|
||||
{
|
||||
PermissionContext.DemandPermissions(SecutiryConstants.EditPortalSettings);
|
||||
|
||||
if (!SetupInfo.IsVisibleSettings(ManagementType.LoginHistory.ToString()) || CoreBaseSettings.Standalone && !TenantExtra.GetTenantQuota().Audit)
|
||||
throw new BillingException(Resource.ErrorNotAllowedOption, "Audit");
|
||||
|
||||
return LoginEventsRepository.GetLast(TenantManager.GetCurrentTenant().TenantId, 20).Select(x => new EventWrapper(x));
|
||||
}
|
||||
|
||||
[Read("audit/events/last")]
|
||||
public IEnumerable<EventWrapper> GetLastAuditEvents()
|
||||
{
|
||||
PermissionContext.DemandPermissions(SecutiryConstants.EditPortalSettings);
|
||||
|
||||
if (!SetupInfo.IsVisibleSettings(ManagementType.LoginHistory.ToString()) || CoreBaseSettings.Standalone && !TenantExtra.GetTenantQuota().Audit)
|
||||
throw new BillingException(Resource.ErrorNotAllowedOption, "Audit");
|
||||
|
||||
return AuditEventsRepository.GetLast(TenantManager.GetCurrentTenant().TenantId, 20).Select(x => new EventWrapper(x));
|
||||
}
|
||||
|
||||
[Create("audit/login/report")]
|
||||
public object CreateLoginHistoryReport()
|
||||
{
|
||||
PermissionContext.DemandPermissions(SecutiryConstants.EditPortalSettings);
|
||||
|
||||
var tenantId = TenantManager.GetCurrentTenant().TenantId;
|
||||
|
||||
if (!SetupInfo.IsVisibleSettings(ManagementType.LoginHistory.ToString()) || CoreBaseSettings.Standalone && !TenantExtra.GetTenantQuota().Audit)
|
||||
throw new BillingException(Resource.ErrorNotAllowedOption, "Audit");
|
||||
|
||||
var settings = SettingsManager.LoadForTenant<TenantAuditSettings>(TenantManager.GetCurrentTenant().TenantId);
|
||||
|
||||
var to = DateTime.UtcNow;
|
||||
var from = to.Subtract(TimeSpan.FromDays(settings.LoginHistoryLifeTime));
|
||||
|
||||
var reportName = string.Format(AuditReportResource.LoginHistoryReportName + ".csv", from.ToString("MM.dd.yyyy"), to.ToString("MM.dd.yyyy"));
|
||||
var events = LoginEventsRepository.Get(tenantId, from, to);
|
||||
var result = AuditReportCreator.CreateCsvReport(events, reportName);
|
||||
|
||||
MessageService.Send(MessageAction.LoginHistoryReportDownloaded);
|
||||
return result;
|
||||
}
|
||||
|
||||
[Create("audit/events/report")]
|
||||
public object CreateAuditTrailReport()
|
||||
{
|
||||
PermissionContext.DemandPermissions(SecutiryConstants.EditPortalSettings);
|
||||
|
||||
var tenantId = TenantManager.GetCurrentTenant().TenantId;
|
||||
|
||||
if (!SetupInfo.IsVisibleSettings(ManagementType.LoginHistory.ToString()) || CoreBaseSettings.Standalone && !TenantExtra.GetTenantQuota().Audit)
|
||||
throw new BillingException(Resource.ErrorNotAllowedOption, "Audit");
|
||||
|
||||
var settings = SettingsManager.LoadForTenant<TenantAuditSettings>(TenantManager.GetCurrentTenant().TenantId);
|
||||
|
||||
var to = DateTime.UtcNow;
|
||||
var from = to.Subtract(TimeSpan.FromDays(settings.AuditTrailLifeTime));
|
||||
|
||||
var reportName = string.Format(AuditReportResource.AuditTrailReportName + ".csv", from.ToString("MM.dd.yyyy"), to.ToString("MM.dd.yyyy"));
|
||||
|
||||
var events = AuditEventsRepository.Get(tenantId, from, to);
|
||||
var result = AuditReportCreator.CreateCsvReport(events, reportName);
|
||||
|
||||
MessageService.Send(MessageAction.AuditTrailReportDownloaded);
|
||||
return result;
|
||||
}
|
||||
|
||||
[Read("audit/settings/lifetime")]
|
||||
public TenantAuditSettings GetAuditSettings()
|
||||
{
|
||||
PermissionContext.DemandPermissions(SecutiryConstants.EditPortalSettings);
|
||||
|
||||
return SettingsManager.LoadForTenant<TenantAuditSettings>(TenantManager.GetCurrentTenant().TenantId);
|
||||
}
|
||||
|
||||
[Create("audit/settings/lifetime")]
|
||||
public TenantAuditSettings SetAuditSettings(TenantAuditSettings settings)
|
||||
{
|
||||
PermissionContext.DemandPermissions(SecutiryConstants.EditPortalSettings);
|
||||
|
||||
if (settings.LoginHistoryLifeTime <= 0 || settings.LoginHistoryLifeTime > TenantAuditSettings.MaxLifeTime)
|
||||
throw new ArgumentException("LoginHistoryLifeTime");
|
||||
|
||||
if (settings.AuditTrailLifeTime <= 0 || settings.AuditTrailLifeTime > TenantAuditSettings.MaxLifeTime)
|
||||
throw new ArgumentException("AuditTrailLifeTime");
|
||||
|
||||
SettingsManager.SaveForTenant(settings, TenantManager.GetCurrentTenant().TenantId);
|
||||
MessageService.Send(MessageAction.AuditSettingsUpdated);
|
||||
|
||||
return settings;
|
||||
}
|
||||
}
|
||||
|
||||
public static class SecurityControllerExtension
|
||||
{
|
||||
public static DIHelper AddSecurityController(this DIHelper services)
|
||||
{
|
||||
return services
|
||||
.AddPermissionContextService()
|
||||
.AddCoreBaseSettingsService()
|
||||
.AddTenantExtraService()
|
||||
.AddTenantManagerService()
|
||||
.AddMessageServiceService()
|
||||
.AddLoginEventsRepositoryService()
|
||||
.AddAuditEventsRepositoryService()
|
||||
.AddAuditReportCreatorService()
|
||||
.AddSettingsManagerService();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,16 +1,25 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System Limited 2010-2020
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* (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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
52
web/ASC.Web.Api/Models/EventWrapper.cs
Normal file
52
web/ASC.Web.Api/Models/EventWrapper.cs
Normal file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
*
|
||||
* (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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
using System;
|
||||
|
||||
using ASC.Api.Core;
|
||||
using ASC.AuditTrail;
|
||||
|
||||
namespace ASC.Api.Security
|
||||
{
|
||||
public class EventWrapper
|
||||
{
|
||||
public EventWrapper(BaseEvent auditEvent)
|
||||
{
|
||||
Id = auditEvent.Id;
|
||||
Date = new ApiDateTime(auditEvent.Date, TimeSpan.Zero);
|
||||
User = auditEvent.UserName;
|
||||
Action = auditEvent.ActionText;
|
||||
}
|
||||
|
||||
public int Id { get; private set; }
|
||||
|
||||
public ApiDateTime Date { get; private set; }
|
||||
|
||||
public string User { get; private set; }
|
||||
|
||||
public string Action { get; private set; }
|
||||
}
|
||||
}
|
@ -1,4 +1,29 @@
|
||||
using System.Collections.Generic;
|
||||
/*
|
||||
*
|
||||
* (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.
|
||||
*
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ASC.Web.Api.Models
|
||||
{
|
||||
|
@ -33,7 +33,8 @@ namespace ASC.Web.Api
|
||||
.AddAuthenticationController()
|
||||
.AddModulesController()
|
||||
.AddPortalController()
|
||||
.AddSettingsController()
|
||||
.AddSettingsController()
|
||||
.AddSecurityController()
|
||||
.AddSmtpSettingsController();
|
||||
|
||||
base.ConfigureServices(services);
|
||||
|
@ -1,16 +1,25 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System Limited 2010-2020
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* (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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user