Swaped from CIS to NIST controls
This commit is contained in:
@@ -52,7 +52,7 @@ def get_risk_table(document):
|
||||
controls = (
|
||||
DocumentRiskControl.objects
|
||||
.filter(document=document, risk_id=risk['id'])
|
||||
.values('control', 'control__name', 'weight', 'likelihood')
|
||||
.values('control', 'control__subcategory', 'control__function', 'weight', 'likelihood')
|
||||
.distinct()
|
||||
)
|
||||
max_weight = 10*5
|
||||
@@ -90,10 +90,12 @@ def get_safeguard_summary_table(risks_with_controls):
|
||||
for risk in risks_with_controls:
|
||||
for control in risk.get('controls', []):
|
||||
control_id = control.get('control')
|
||||
control_name = control.get('control__name')
|
||||
subc = control.get('control__subcategory') or ''
|
||||
func = control.get('control__function') or ''
|
||||
label = f"{subc} - {func}".rstrip(" -")
|
||||
if control_id:
|
||||
safeguard_counter[control_id] += 1
|
||||
safeguard_names[control_id] = control_name
|
||||
safeguard_names[control_id] = label
|
||||
|
||||
summary = []
|
||||
controls = Control.objects.filter(id__in=safeguard_counter.keys())
|
||||
@@ -103,9 +105,10 @@ def get_safeguard_summary_table(risks_with_controls):
|
||||
control = controls_map.get(control_id)
|
||||
summary.append({
|
||||
'id': control_id,
|
||||
'safeguard_id': control.safeguard_id if control else '',
|
||||
'subcategory': control.subcategory if control else '',
|
||||
'category': control.category if control else '',
|
||||
'function': control.function if control else '',
|
||||
'name': safeguard_names.get(control_id, ''),
|
||||
'description': control.description if control else '',
|
||||
'count': count,
|
||||
})
|
||||
summary.sort(key=lambda x: x['count'], reverse=True)
|
||||
|
||||
Reference in New Issue
Block a user