Skip to content

Commit 7ae2429

Browse files
authored
Merge branch 'develop' into refactor/remove-background-of-maintenance-image
2 parents c6d5bd3 + 7ad7312 commit 7ae2429

File tree

11 files changed

+121
-198
lines changed

11 files changed

+121
-198
lines changed

documentation/revision-history-develop.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,4 +300,7 @@ bugfix release:
300300

301301
# 8.9.2 - 17.10.2025 DEVELOP
302302
- add ownerLifeCycleState
303-
- add manageable ownerLifeCycleState menu
303+
- add manageable ownerLifeCycleState menu
304+
305+
# 8.9.3 - 05.11.2025 DEVELOP
306+
- hotfix missing permissions for app data import in certain constellations

documentation/revision-history-main.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,3 +552,13 @@ hotfix release
552552
- fixing services-other ip proto import
553553
- improved quality control with stricter automated checks
554554
- various fixes in modelling module
555+
556+
# 8.9.1 - 02.10.2025 MAIN
557+
- owner-recertification
558+
559+
# 8.9.2 - 17.10.2025 MAIN
560+
- add ownerLifeCycleState
561+
- add manageable ownerLifeCycleState menu
562+
563+
# 8.9.3 - 05.11.2025 MAIN
564+
- hotfix missing permissions for app data import in certain constellations

inventory/group_vars/all.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
### general settings
2-
product_version: "8.9.2"
2+
product_version: "8.9.3"
33
ansible_user: "{{ lookup('env', 'USER') }}"
44
ansible_become_method: sudo
55
ansible_python_interpreter: /usr/bin/python3
@@ -59,6 +59,7 @@ debian_testing_version: "12"
5959
# should actually be 13 but microsoft does not yet provide https://packages.microsoft.com/config/debian/13
6060
debian_testing_release_name: trixie
6161
arch: x86_64
62+
linux_architecture: amd64
6263
redhat_major_version: "8"
6364
redhat_arch: "{{ redhat_major_version }}-{{ arch }}"
6465

roles/api/files/replace_metadata.json

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10033,20 +10033,25 @@
1003310033
"check": {},
1003410034
"columns": [
1003510035
"active",
10036-
"app_id_external",
1003710036
"common_service_possible",
10037+
"is_default",
10038+
"recert_active",
10039+
"app_id_external",
1003810040
"criticality",
1003910041
"dn",
1004010042
"group_dn",
10041-
"id",
1004210043
"import_source",
10043-
"is_default",
10044-
"last_recert_check",
10044+
"last_recertifier_dn",
1004510045
"name",
10046-
"recert_active",
1004710046
"recert_check_params",
10047+
"id",
10048+
"last_recertifier",
10049+
"owner_lifecycle_state_id",
1004810050
"recert_interval",
10049-
"tenant_id"
10051+
"tenant_id",
10052+
"last_recert_check",
10053+
"last_recertified",
10054+
"next_recert_date"
1005010055
]
1005110056
},
1005210057
"comment": ""
@@ -10443,20 +10448,25 @@
1044310448
"permission": {
1044410449
"columns": [
1044510450
"active",
10446-
"app_id_external",
1044710451
"common_service_possible",
10452+
"is_default",
10453+
"recert_active",
10454+
"app_id_external",
1044810455
"criticality",
1044910456
"dn",
1045010457
"group_dn",
10451-
"id",
1045210458
"import_source",
10453-
"is_default",
10454-
"last_recert_check",
10459+
"last_recertifier_dn",
1045510460
"name",
10456-
"recert_active",
1045710461
"recert_check_params",
10462+
"id",
10463+
"last_recertifier",
10464+
"owner_lifecycle_state_id",
1045810465
"recert_interval",
10459-
"tenant_id"
10466+
"tenant_id",
10467+
"last_recert_check",
10468+
"last_recertified",
10469+
"next_recert_date"
1046010470
],
1046110471
"filter": {},
1046210472
"check": null
@@ -26195,4 +26205,4 @@
2619526205
]
2619626206
}
2619726207
}
26198-
}
26208+
}

roles/api/tasks/hasura-install.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
# only download new version of api cli, when not restoring from backup:
6767
- name: download {{ api_hasura_version }} hasura cli binary
6868
get_url:
69-
url: "https://github.com/hasura/graphql-engine/releases/download/{{ api_hasura_version }}/cli-hasura-linux-amd64"
69+
url: "https://github.com/hasura/graphql-engine/releases/download/{{ api_hasura_version }}/cli-hasura-linux-{{ linux_architecture }}"
7070
dest: "{{ api_hasura_cli_bin }}"
7171
force: true
7272
mode: "0755"

