Skip to content

Commit 2c35d88

Browse files
[+] Check empty service groups
[+] Add mouseover event for the invalid state of the empty service group. [+] invalid service groups should not be included in the ticket CactuseSecurity#3085
1 parent 4107338 commit 2c35d88

File tree

4 files changed

+61
-40
lines changed

4 files changed

+61
-40
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3313,6 +3313,10 @@ INSERT INTO txt VALUES ('C9017', 'German', 'Hier kann der Name des App-Servers,
33133313
INSERT INTO txt VALUES ('C9017', 'English', 'Here the name of the App Server, which is created on saving anyway, can be generated for display in advance.
33143314
The name is searched in the DNS. If not found, it is constructed according to the naming convention.
33153315
');
3316+
INSERT INTO txt VALUES ('C9018', 'German', 'Leere Service Gruppe(n) enthalten. Diese Verbindung wird nicht beantragt.');
3317+
INSERT INTO txt VALUES ('C9018', 'English', 'Contains empty Service Groups(s). This connection will not be requested.');
3318+
INSERT INTO txt VALUES ('C9019', 'German', 'Leere Service Gruppe(n) enthalten. Nutzende Verbindungen dieser Schnittstelle werden nicht beantragt.');
3319+
INSERT INTO txt VALUES ('C9019', 'English', 'Contains empty Service Groups(s). Connections using this interface will not be requested.');
33163320

33173321
-- help pages
33183322
INSERT INTO txt VALUES ('H0001', 'German', 'Firewall Orchestrator ist eine Anwendung zum Erzeugen und Verwalten von verschiedenen Reports aus Konfigurationsdaten verteilter Firewallsysteme.

roles/lib/files/FWO.Data/Modelling/ModellingConnection.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Text.Json.Serialization;
1+
using System.Text.Json.Serialization;
22
using Newtonsoft.Json;
33

44
namespace FWO.Data.Modelling
@@ -14,7 +14,8 @@ public enum ConState
1414
Rejected,
1515

1616
EmptyAppRoles,
17-
DeletedObjects
17+
DeletedObjects,
18+
EmptySvcGrps
1819
}
1920

2021
public class ModellingConnection
@@ -279,6 +280,15 @@ public void SyncState(long dummyAppRoleId)
279280
{
280281
RemoveProperty(ConState.DeletedObjects.ToString());
281282
}
283+
284+
if (EmptyServiceGroupsFound())
285+
{
286+
AddProperty(ConState.EmptySvcGrps.ToString());
287+
}
288+
else
289+
{
290+
RemoveProperty(ConState.EmptySvcGrps.ToString());
291+
}
282292
}
283293

284294
public bool EmptyAppRolesFound(long dummyAppRoleId)
@@ -300,6 +310,9 @@ public bool EmptyAppRolesFound(long dummyAppRoleId)
300310
return false;
301311
}
302312

313+
public bool EmptyServiceGroupsFound()
314+
=> ServiceGroups.Any(_ => _.Content.Services.Count == 0);
315+
303316
public bool DeletedObjectsFound()
304317
{
305318
foreach(var area in SourceAreas)

roles/ui/files/FWO.UI/Services/ModellingAppHandler.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using FWO.Config.Api;
1+
using FWO.Config.Api;
22
using FWO.Data;
33
using FWO.Data.Modelling;
44
using FWO.Api.Client;
@@ -152,7 +152,8 @@ public List<ModellingConnection> GetConnectionsToRequest()
152152
x.GetBoolProperty(ConState.InterfaceRequested.ToString()) ||
153153
x.GetBoolProperty(ConState.InterfaceRejected.ToString()) ||
154154
x.EmptyAppRolesFound(dummyAppRoleId) ||
155-
x.DeletedObjectsFound()
155+
x.DeletedObjectsFound() ||
156+
x.EmptyServiceGroupsFound()
156157
)).OrderByDescending(y => y.IsCommonService)];
157158
}
158159

