wbcompliance 1.58.0__py2.py3-none-any.whl → 1.58.2__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wbcompliance/models/risk_management/checks.py +6 -3
- wbcompliance/serializers/risk_management/checks.py +1 -1
- wbcompliance/viewsets/risk_management/checks.py +13 -2
- {wbcompliance-1.58.0.dist-info → wbcompliance-1.58.2.dist-info}/METADATA +1 -1
- {wbcompliance-1.58.0.dist-info → wbcompliance-1.58.2.dist-info}/RECORD +6 -6
- {wbcompliance-1.58.0.dist-info → wbcompliance-1.58.2.dist-info}/WHEEL +0 -0
|
@@ -99,9 +99,12 @@ class RiskCheck(ComplexToStringMixin, WBModel):
|
|
|
99
99
|
@property
|
|
100
100
|
def needs_incident(self) -> bool:
|
|
101
101
|
# if the there is a similar checked object relationship, we needs to create a general incident if the check evaluates to a breach
|
|
102
|
-
return
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
return (
|
|
103
|
+
self.rule.checked_object_relationships.filter(
|
|
104
|
+
checked_object_content_type=self.checked_object_content_type, checked_object_id=self.checked_object_id
|
|
105
|
+
).exists()
|
|
106
|
+
or self.activator_id is not None
|
|
107
|
+
)
|
|
105
108
|
|
|
106
109
|
@property
|
|
107
110
|
def previous_check(self) -> Self | None:
|
|
@@ -17,7 +17,7 @@ class RiskCheckModelSerializer(wb_serializers.ModelSerializer):
|
|
|
17
17
|
_rule = RiskRuleRepresentationSerializer(source="rule")
|
|
18
18
|
_checked_object_content_type = ContentTypeRepresentationSerializer(source="checked_object_content_type")
|
|
19
19
|
|
|
20
|
-
incident_reports = wb_serializers.TextField()
|
|
20
|
+
incident_reports = wb_serializers.TextField(read_only=True)
|
|
21
21
|
status_icon = IconSelectField(read_only=True)
|
|
22
22
|
|
|
23
23
|
@wb_serializers.register_resource()
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
from django.contrib.auth import get_user_model
|
|
2
2
|
from django.contrib.postgres.aggregates import StringAgg
|
|
3
3
|
from django.db import models
|
|
4
|
-
from django.db.models import F
|
|
4
|
+
from django.db.models import F, OuterRef, Subquery, Value
|
|
5
|
+
from django.db.models.functions import Concat
|
|
5
6
|
from wbcore import viewsets
|
|
6
7
|
|
|
7
8
|
from wbcompliance.filters.risk_management.checks import RiskCheckFilterSet
|
|
9
|
+
from wbcompliance.models import CheckedObjectIncidentRelationship
|
|
8
10
|
from wbcompliance.models.risk_management import RiskCheck
|
|
9
11
|
from wbcompliance.serializers import (
|
|
10
12
|
RiskCheckModelSerializer,
|
|
@@ -35,6 +37,15 @@ class RiskCheckModelViewSet(viewsets.ModelViewSet):
|
|
|
35
37
|
filterset_class = RiskCheckFilterSet
|
|
36
38
|
|
|
37
39
|
def get_queryset(self):
|
|
40
|
+
rel = (
|
|
41
|
+
CheckedObjectIncidentRelationship.objects.filter(rule_check=OuterRef("id"))
|
|
42
|
+
.annotate(
|
|
43
|
+
title=Concat(F("incident__breached_object_repr"), Value(" ( "), F("breached_value"), Value(" ) "))
|
|
44
|
+
)
|
|
45
|
+
.values("rule_check")
|
|
46
|
+
.annotate(incident_reports=StringAgg("title", delimiter="<br>"))
|
|
47
|
+
.values("incident_reports")
|
|
48
|
+
)
|
|
38
49
|
return (
|
|
39
50
|
RiskCheck.all_objects.annotate(
|
|
40
51
|
status_icon=models.Case(
|
|
@@ -44,7 +55,7 @@ class RiskCheckModelViewSet(viewsets.ModelViewSet):
|
|
|
44
55
|
],
|
|
45
56
|
default=models.Value("none"),
|
|
46
57
|
),
|
|
47
|
-
incident_reports=
|
|
58
|
+
incident_reports=Subquery(rel),
|
|
48
59
|
)
|
|
49
60
|
.select_related(
|
|
50
61
|
"rule",
|
|
@@ -55,7 +55,7 @@ wbcompliance/models/compliance_type.py,sha256=Euevn9BRt7_R7lv49kTDlkMoL1uTQuUKWn
|
|
|
55
55
|
wbcompliance/models/enums.py,sha256=id1m8trG7b6Sw3Sa9VrLgD104GC2nG9A8ngJzaRqIIQ,424
|
|
56
56
|
wbcompliance/models/risk_management/__init__.py,sha256=DJXoHheA5REDpPYP0uyRmFWyNKP-ir_z5YB61CN6N-E,247
|
|
57
57
|
wbcompliance/models/risk_management/backend.py,sha256=pbszChXMxA36JjK0nIkrz0k7w9ImKUTGMVlokgA1R-w,4736
|
|
58
|
-
wbcompliance/models/risk_management/checks.py,sha256=
|
|
58
|
+
wbcompliance/models/risk_management/checks.py,sha256=S9MkG3kmMzixx9bi2P2SEREj9b25dstiPeThGx6jeHI,8601
|
|
59
59
|
wbcompliance/models/risk_management/dispatch.py,sha256=cLi63vSGbk9xhCoVgr4UmVk2kfYmGiyohKINSvCodb0,1423
|
|
60
60
|
wbcompliance/models/risk_management/incidents.py,sha256=RNYjsFK87JLUByF4hcWk5W8eYL6sdlojfPuLdXCgYcE,23803
|
|
61
61
|
wbcompliance/models/risk_management/mixins.py,sha256=KsdjpM1Cl235z8h57USVcYSBKtO2VRH1S0FCuJOEMH0,3762
|
|
@@ -65,7 +65,7 @@ wbcompliance/serializers/compliance_form.py,sha256=OxPILlup_CP4Qwvu864oMqz7QUZsk
|
|
|
65
65
|
wbcompliance/serializers/compliance_task.py,sha256=euTQya2LdexoRblew9zMkv40kU7wkW9nU2uLTI-lwow,17035
|
|
66
66
|
wbcompliance/serializers/compliance_type.py,sha256=kxQTLS9JfGStJ1dJYmU_TlZh7Jqn3_9h_ZMAjiL61lA,1048
|
|
67
67
|
wbcompliance/serializers/risk_management/__init__.py,sha256=_95Z1L6f7muQ0UvbEY1P3ROK3nqwkjhgYf3onRhWmv0,733
|
|
68
|
-
wbcompliance/serializers/risk_management/checks.py,sha256=
|
|
68
|
+
wbcompliance/serializers/risk_management/checks.py,sha256=ARnpvZWfn-6wfrYt1dRasofyiZcQOmMjRGyrClmy_Vc,1756
|
|
69
69
|
wbcompliance/serializers/risk_management/incidents.py,sha256=WHxeBn0VnLTrMJVULgCeCs-upKqEj-4rN4h8lYvcIQA,8475
|
|
70
70
|
wbcompliance/serializers/risk_management/rules.py,sha256=-g7_zzJKDPYs01wdlSrFwwcd-yVMosuR6yHad7gYpGA,5527
|
|
71
71
|
wbcompliance/templates/compliance/compliance_form.html,sha256=IR71gVnKlUZNalS63D4v18uwNg2GtbOWtqX4bCAON08,11943
|
|
@@ -123,7 +123,7 @@ wbcompliance/viewsets/menu/compliance_task.py,sha256=SsB9wrP13VBdxFBYYOT2Dh0isRk
|
|
|
123
123
|
wbcompliance/viewsets/menu/compliance_type.py,sha256=8jvu9dFhTeYqJy0lhx4BD_rOeVi4iz073BPKYbnkuFY,684
|
|
124
124
|
wbcompliance/viewsets/menu/risk_management.py,sha256=3rxNrWw9sET7BqulxXWjAehg5NRIKmNoyTrBLOHx4g8,1969
|
|
125
125
|
wbcompliance/viewsets/risk_management/__init__.py,sha256=Gu2vavnClUg9RKpGMhwqo_DOv-FLAGlBf7BbYNyEkJM,821
|
|
126
|
-
wbcompliance/viewsets/risk_management/checks.py,sha256=
|
|
126
|
+
wbcompliance/viewsets/risk_management/checks.py,sha256=LPePqnrJ1alhSgGyMPfh_-13AE_-KLicZN-OEXx6qgg,2449
|
|
127
127
|
wbcompliance/viewsets/risk_management/incidents.py,sha256=WauVZq2QVB07rTxC-Bz4SUbNbQIJxe2r3jKs_ubrdPI,8230
|
|
128
128
|
wbcompliance/viewsets/risk_management/mixins.py,sha256=g8gF7Glzc36bKfKng9jlb9CCXAqsVZsGfHc6SjDHGlY,1559
|
|
129
129
|
wbcompliance/viewsets/risk_management/rules.py,sha256=2YYST-uULbJt1Y6IwK2GPmVTetXQCTt64Zrj4UEnHzo,6960
|
|
@@ -137,6 +137,6 @@ wbcompliance/viewsets/titles/risk_managment/checks.py,sha256=47DEQpj8HBSa-_TImW-
|
|
|
137
137
|
wbcompliance/viewsets/titles/risk_managment/incidents.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
138
138
|
wbcompliance/viewsets/titles/risk_managment/rules.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
139
139
|
wbcompliance/viewsets/titles/risk_managment/tables.py,sha256=x_9mr6JWZ9GVNAEvfdNCeFZtGGYSG0-sXrR9pwTyocU,256
|
|
140
|
-
wbcompliance-1.58.
|
|
141
|
-
wbcompliance-1.58.
|
|
142
|
-
wbcompliance-1.58.
|
|
140
|
+
wbcompliance-1.58.2.dist-info/METADATA,sha256=b-g_BhIQAfpT6lk1a-MJHC7yC7pqsodloBECs988X-o,196
|
|
141
|
+
wbcompliance-1.58.2.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
|
|
142
|
+
wbcompliance-1.58.2.dist-info/RECORD,,
|
|
File without changes
|