roles/database/files/sql/idempotent/fworch-rule-recert.sql

Lines changed: 57 additions & 158 deletions
Original file line numberDiff line numberDiff line change
@@ -8,166 +8,62 @@
88

99

1010

11-
12-
-- fundamental function to check owner <--> rule mapping using the existing view
13-
-- "view_rule_with_owner"
14-
CREATE OR REPLACE FUNCTION recert_owner_responsible_for_rule (i_owner_id INTEGER, i_rule_id BIGINT) RETURNS BOOLEAN AS $$
11+
-- This function returns a table of future recert entries
12+
-- but does not write them into the recertification table
13+
CREATE OR REPLACE FUNCTION recert_get_one_owner_one_mgm(
14+
i_owner_id INTEGER,
15+
i_mgm_id INTEGER
16+
)
17+
RETURNS SETOF recertification AS
18+
$$
1519
DECLARE
16-
i_id BIGINT;
20+
b_super_owner BOOLEAN := FALSE;
1721
BEGIN
18-
-- check if this is the super owner:
19-
SELECT INTO i_id id FROM owner WHERE id=i_owner_id AND is_default;
20-
IF FOUND THEN -- this is the super owner
21-
SELECT INTO i_id rule_id FROM view_rule_with_owner WHERE owner_id IS NULL AND rule_id=i_rule_id;
22-
IF FOUND THEN
23-
RAISE DEBUG '%', 'rule found for super owner ' || i_rule_id;
24-
RETURN TRUE;
25-
ELSE
26-
RETURN FALSE;
27-
END IF;
28-
ELSE -- standard owner
29-
SELECT INTO i_id rule_id FROM view_rule_with_owner WHERE owner_id=i_owner_id AND rule_id=i_rule_id;
30-
IF FOUND THEN
31-
RETURN TRUE;
32-
ELSE
33-
RETURN FALSE;
34-
END IF;
35-
END IF;
22+
-- Check if this is the super owner
23+
SELECT TRUE INTO b_super_owner FROM owner WHERE id = i_owner_id AND is_default;
24+
25+
RETURN QUERY
26+
SELECT DISTINCT
27+
NULL::bigint AS id,
28+
M.rule_metadata_id,
29+
R.rule_id,
30+
V.matches::VARCHAR AS ip_match,
31+
CASE WHEN b_super_owner THEN NULL ELSE i_owner_id END AS owner_id,
32+
NULL::VARCHAR AS user_dn,
33+
FALSE::BOOLEAN AS recertified,
34+
NULL::TIMESTAMP AS recert_date,
35+
NULL::VARCHAR AS comment,
36+
MAX((
37+
SELECT MAX(value)::TIMESTAMP
38+
FROM (
39+
SELECT I.start_time::timestamp + make_interval(days => O.recert_interval) AS value
40+
UNION
41+
SELECT C.recert_date + make_interval(days => O.recert_interval) AS value
42+
) AS tmp
43+
)) AS next_recert_date,
44+
NULL::bigint AS owner_recert_id
45+
FROM
46+
view_rule_with_owner V
47+
LEFT JOIN rule R USING (rule_id)
48+
LEFT JOIN rule_metadata M ON (R.rule_uid = M.rule_uid AND R.dev_id = M.dev_id)
49+
LEFT JOIN owner O ON (
50+
CASE WHEN b_super_owner THEN O.is_default ELSE V.owner_id = O.id END
51+
)
52+
LEFT JOIN import_control I ON (R.rule_create = I.control_id)
53+
LEFT JOIN recertification C ON (M.rule_metadata_id = C.rule_metadata_id)
54+
WHERE
55+
(
56+
(b_super_owner AND V.owner_id IS NULL)
57+
OR
58+
(NOT b_super_owner AND V.owner_id = i_owner_id)
59+
)
60+
AND R.mgm_id = i_mgm_id
61+
AND R.active
62+
AND (recert_date IS NULL OR (recert_date IS NOT NULL AND recertified))
63+
GROUP BY M.rule_metadata_id, R.rule_id, V.matches;
3664
END;
37-
$$ LANGUAGE plpgsql;
38-
39-
-- this function deletes existing (future) open recert entries and inserts the new ones into the recertificaiton table
40-
-- the new recert date will only replace an existing one, if it is closer (smaller)
41-
CREATE OR REPLACE FUNCTION recert_refresh_one_owner_one_mgm
42-
(i_owner_id INTEGER, i_mgm_id INTEGER, t_requested_next_recert_date TIMESTAMP) RETURNS VOID AS $$
43-
DECLARE
44-
r_rule RECORD;
45-
i_recert_entry_id BIGINT;
46-
b_super_owner BOOLEAN := FALSE;
47-
t_rule_created TIMESTAMP;
48-
t_current_next_recert_date TIMESTAMP;
49-
t_next_recert_date_by_interval TIMESTAMP;
50-
t_rule_last_recertified TIMESTAMP;
51-
t_next_recert_date TIMESTAMP;
52-
i_recert_inverval INTEGER;
53-
b_never_recertified BOOLEAN := FALSE;
54-
b_no_current_next_recert_date BOOLEAN := FALSE;
55-
b_super_owner_exists BOOLEAN := FALSE;
56-
i_previous_import BIGINT;
57-
i_current_import_id BIGINT;
58-
i_super_owner_id INT;
59-
i_current_owner_id_tmp INT;
60-
BEGIN
61-
IF i_owner_id IS NULL OR i_mgm_id IS NULL THEN
62-
IF i_owner_id IS NULL THEN
63-
RAISE WARNING 'found undefined owner_id in recert_refresh_one_owner_one_mgm';
64-
ELSE -- mgm_id NULL
65-
RAISE WARNING 'found undefined mgm_id in recert_refresh_one_owner_one_mgm';
66-
END IF;
67-
ELSE
68-
-- get id of previous import:
69-
SELECT INTO i_current_import_id control_id FROM import_control WHERE mgm_id=i_mgm_id AND stop_time IS NULL;
70-
SELECT INTO i_previous_import * FROM get_previous_import_id_for_mgmt(i_mgm_id,i_current_import_id);
71-
IF NOT FOUND OR i_previous_import IS NULL THEN
72-
i_previous_import := -1; -- prevent match for previous import
73-
END IF;
74-
75-
SELECT INTO i_super_owner_id id FROM owner WHERE is_default;
76-
IF FOUND THEN
77-
b_super_owner_exists := TRUE;
78-
END IF;
79-
80-
SELECT INTO i_current_owner_id_tmp id FROM owner WHERE id=i_owner_id AND is_default;
81-
IF FOUND THEN
82-
b_super_owner := TRUE;
83-
END IF;
84-
85-
SELECT INTO i_recert_inverval recert_interval FROM owner WHERE id=i_owner_id;
86-
87-
FOR r_rule IN
88-
SELECT rule_uid, rule_id FROM rule WHERE mgm_id=i_mgm_id AND (active OR NOT active AND rule_last_seen=i_previous_import)
89-
LOOP
90-
91-
IF recert_owner_responsible_for_rule (i_owner_id, r_rule.rule_id) THEN
92-
93-
-- collects dates
94-
SELECT INTO t_current_next_recert_date next_recert_date FROM recertification
95-
WHERE owner_id=i_owner_id AND rule_id=r_rule.rule_id AND recert_date IS NULL;
96-
97-
IF NOT FOUND THEN
98-
b_no_current_next_recert_date := TRUE;
99-
END IF;
100-
101-
SELECT INTO t_rule_last_recertified MAX(recert_date)
102-
FROM recertification
103-
WHERE rule_id=r_rule.rule_id AND NOT recert_date IS NULL;
104-
105-
IF NOT FOUND OR t_rule_last_recertified IS NULL THEN -- no prior recertification, use initial rule import date
106-
b_never_recertified := TRUE;
107-
SELECT INTO t_rule_created rule_metadata.rule_created
108-
FROM rule
109-
LEFT JOIN rule_metadata ON (rule.rule_uid=rule_metadata.rule_uid AND rule.dev_id=rule_metadata.dev_id)
110-
WHERE rule_id=r_rule.rule_id;
111-
END IF;
112-
113-
IF t_requested_next_recert_date IS NULL THEN
114-
-- if the currenct next recert date is before the intended fixed input date, ignore it
115-
IF b_never_recertified THEN
116-
t_next_recert_date := t_rule_created + make_interval (days => i_recert_inverval);
117-
ELSE
118-
t_next_recert_date := t_rule_last_recertified + make_interval (days => i_recert_inverval);
119-
END IF;
120-
ELSE
121-
t_next_recert_date := t_requested_next_recert_date;
122-
END IF;
123-
124-
-- do not set next recert date later than actually calculated date
125-
IF NOT b_no_current_next_recert_date THEN
126-
IF t_next_recert_date>t_current_next_recert_date THEN
127-
t_next_recert_date := t_current_next_recert_date;
128-
END IF;
129-
END IF;
130-
131-
-- delete old recert entry:
132-
DELETE FROM recertification WHERE owner_id=i_owner_id AND rule_id=r_rule.rule_id AND recert_date IS NULL;
133-
134-
-- add new recert entry:
135-
IF b_super_owner THEN -- special case for super owner (convert NULL to ID)
136-
INSERT INTO recertification (rule_metadata_id, next_recert_date, rule_id, ip_match, owner_id)
137-
SELECT rule_metadata_id,
138-
t_next_recert_date AS next_recert_date,
139-
rule_id,
140-
matches as ip_match,
141-
i_owner_id AS owner_id
142-
FROM view_rule_with_owner
143-
LEFT JOIN rule USING (rule_id)
144-
LEFT JOIN rule_metadata ON (rule.rule_uid=rule_metadata.rule_uid AND rule.dev_id=rule_metadata.dev_id)
145-
WHERE view_rule_with_owner.rule_id=r_rule.rule_id AND view_rule_with_owner.owner_id IS NULL;
146-
ELSE
147-
INSERT INTO recertification (rule_metadata_id, next_recert_date, rule_id, ip_match, owner_id)
148-
SELECT rule_metadata_id,
149-
t_next_recert_date AS next_recert_date,
150-
rule_id,
151-
matches as ip_match,
152-
i_owner_id AS owner_id
153-
FROM view_rule_with_owner
154-
LEFT JOIN rule USING (rule_id)
155-
LEFT JOIN rule_metadata ON (rule.rule_uid=rule_metadata.rule_uid AND rule.dev_id=rule_metadata.dev_id)
156-
WHERE view_rule_with_owner.rule_id=r_rule.rule_id AND view_rule_with_owner.owner_id=i_owner_id;
157-
END IF;
158-
ELSE
159-
-- delete old outdated recert entry if owner is not responsible any more
160-
DELETE FROM recertification WHERE owner_id=i_owner_id AND rule_id=r_rule.rule_id AND recert_date IS NULL;
161-
END IF;
162-
END LOOP;
65+
$$ LANGUAGE plpgsql STABLE;
16366