roles/ui/files/FWO.UI/Shared/ConnectionTable.razor

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,82 +5,82 @@
55

66
@if (ShowPageSizeInput)
77
{
8-
<PageSizeComponent PageSizeCallback="UpdatePageSize"></PageSizeComponent>
8+
<PageSizeComponent PageSizeCallback="UpdatePageSize"></PageSizeComponent>
99
}
1010
<Table class="table table-bordered th-bg-secondary sticky-header show-scrollbar table-responsive" TableItem="ModellingConnection"
1111
Items="Connections" PageSize="PageSize" ColumnReorder="true" TableRowClass="@(con => getTableRowClass(con))"
1212
SelectedItems="SelectedConns" RowClickAction="@(conn => ToggleSelection(conn))">
1313
@if (!Readonly && !SelectInterfaceView && AppHandler != null)
1414
{
15-
<Column TableItem="ModellingConnection" Title="@(userConfig.GetText("actions"))" Field="(x => x.Id)" Sortable="false" Filterable="false">
16-
<Template>
17-
<div class="btn-group">
18-
<button type="button" class="btn btn-sm btn-primary" @onclick="async () =>
15+
<Column TableItem="ModellingConnection" Title="@(userConfig.GetText("actions"))" Field="(x => x.Id)" Sortable="false" Filterable="false">
16+
<Template>
17+
<div class="btn-group">
18+
<button type="button" class="btn btn-sm btn-primary" @onclick="async () =>
1919
{ await AppHandler.ShowDetails(context); await AppHandlerChanged.InvokeAsync(AppHandler); }">
2020
@(AppHandler.DisplayButton("details", Icons.Display))
21-
</button>
21+
</button>
2222
@if (AppActive)
2323
{
2424
@if (!context.GetBoolProperty(ConState.InterfaceRejected.ToString()) && !context.GetBoolProperty(ConState.Rejected.ToString()))
2525
{
26-
<button type="button" class="btn btn-sm btn-warning" @onclick="async () =>
26+
<button type="button" class="btn btn-sm btn-warning" @onclick="async () =>
2727
{ await AppHandler.EditConn(context); await AppHandlerChanged.InvokeAsync(AppHandler); }">
2828
@(AppHandler.DisplayButton("edit", Icons.Edit))
29-
</button>
29+
</button>
3030
}
31-
<button type="button" class="btn btn-sm btn-danger" @onclick="async () =>
31+
<button type="button" class="btn btn-sm btn-danger" @onclick="async () =>
3232
{ await AppHandler.RequestDeleteConnection(context); await AppHandlerChanged.InvokeAsync(AppHandler); }">
3333
@(AppHandler.DisplayButton("delete", Icons.Delete))
34-
</button>
34+
</button>
3535
}
36-
</div>
37-
</Template>
38-
</Column>
36+
</div>
37+
</Template>
38+
</Column>
3939
}
4040
@if (ShowSelectionColumn)
4141
{
42-
<Column TableItem="ModellingConnection" Title="@(userConfig.GetText("select"))" Sortable="false" Filterable="false">
43-
<Template>
42+
<Column TableItem="ModellingConnection" Title="@(userConfig.GetText("select"))" Sortable="false" Filterable="false">
43+
<Template>
4444
@if (SelectionType == SelectionType.Single)
4545
{
46-
<input type="radio" checked="@(SelectedConns.Contains(context))" />
46+
<input type="radio" checked="@(SelectedConns.Contains(context))" />
4747
}
4848
else if (SelectionType == SelectionType.Multiple)
4949
{
50-
<input type="checkbox" checked="@(SelectedConns.Contains(context))" />
50+
<input type="checkbox" checked="@(SelectedConns.Contains(context))" />
5151
}
52-
</Template>
53-
</Column>
52+
</Template>
53+
</Column>
5454
}
5555
<Column TableItem="ModellingConnection" Title="@(userConfig.GetText("id"))" Field="@(x => x.Id)" Sortable="true" Filterable="true" />
5656
@if (!SelectInterfaceView)
5757
{
5858
@if (Connections.Count > 0 && Connections.First().IsInterface)
5959
{
60-
<Column TableItem="ModellingConnection" Title="@(userConfig.GetText("published"))" Field="@(x => x.IsPublished)" Sortable="true" Filterable="true">
61-
<Template>
62-
@(context.IsPublished.ShowAsHtml())
63-
</Template>
64-
</Column>
65-
}
66-
<Column TableItem="ModellingConnection" Title="@(userConfig.GetText("state"))" Field="@(x => x.Id)" Sortable="true" Filterable="false">
60+
<Column TableItem="ModellingConnection" Title="@(userConfig.GetText("published"))" Field="@(x => x.IsPublished)" Sortable="true" Filterable="true">
6761
<Template>
68-
@((MarkupString)DisplayState(context))
62+
@(context.IsPublished.ShowAsHtml())
6963
</Template>
7064
</Column>
65+
}
66+
<Column TableItem="ModellingConnection" Title="@(userConfig.GetText("state"))" Field="@(x => x.Id)" Sortable="true" Filterable="false">
67+
<Template>
68+
@((MarkupString)DisplayState(context))
69+
</Template>
70+
</Column>
7171
}
7272
@if (ShowAppName)
7373
{
74-
<Column TableItem="ModellingConnection" Title="@(userConfig.GetText("owner"))" Field="@(x => x.App.Name)" Sortable="true" Filterable="true">
75-
<Template>
74+
<Column TableItem="ModellingConnection" Title="@(userConfig.GetText("owner"))" Field="@(x => x.App.Name)" Sortable="true" Filterable="true">
75+
<Template>
7676
@(context.App?.DisplayWithoutAppId(userConfig.GetText("common_service")))
77-
</Template>
78-
</Column>
79-
<Column TableItem="ModellingConnection" Title="@(userConfig.GetText("ext_app_id"))" Field="@(x => x.App.ExtAppId)" Sortable="true" Filterable="true">
80-
<Template>
77+
</Template>
78+
</Column>
79+
<Column TableItem="ModellingConnection" Title="@(userConfig.GetText("ext_app_id"))" Field="@(x => x.App.ExtAppId)" Sortable="true" Filterable="true">
80+
<Template>
8181
@(context.App?.ExtAppId)
82-
</Template>
83-
</Column>
82+
</Template>
83+
</Column>
8484
}
8585
<Column TableItem="ModellingConnection" Title="@(userConfig.GetText("name"))" Field="@(x => x.Name)" Sortable="true" Filterable="true">
8686
<Template>
@@ -161,7 +161,7 @@ SelectedItems="SelectedConns" RowClickAction="@(conn => ToggleSelection(conn))">
161161

162162
[Parameter]
163163
public EventCallback<int> PageSizeCallback { get; set; }
164-
164+
165165
[Parameter]
166166
public bool ShowPageSizeInput { get; set; } = false;
167167

@@ -234,6 +234,9 @@ SelectedItems="SelectedConns" RowClickAction="@(conn => ToggleSelection(conn))">
234234
case nameof(ConState.DeletedObjects):
235235
relevantProps.Add($"<span class=\"text-warning\" data-toggle=\"tooltip\" title=\"{(connection.IsInterface ? userConfig.PureLine("C9016") : userConfig.PureLine("C9014"))}\">!</span>");
236236
break;
237+
case nameof(ConState.EmptySvcGrps):
238+
relevantProps.Add($"<span class=\"text-warning\" data-toggle=\"tooltip\" title=\"{( connection.IsInterface ? userConfig.PureLine("C9019") : userConfig.PureLine("C9018") )}\">!</span>");
239+
break;
237240
default:
238241
break;
239242
}

0 commit comments

Comments
 (0)