Skip to content

Commit

Permalink
Merge pull request #584 from intuitem/feat/inter-framework-mappings
Browse files Browse the repository at this point in the history
Feat/inter framework mappings
  • Loading branch information
ab-smith authored Jul 7, 2024
2 parents 93f6fd7 + 7a59dc0 commit 2201ffb
Show file tree
Hide file tree
Showing 46 changed files with 4,145 additions and 281 deletions.
10 changes: 10 additions & 0 deletions backend/core/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
"view_loadedlibrary",
"view_storedlibrary",
"view_user",
"view_requirementmappingset",
"view_requirementmapping",
]

APPROVER_PERMISSIONS_LIST = [
Expand All @@ -53,6 +55,8 @@
"view_storedlibrary",
"view_loadedlibrary",
"view_user",
"view_requirementmappingset",
"view_requirementmapping",
]

ANALYST_PERMISSIONS_LIST = [
Expand Down Expand Up @@ -107,6 +111,8 @@
"view_storedlibrary",
"view_loadedlibrary",
"view_user",
"view_requirementmappingset",
"view_requirementmapping",
]

DOMAIN_MANAGER_PERMISSIONS_LIST = [
Expand Down Expand Up @@ -166,6 +172,8 @@
"view_storedlibrary",
"view_loadedlibrary",
"view_user",
"view_requirementmappingset",
"view_requirementmapping",
]

ADMINISTRATOR_PERMISSIONS_LIST = [
Expand Down Expand Up @@ -250,6 +258,8 @@
"restore",
"view_globalsettings",
"change_globalsettings",
"view_requirementmappingset",
"view_requirementmapping",
]


Expand Down
4 changes: 4 additions & 0 deletions backend/core/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ def get_sorted_requirement_nodes_rec(start: list) -> dict:
"is_scored": req_as.is_scored if req_as else None,
"score": req_as.score if req_as else None,
"max_score": max_score if req_as else None,
"mapping_inference": req_as.mapping_inference if req_as else None,
"status_display": req_as.get_status_display() if req_as else None,
"status_i18n": camel_case(req_as.status) if req_as else None,
"result_i18n": camel_case(req_as.result)
Expand Down Expand Up @@ -311,6 +312,9 @@ def get_sorted_requirement_nodes_rec(start: list) -> dict:
"is_scored": child_req_as.is_scored if child_req_as else None,
"score": child_req_as.score if child_req_as else None,
"max_score": max_score if child_req_as else None,
"mapping_inference": child_req_as.mapping_inference
if child_req_as
else None,
"status_display": child_req_as.get_status_display()
if child_req_as
else None,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
# Generated by Django 5.0.6 on 2024-06-28 11:59

import django.core.validators
import django.db.models.deletion
import iam.models
import uuid
from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("core", "0015_remove_complianceassessment_result_and_more"),
("iam", "0004_ssosettings_user_is_sso"),
]

operations = [
migrations.AddField(
model_name="requirementassessment",
name="mapping_inference",
field=models.JSONField(default=dict, verbose_name="Mapping inference"),
),
migrations.CreateModel(
name="RequirementMappingSet",
fields=[
(
"id",
models.UUIDField(
default=uuid.uuid4,
editable=False,
primary_key=True,
serialize=False,
),
),
(
"created_at",
models.DateTimeField(auto_now_add=True, verbose_name="Created at"),
),
(
"updated_at",
models.DateTimeField(auto_now=True, verbose_name="Updated at"),
),
(
"is_published",
models.BooleanField(default=False, verbose_name="published"),
),
(
"urn",
models.CharField(
blank=True,
max_length=100,
null=True,
unique=True,
verbose_name="URN",
),
),
(
"ref_id",
models.CharField(
blank=True,
max_length=100,
null=True,
verbose_name="Reference ID",
),
),
(
"provider",
models.CharField(
blank=True, max_length=200, null=True, verbose_name="Provider"
),
),
(
"name",
models.CharField(max_length=200, null=True, verbose_name="Name"),
),
(
"description",
models.TextField(blank=True, null=True, verbose_name="Description"),
),
(
"annotation",
models.TextField(blank=True, null=True, verbose_name="Annotation"),
),
(
"version",
models.IntegerField(
default=1,
help_text="Version of the mapping set",
verbose_name="Version",
),
),
(
"focal_framework",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="focal_framework",
to="core.framework",
verbose_name="Focal framework",
),
),
(
"folder",
models.ForeignKey(
default=iam.models.Folder.get_root_folder,
on_delete=django.db.models.deletion.CASCADE,
related_name="%(class)s_folder",
to="iam.folder",
),
),
(
"library",
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="requirement_mapping_sets",
to="core.loadedlibrary",
),
),
(
"reference_framework",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="reference_framework",
to="core.framework",
verbose_name="Reference framework",
),
),
],
options={
"abstract": False,
},
),
migrations.CreateModel(
name="RequirementMapping",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"relationship",
models.CharField(
choices=[
("subset", "Subset"),
("intersect", "Intersect"),
("equal", "Equal"),
("superset", "Superset"),
("not_related", "Not related"),
],
default="not_related",
max_length=20,
verbose_name="Relationship",
),
),
(
"rationale",
models.CharField(
blank=True,
choices=[
("syntactic", "Syntactic"),
("semantic", "Semantic"),
("functional", "Functional"),
],
max_length=20,
null=True,
verbose_name="Rationale",
),
),
(
"strength_of_relationship",
models.PositiveSmallIntegerField(
null=True,
validators=[django.core.validators.MaxValueValidator(10)],
verbose_name="Strength of relationship",
),
),
(
"annotation",
models.TextField(blank=True, null=True, verbose_name="Annotation"),
),
(
"focal_requirement",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="focal_requirement",
to="core.requirementnode",
verbose_name="Focal requirement",
),
),
(
"reference_requirement",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="reference_requirement",
to="core.requirementnode",
verbose_name="Reference requirement",
),
),
(
"mapping_set",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="mappings",
to="core.requirementmappingset",
verbose_name="Mapping set",
),
),
],
),
]
12 changes: 12 additions & 0 deletions backend/core/migrations/0017_merge_20240707_1307.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Generated by Django 5.0.4 on 2024-07-07 13:07

from django.db import migrations


class Migration(migrations.Migration):
dependencies = [
("core", "0016_requirementassessment_mapping_inference_and_more"),
("core", "0016_riskscenario_owner"),
]

operations = []
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Generated by Django 5.0.4 on 2024-07-07 13:07

from django.db import migrations


class Migration(migrations.Migration):
dependencies = [
("core", "0017_merge_20240707_1307"),
]

operations = [
migrations.RemoveField(
model_name="requirementmappingset",
name="version",
),
]
Loading

0 comments on commit 2201ffb

Please sign in to comment.