164-
-- -- finally, when not super user - recalculate super user recert entries - since these might change with each owner change
165-
-- IF NOT b_super_owner AND b_super_owner_exists THEN
166-
-- PERFORM recert_refresh_one_owner_one_mgm (i_super_owner_id, i_mgm_id, t_requested_next_recert_date);
167-
-- END IF;
168-
END IF;
169-
END;
170-
$$ LANGUAGE plpgsql;
17167

17268

17369
-- function used during import of a single management config
@@ -188,6 +84,7 @@ BEGIN
18884
END;
18985
$$ LANGUAGE plpgsql;
19086

87+
-- select * from recert_get_one_owner_one_mgm(4,1)
19188

19289
-- this function returns a table of future recert entries
19390
-- but does not write them into the recertification table
@@ -226,7 +123,8 @@ BEGIN
226123
SELECT I.start_time::timestamp + make_interval (days => o.recert_interval) AS value
227124
UNION
228125
SELECT C.recert_date + make_interval (days => o.recert_interval) AS value
229-
) AS temp_table))
126+
) AS temp_table)),
127+
NULL::bigint AS owner_recert_id
230128
FROM
231129
view_rule_with_owner V
232130
LEFT JOIN rule R USING (rule_id)
@@ -253,7 +151,8 @@ BEGIN
253151
SELECT I.start_time::timestamp + make_interval (days => o.recert_interval) AS value
254152
UNION
255153
SELECT C.recert_date + make_interval (days => o.recert_interval) AS value
256-
) AS temp_table))
154+
) AS temp_table)),
155+
NULL::bigint AS owner_recert_id
257156
FROM
258157
view_rule_with_owner V
259158
LEFT JOIN rule R USING (rule_id)

roles/lib/files/FWO.Api.Client/APIcalls/recertification/getOpenRecerts.graphql

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)