Skip to content

Commit f85f982

Browse files
authored
Merge pull request CactuseSecurity#3332 from SolidProgramming/feature_2696
feat(settings): Custom Logo / FWREZNETZ-459 and CSV import should always display result popup
2 parents 463823a + b817e13 commit f85f982

26 files changed

+640
-233
lines changed

roles/database/files/sql/idempotent/fworch-texts.sql

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2634,6 +2634,8 @@ INSERT INTO txt VALUES ('locked', 'German', 'Gesperrt');
26342634
INSERT INTO txt VALUES ('locked', 'English', 'Locked');
26352635
INSERT INTO txt VALUES ('unlock', 'German', 'Entsperren');
26362636
INSERT INTO txt VALUES ('unlock', 'English', 'Unlock');
2637+
INSERT INTO txt VALUES ('useCustomLogo', 'German', 'Benutzerdefiniertes Logo');
2638+
INSERT INTO txt VALUES ('useCustomLogo', 'English', 'Custom logo');
26372639

26382640
-- help pages
26392641
INSERT INTO txt VALUES ('report_types', 'German', 'Report-Typen');
@@ -2926,6 +2928,7 @@ INSERT INTO txt VALUES ('U5501', 'English', 'Are you sure you want to delete sta
29262928
INSERT INTO txt VALUES ('U5502', 'German', 'Sind sie sicher, dass sie folgende Aktion löschen wollen: ');
29272929
INSERT INTO txt VALUES ('U5502', 'English', 'Are you sure you want to delete action: ');
29282930

2931+
29292932
INSERT INTO txt VALUES ('U7001', 'German', 'Überblick der Ereignisse im Firewall Orchestrator');
29302933
INSERT INTO txt VALUES ('U7001', 'English', 'Alerts and events inside Firewall Orchestrator');
29312934
INSERT INTO txt VALUES ('U7002', 'German', 'Daten sind dann verloren. Erwägen Sie eine Deaktivierung.');
@@ -3236,6 +3239,12 @@ INSERT INTO txt VALUES ('E5422', 'English', 'Entry does not contain all required
32363239
INSERT INTO txt VALUES ('E5423', 'German', 'IP-Adresse/IP-Bereich ist fehlerhaft');
32373240
INSERT INTO txt VALUES ('E5423', 'English', 'IP Address/IP Range malformed');
32383241

3242+
INSERT INTO txt VALUES ('E5430', 'German', 'Hochgeladener Dateityp ist nicht erlaubt');
3243+
INSERT INTO txt VALUES ('E5430', 'English', 'Uploaded Filetype is not allowed');
3244+
3245+
INSERT INTO txt VALUES ('E5431', 'German', 'Hochgeladene Dateit überschreitet maximum');
3246+
INSERT INTO txt VALUES ('E5431', 'English', 'Uploaded File exceeds the allowed maximum');
3247+
32393248
INSERT INTO txt VALUES ('E6001', 'German', 'Der Re-Login war nicht erfolgreich. Haben Sie ein falsches Passwort eingegeben? Schauen Sie für Details bitte in die Logs.');
32403249
INSERT INTO txt VALUES ('E6001', 'English', 'Re-login failed. Did you enter a wrong password? See log for details.');
32413250

@@ -3347,6 +3356,9 @@ INSERT INTO txt VALUES ('E9301', 'English', 'Template File not found!');
33473356
INSERT INTO txt VALUES ('E9302', 'German', 'HTML ist nicht valide!');
33483357
INSERT INTO txt VALUES ('E9302', 'English', 'HTML is invalid!');
33493358

3359+
INSERT INTO txt VALUES ('E9400', 'German', 'Leere Datei hochgeladen/keine Änderungen wurden vorgenommen');
3360+
INSERT INTO txt VALUES ('E9400', 'English', 'Empty file provided/no changes where applied');
3361+
33503362
-- errors from Api
33513363
INSERT INTO txt VALUES ('A0001', 'German', 'Ungültige Anmeldedaten. Nutzername darf nicht leer sein');
33523364
INSERT INTO txt VALUES ('A0001', 'English', 'Invalid credentials. Username must not be empty');
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
insert into config (config_key, config_value, config_user) VALUES ('useCustomLogo', 'False', 0) ON CONFLICT DO NOTHING;
2+
insert into config (config_key, config_value, config_user) VALUES ('customLogoData', '', 0) ON CONFLICT DO NOTHING;
13
insert into stm_action (action_id,action_name) VALUES (30,'ask') ON CONFLICT DO NOTHING; -- cp

roles/lib/files/FWO.Basics/GlobalConstants.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ public struct GlobalConst
6363
public const string ChromeBinPathLinux = "/usr/local/fworch/bin";
6464
public const string TestPDFFilePath = "pdffile.pdf";
6565
public const string TestPDFHtmlTemplate = "<html><body><h1>test</h1><h2>test mit puppteer</h2></body></html>";
66+
67+
public const int MaxUploadFileSize = 5 * 1024 * 1024; // 5 MB
6668
}
6769

6870
public struct PageName

roles/lib/files/FWO.Config.Api/Data/ConfigData.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Newtonsoft.Json;
1+
using Newtonsoft.Json;
22
using System.Text.Json;
33
using System.Text.Json.Serialization;
44
using FWO.Basics;
@@ -31,7 +31,13 @@ public class ConfigData : ICloneable
3131
[JsonProperty("welcomeMessage"), JsonPropertyName("welcomeMessage")]
3232
public string WelcomeMessage { get; set; } = "";
3333

34-
[JsonProperty("maxMessages"), JsonPropertyName("maxMessages"), UserConfigData]
34+
[JsonProperty("useCustomLogo"), JsonPropertyName("useCustomLogo")]
35+
public bool UseCustomLogo { get; set; }
36+
37+
[JsonProperty("customLogoData"), JsonPropertyName("customLogoData")]
38+
public string CustomLogoData { get; set; }
39+
40+
[JsonProperty("maxMessages"), JsonPropertyName("maxMessages"), UserConfigData]
3541
public int MaxMessages { get; set; } = 3;
3642

3743
[JsonProperty("elementsPerFetch"), JsonPropertyName("elementsPerFetch"), UserConfigData]

roles/ui/files/FWO.UI/Data/CSVAppServerImportModel.cs renamed to roles/lib/files/FWO.Data/CSVAppServerImportModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using FWO.Basics;
22
using FWO.Data.Modelling;
33

4-
namespace FWO.Ui.Data
4+
namespace FWO.Data
55
{
66
public class CSVAppServerImportModel
77
{

roles/ui/files/FWO.UI/Data/CSVFileUploadErrorModel.cs renamed to roles/lib/files/FWO.Data/CSVFileUploadErrorModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace FWO.Ui.Data
1+
namespace FWO.Data
22
{
33
/// <summary>
44
/// Defines a model for errors that occured on csv file upload

roles/ui/files/FWO.UI/Data/ErrorBaseModel.cs renamed to roles/lib/files/FWO.Data/ErrorBaseModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace FWO.Ui.Data
1+
namespace FWO.Data
22
{
33
public class ErrorBaseModel()
44
{

roles/ui/files/FWO.UI/Data/MessageType.cs renamed to roles/lib/files/FWO.Data/MessageType.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace FWO.Ui.Data
1+
namespace FWO.Data
22
{
33
public enum MessageType
44
{
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using FWO.Services.EventMediator.Interfaces;
2+
3+
namespace FWO.Services.EventMediator.Events
4+
{
5+
public class AppServerImportEvent(AppServerImportEventArgs? eventArgs = default) : IEvent
6+
{
7+
public AppServerImportEventArgs? EventArgs { get; set; } = eventArgs ?? new AppServerImportEventArgs();
8+
9+
IEventArgs? IEvent.EventArgs
10+
{
11+
get => EventArgs;
12+
set => EventArgs = value as AppServerImportEventArgs;
13+
}
14+
}
15+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using FWO.Data;
2+
using FWO.Services.EventMediator.Interfaces;
3+
4+
namespace FWO.Services.EventMediator.Events
5+
{
6+
public class AppServerImportEventArgs(bool success = false) : IEventArgs
7+
{
8+
public bool Success { get; set; } = success;
9+
public List<CSVFileUploadErrorModel> Errors { get; set; } = [];
10+
public List<string> Appserver { get; set; } = [];
11+
}
12+
}

0 commit comments

Comments
 (0)