From e630e64b5b5d372dadb363074f9547186daeaf11 Mon Sep 17 00:00:00 2001 From: Nassim Tabchiche Date: Fri, 11 Oct 2024 14:32:10 +0200 Subject: [PATCH 01/19] Write backend migrations check workflow --- .../workflows/backend-migrations-check.yaml | 119 ++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 .github/workflows/backend-migrations-check.yaml diff --git a/.github/workflows/backend-migrations-check.yaml b/.github/workflows/backend-migrations-check.yaml new file mode 100644 index 000000000..75064251d --- /dev/null +++ b/.github/workflows/backend-migrations-check.yaml @@ -0,0 +1,119 @@ +name: Backend migrations check + +on: + pull_request: + branches: [main, develop] + types: [opened, synchronize] + workflow_dispatch: + +env: + GITHUB_WORKFLOW: github_actions + backend-directory: ./backend + enterprise-backend-directory: ./enterprise/backend + enterprise-backend-settings-module: enterprise_core.settings + +jobs: + migrations-check: + runs-on: ubuntu-20.04 + + strategy: + max-parallel: 4 + matrix: + python-version: ["3.11"] + + steps: + - uses: actions/checkout@v4 + - name: Set up python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + cache: "pip" + - uses: actions/setup-node@v4 + with: + node-version: latest + - name: Install requirements + working-directory: ${{ env.backend-directory }} + run: | + python -m pip install --upgrade pip + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Create backend environment variables file + working-directory: ${{ env.backend-directory }} + run: | + touch .env + echo DJANGO_DEBUG=True >> .env + echo DJANGO_SUPERUSER_EMAIL=admin@tests.com >> .env + echo DJANGO_SUPERUSER_PASSWORD=1234 >> .env + echo DB_HOST=localhost >> .env + echo CISO_ASSISTANT_SUPERUSER_EMAIL='' >> .env + echo CISO_ASSISTANT_URL=http://localhost:4173 >> .env + echo DEFAULT_FROM_EMAIL='ciso-assistant@tests.net' >> .env + echo EMAIL_HOST=localhost >> .env + echo EMAIL_HOST_USER=user@tests.com >> .env + echo EMAIL_HOST_PASSWORD=password >> .env + echo EMAIL_PORT=1025 >> .env + - name: Check that migrations were made + working-directory: ${{ env.backend-directory }} + run: | + export $(grep -v '^#' .env | xargs) + python manage.py makemigrations --check + - name: Check that all migrations were applied + working-directory: ${{ env.backend-directory }} + run: | + export $(grep -v '^#' .env | xargs) + python manage.py migrate --check + + enterprise-migrations-check: + runs-on: ubuntu-20.04 + + strategy: + max-parallel: 4 + matrix: + python-version: ["3.11"] + + steps: + - uses: actions/checkout@v4 + - name: Set up python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: "pip" + - name: Install Poetry + uses: snok/install-poetry@v1 + with: + virtualenvs-create: false + installer-parallel: true + - name: Install backend requirements + working-directory: ${{ env.backend-directory }} + run: poetry install + - name: Install enterprise backend + working-directory: ${{ env.enterprise-backend-directory }} + run: poetry install + - name: Create backend environment variables file + working-directory: ${{ env.backend-directory }} + run: | + touch .env + echo DJANGO_DEBUG=True >> .env + echo DJANGO_SUPERUSER_EMAIL=admin@tests.com >> .env + echo DJANGO_SUPERUSER_PASSWORD=1234 >> .env + echo DB_HOST=localhost >> .env + echo CISO_ASSISTANT_SUPERUSER_EMAIL='' >> .env + echo CISO_ASSISTANT_URL=http://localhost:4173 >> .env + echo DEFAULT_FROM_EMAIL='ciso-assistant@tests.net' >> .env + echo EMAIL_HOST=localhost >> .env + echo EMAIL_HOST_USER=user@tests.com >> .env + echo EMAIL_HOST_PASSWORD=password >> .env + echo EMAIL_PORT=1025 >> .env + echo DJANGO_SETTINGS_MODULE=enterprise_core.settings >> .env + echo LICENSE_SEATS=999 >> .env + - name: Check that migrations were made + working-directory: ${{ env.backend-directory }} + run: | + export $(grep -v '^#' .env | xargs) + poetry run python manage.py makemigrations --check --settings=${{ env.enterprise-backend-settings-module }} + if [ $? -ne 0 ]; then echo "::error Migrations were not made, please run the makemigrations command." && exit 1; fi + - name: Check that all migrations were applied + working-directory: ${{ env.backend-directory }} + run: | + export $(grep -v '^#' .env | xargs) + poetry run python manage.py migrate --check --settings=${{ env.enterprise-backend-settings-module }} + if [ $? -ne 0 ]; then echo "::error Migrations were not applied, please run the migrate command." && exit 1; fi From ef5193ee42744b3648c225c58ff0656a78040524 Mon Sep 17 00:00:00 2001 From: Nassim Tabchiche Date: Fri, 11 Oct 2024 14:44:43 +0200 Subject: [PATCH 02/19] Add --dry-run and --verbosity options to makemigrations Add --plan option to migrate s --- .github/workflows/backend-migrations-check.yaml | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/.github/workflows/backend-migrations-check.yaml b/.github/workflows/backend-migrations-check.yaml index 75064251d..6ed82954e 100644 --- a/.github/workflows/backend-migrations-check.yaml +++ b/.github/workflows/backend-migrations-check.yaml @@ -55,12 +55,7 @@ jobs: working-directory: ${{ env.backend-directory }} run: | export $(grep -v '^#' .env | xargs) - python manage.py makemigrations --check - - name: Check that all migrations were applied - working-directory: ${{ env.backend-directory }} - run: | - export $(grep -v '^#' .env | xargs) - python manage.py migrate --check + python manage.py makemigrations --check --dry-run --verbosity=3 enterprise-migrations-check: runs-on: ubuntu-20.04 @@ -109,11 +104,5 @@ jobs: working-directory: ${{ env.backend-directory }} run: | export $(grep -v '^#' .env | xargs) - poetry run python manage.py makemigrations --check --settings=${{ env.enterprise-backend-settings-module }} + poetry run python manage.py makemigrations --check --dry-run --verbosity=3 --settings=${{ env.enterprise-backend-settings-module }} if [ $? -ne 0 ]; then echo "::error Migrations were not made, please run the makemigrations command." && exit 1; fi - - name: Check that all migrations were applied - working-directory: ${{ env.backend-directory }} - run: | - export $(grep -v '^#' .env | xargs) - poetry run python manage.py migrate --check --settings=${{ env.enterprise-backend-settings-module }} - if [ $? -ne 0 ]; then echo "::error Migrations were not applied, please run the migrate command." && exit 1; fi From 9abd3b07a2f54eacde53fea1e7d866379495b3e8 Mon Sep 17 00:00:00 2001 From: Nassim Tabchiche Date: Mon, 14 Oct 2024 12:17:33 +0200 Subject: [PATCH 03/19] chore: Make migrations --- .../0002_alter_clientsettings_folder.py | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 enterprise/backend/enterprise_core/migrations/0002_alter_clientsettings_folder.py diff --git a/enterprise/backend/enterprise_core/migrations/0002_alter_clientsettings_folder.py b/enterprise/backend/enterprise_core/migrations/0002_alter_clientsettings_folder.py new file mode 100644 index 000000000..5c620a437 --- /dev/null +++ b/enterprise/backend/enterprise_core/migrations/0002_alter_clientsettings_folder.py @@ -0,0 +1,21 @@ +# Generated by Django 5.1 on 2024-10-14 08:48 + +import django.db.models.deletion +import iam.models +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('enterprise_core', '0001_initial'), + ('iam', '0008_user_is_third_party'), + ] + + operations = [ + migrations.AlterField( + model_name='clientsettings', + name='folder', + field=models.ForeignKey(default=iam.models.Folder.get_root_folder_id, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_folder', to='iam.folder'), + ), + ] From c8fee78f816b5f007c677aca54b0b61ac713c7e2 Mon Sep 17 00:00:00 2001 From: Nassim Tabchiche Date: Mon, 14 Oct 2024 16:12:27 +0200 Subject: [PATCH 04/19] Write Entity.get_main_entity class method --- backend/tprm/models.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/backend/tprm/models.py b/backend/tprm/models.py index 9a5063f65..53458d741 100644 --- a/backend/tprm/models.py +++ b/backend/tprm/models.py @@ -2,7 +2,7 @@ from django.utils.translation import gettext_lazy as _ from core.base_models import NameDescriptionMixin, AbstractBaseModel from core.models import Assessment, ComplianceAssessment, Evidence -from iam.models import FolderMixin, PublishInRootFolderMixin +from iam.models import Folder, FolderMixin, PublishInRootFolderMixin from iam.views import User @@ -27,6 +27,15 @@ class Meta: verbose_name = _("Entity") verbose_name_plural = _("Entities") + @classmethod + def get_main_entity(cls): + return ( + cls.objects.filter(builtin=True) + .filter(owned_folders=Folder.get_root_folder()) + .order_by("created_at") + .first() + ) + class EntityAssessment(Assessment): class Conclusion(models.TextChoices): From 397d1214ab7cfe924d0982523706d5e6a61f23a4 Mon Sep 17 00:00:00 2001 From: Nassim Tabchiche Date: Mon, 14 Oct 2024 16:26:03 +0200 Subject: [PATCH 05/19] Synchronize main entity name with that specified in client settings --- enterprise/backend/enterprise_core/views.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/enterprise/backend/enterprise_core/views.py b/enterprise/backend/enterprise_core/views.py index 97e5043e7..18323d756 100644 --- a/enterprise/backend/enterprise_core/views.py +++ b/enterprise/backend/enterprise_core/views.py @@ -15,6 +15,7 @@ from core.views import BaseModelViewSet from iam.models import User +from tprm.models import Entity from .models import ClientSettings from .serializers import ClientSettingsReadSerializer @@ -39,6 +40,19 @@ def delete(self, request, *args, **kwargs): status=status.HTTP_405_METHOD_NOT_ALLOWED, ) + def perform_update(self, serializer): + instance = serializer.save() + if instance.name: + main_entity = Entity.get_main_entity() + logger.info( + "Updating main entity name", entity=main_entity, name=instance.name + ) + main_entity.name = instance.name + main_entity.save() + logger.info( + "Main entity name updated", entity=main_entity, name=instance.name + ) + @action(methods=["get"], detail=False, permission_classes=[AllowAny]) def info(self, request): try: From 875820d6e25929fb737f96295f289a395dbd3396 Mon Sep 17 00:00:00 2001 From: Nassim Tabchiche Date: Mon, 14 Oct 2024 16:31:35 +0200 Subject: [PATCH 06/19] Use Entity.get_main_entity for main entity retrieval instead of name field --- backend/core/startup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/core/startup.py b/backend/core/startup.py index e87468a4c..cf972cdea 100644 --- a/backend/core/startup.py +++ b/backend/core/startup.py @@ -367,7 +367,7 @@ def startup(sender: AppConfig, **kwargs): name="Global", content_type=Folder.ContentType.ROOT, builtin=True ) # if main entity does not exist, then create it - if not Entity.objects.filter(name="Main").exists(): + if not Entity.get_main_entity(): main = Entity.objects.create( name="Main", folder=Folder.get_root_folder(), builtin=True ) From e2112a0f26eb45096aa3daa0fc53d880da503e8a Mon Sep 17 00:00:00 2001 From: Nassim Tabchiche Date: Mon, 14 Oct 2024 16:39:19 +0200 Subject: [PATCH 07/19] Create MAIN_ENTITY_DEFAULT_NAME constant --- backend/core/utils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/core/utils.py b/backend/core/utils.py index 8caa3cd3a..45ae6b5f5 100644 --- a/backend/core/utils.py +++ b/backend/core/utils.py @@ -65,6 +65,10 @@ def __str__(self) -> str: str(UserGroupCodename.THIRD_PARTY_RESPONDENT): _("Third-party respondent"), } +# NOTE: This is set to "Main" now, but will be changed to a unique identifier +# for internationalization. +MAIN_ENTITY_DEFAULT_NAME = "Main" + COUNTRY_FLAGS = { "fr": "🇫🇷", "en": "🇬🇧", From 2f1052abbcd85bfbddb3b1499836d4e17be447f6 Mon Sep 17 00:00:00 2001 From: Nassim Tabchiche Date: Mon, 14 Oct 2024 16:52:26 +0200 Subject: [PATCH 08/19] Reset main entity name to default when client settings name is cleared --- enterprise/backend/enterprise_core/views.py | 29 +++++++++++++++------ 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/enterprise/backend/enterprise_core/views.py b/enterprise/backend/enterprise_core/views.py index 18323d756..88623fcce 100644 --- a/enterprise/backend/enterprise_core/views.py +++ b/enterprise/backend/enterprise_core/views.py @@ -14,6 +14,7 @@ from django.conf import settings from core.views import BaseModelViewSet +from core.utils import MAIN_ENTITY_DEFAULT_NAME from iam.models import User from tprm.models import Entity @@ -42,16 +43,28 @@ def delete(self, request, *args, **kwargs): def perform_update(self, serializer): instance = serializer.save() + self._update_main_entity_name(instance) + + def _update_main_entity_name(self, instance): + main_entity = Entity.get_main_entity() + if instance.name: - main_entity = Entity.get_main_entity() - logger.info( - "Updating main entity name", entity=main_entity, name=instance.name - ) - main_entity.name = instance.name + self._set_main_entity_name(main_entity, instance.name) + elif main_entity.name != MAIN_ENTITY_DEFAULT_NAME: + self._set_main_entity_name(main_entity, MAIN_ENTITY_DEFAULT_NAME) + + def _set_main_entity_name(self, main_entity, new_name): + if main_entity.name == new_name: + return + + logger.info("Updating main entity name", entity=main_entity, name=new_name) + try: + main_entity.name = new_name main_entity.save() - logger.info( - "Main entity name updated", entity=main_entity, name=instance.name - ) + logger.info("Main entity name updated", entity=main_entity, name=new_name) + except Exception as e: + logger.error("An error occurred while renaming main entity", exc_info=e) + raise @action(methods=["get"], detail=False, permission_classes=[AllowAny]) def info(self, request): From 4e9cc1c0750db01c8a561ffd029f617a7e8e5bdf Mon Sep 17 00:00:00 2001 From: melinoix Date: Tue, 15 Oct 2024 17:08:50 +0200 Subject: [PATCH 09/19] Added a next link when editing audit in analytics to go back to analytics --- frontend/src/routes/(app)/(internal)/analytics/+page.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/routes/(app)/(internal)/analytics/+page.svelte b/frontend/src/routes/(app)/(internal)/analytics/+page.svelte index f35dd40e3..3fce4328a 100644 --- a/frontend/src/routes/(app)/(internal)/analytics/+page.svelte +++ b/frontend/src/routes/(app)/(internal)/analytics/+page.svelte @@ -532,7 +532,7 @@
{m.edit()} From e027a3f1ea8659142c58b6a8eaf553367ea4833e Mon Sep 17 00:00:00 2001 From: melinoix Date: Wed, 16 Oct 2024 10:08:55 +0200 Subject: [PATCH 10/19] Added filter on provider for reference controls tab --- frontend/src/lib/utils/table.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/src/lib/utils/table.ts b/frontend/src/lib/utils/table.ts index 2e5994eb2..b7babc031 100644 --- a/frontend/src/lib/utils/table.ts +++ b/frontend/src/lib/utils/table.ts @@ -361,6 +361,7 @@ export const listViewFields: ListViewFieldsConfig = { filters: { folder: { ...DOMAIN_FILTER, alwaysDisplay: true }, category: CATEGORY_FILTER, + provider: PROVIDER_FILTER, csf_function: CSF_FUNCTION_FILTER } }, From a2d4ee140742065e34b5a00c58177405f092edce Mon Sep 17 00:00:00 2001 From: Mohamed-Hacene Date: Wed, 16 Oct 2024 10:31:24 +0200 Subject: [PATCH 11/19] fix: check question and questions before displaying length --- .../compliance-assessments/[id=uuid]/TreeViewItemContent.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/routes/(app)/(third-party)/compliance-assessments/[id=uuid]/TreeViewItemContent.svelte b/frontend/src/routes/(app)/(third-party)/compliance-assessments/[id=uuid]/TreeViewItemContent.svelte index b11818e9b..7f78e78be 100644 --- a/frontend/src/routes/(app)/(third-party)/compliance-assessments/[id=uuid]/TreeViewItemContent.svelte +++ b/frontend/src/routes/(app)/(third-party)/compliance-assessments/[id=uuid]/TreeViewItemContent.svelte @@ -155,7 +155,7 @@ {/if} {/each} {/if} - {#if node.question.questions} + {#if node.question && node.question.questions} {node.question.questions.length} {m.questionOrQuestions()} From 4173fab500a77a35198f679179dee88196e095c9 Mon Sep 17 00:00:00 2001 From: monsieurswag Date: Wed, 16 Oct 2024 11:30:07 +0200 Subject: [PATCH 12/19] Use caret for questionnaire that is aligned with our conventions --- .../compliance-assessments/[id=uuid]/table-mode/+page.svelte | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/routes/(app)/(third-party)/compliance-assessments/[id=uuid]/table-mode/+page.svelte b/frontend/src/routes/(app)/(third-party)/compliance-assessments/[id=uuid]/table-mode/+page.svelte index 27d66bf9f..8c5756e69 100644 --- a/frontend/src/routes/(app)/(third-party)/compliance-assessments/[id=uuid]/table-mode/+page.svelte +++ b/frontend/src/routes/(app)/(third-party)/compliance-assessments/[id=uuid]/table-mode/+page.svelte @@ -299,7 +299,7 @@ {/if}
- +

{m.observation()}

@@ -348,7 +348,7 @@
- +

{m.evidence()} From 10d8d3bdfb564419983fea4ec82d8638ef56b806 Mon Sep 17 00:00:00 2001 From: melinoix Date: Wed, 16 Oct 2024 11:47:34 +0200 Subject: [PATCH 13/19] Error not displayed in nested list forms --- .../lib/components/DetailView/DetailView.svelte | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/frontend/src/lib/components/DetailView/DetailView.svelte b/frontend/src/lib/components/DetailView/DetailView.svelte index 97ff2440d..bfa5101e4 100644 --- a/frontend/src/lib/components/DetailView/DetailView.svelte +++ b/frontend/src/lib/components/DetailView/DetailView.svelte @@ -150,20 +150,6 @@ modalStore.trigger(modal); } - function getForms(model: Record) { - let { form: createForm, message: createMessage } = superForm(model.createForm, { - onUpdated: ({ form }) => - handleFormUpdated({ form, pageStatus: $page.status, closeModal: true }) - }); - let { form: deleteForm, message: deleteMessage } = superForm(model.deleteForm, { - onUpdated: ({ form }) => - handleFormUpdated({ form, pageStatus: $page.status, closeModal: true }) - }); - return { createForm, createMessage, deleteForm, deleteMessage }; - } - - let forms: Record = {}; - const user = $page.data.user; const canEditObject: boolean = Object.hasOwn(user.permissions, `change_${data.model.name}`); @@ -175,9 +161,6 @@ !data.data.builtin ); }; - $: Object.entries(data.relatedModels).forEach(([key, value]) => { - forms[key] = getForms(value); - });

From 170597effe8c8cc9d5232066ef8ea51d30e4d82d Mon Sep 17 00:00:00 2001 From: melinoix Date: Wed, 16 Oct 2024 14:20:19 +0200 Subject: [PATCH 14/19] modified enterprise read me & added db directory --- enterprise/README.md | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/enterprise/README.md b/enterprise/README.md index f6a0e8449..7c37a2b3b 100644 --- a/enterprise/README.md +++ b/enterprise/README.md @@ -33,7 +33,7 @@ cd ../backend poetry shell ``` -3. Install enterprise backend module +3. Install enterprise backend module. ```sh cd ../enterprise/backend @@ -46,7 +46,19 @@ poetry install export SQLITE_FILE=db/ciso-assistant-enterprise.sqlite3 ``` -5. Run the development server +5. Apply migrations. + +```sh +poetry run ./manage.sh migrate +``` + +6. Create a Django superuser, that will be CISO Assistant administrator. + +```sh +poetry run ./manage.sh createsuperuser +``` + +7. Run the development server. ```sh poetry run ./manage.sh runserver @@ -54,13 +66,13 @@ poetry run ./manage.sh runserver ### Running the frontend -1. cd into the enteprise frontend directory +1. cd into the enteprise frontend directory. ```bash cd enterprise/frontend ``` -3. Start a development server (make sure that the django app is running) +3. Start a development server (make sure that the django app is running). ```bash make dev From 61ff341c055ca85aa5addbf27aa01e0d89191c88 Mon Sep 17 00:00:00 2001 From: melinoix Date: Wed, 16 Oct 2024 14:32:52 +0200 Subject: [PATCH 15/19] added db directory --- .gitignore | 2 +- enterprise/backend/db/.gitignore | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 enterprise/backend/db/.gitignore diff --git a/.gitignore b/.gitignore index a15001df7..cf7bd9106 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,7 @@ *.sqlite3 django_secret_key temp/ -db/ +./db/ .dccache /backend/profiles ./backend/ciso_assistant/.meta diff --git a/enterprise/backend/db/.gitignore b/enterprise/backend/db/.gitignore new file mode 100644 index 000000000..d6b7ef32c --- /dev/null +++ b/enterprise/backend/db/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore From df02168e70dfb897f13ae7054abc576e1a19f50a Mon Sep 17 00:00:00 2001 From: Axxiar Date: Wed, 16 Oct 2024 16:09:51 +0200 Subject: [PATCH 16/19] chore: improve question layout for Firefox --- frontend/src/lib/components/Forms/Question.svelte | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/src/lib/components/Forms/Question.svelte b/frontend/src/lib/components/Forms/Question.svelte index 9acccb13e..ce4efadbe 100644 --- a/frontend/src/lib/components/Forms/Question.svelte +++ b/frontend/src/lib/components/Forms/Question.svelte @@ -42,6 +42,7 @@ {#each question.options as option} Date: Wed, 16 Oct 2024 16:35:03 +0200 Subject: [PATCH 17/19] Remove redundant migration --- .../0002_alter_clientsettings_folder.py | 21 ------------------- 1 file changed, 21 deletions(-) delete mode 100644 enterprise/backend/enterprise_core/migrations/0002_alter_clientsettings_folder.py diff --git a/enterprise/backend/enterprise_core/migrations/0002_alter_clientsettings_folder.py b/enterprise/backend/enterprise_core/migrations/0002_alter_clientsettings_folder.py deleted file mode 100644 index 5c620a437..000000000 --- a/enterprise/backend/enterprise_core/migrations/0002_alter_clientsettings_folder.py +++ /dev/null @@ -1,21 +0,0 @@ -# Generated by Django 5.1 on 2024-10-14 08:48 - -import django.db.models.deletion -import iam.models -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('enterprise_core', '0001_initial'), - ('iam', '0008_user_is_third_party'), - ] - - operations = [ - migrations.AlterField( - model_name='clientsettings', - name='folder', - field=models.ForeignKey(default=iam.models.Folder.get_root_folder_id, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_folder', to='iam.folder'), - ), - ] From b2337772ad20e304b8e997be2b3e6747b18319fc Mon Sep 17 00:00:00 2001 From: Nassim Tabchiche Date: Thu, 17 Oct 2024 12:07:59 +0200 Subject: [PATCH 18/19] Display folder field in evidence when creating from it from an applied control As an applied control may be global, inheriting its domain may cause errors if the user attempting to create an evidence inside it may not have the permission to create an evidence in the global domain. --- .../src/lib/components/Forms/ModelForm/EvidenceForm.svelte | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frontend/src/lib/components/Forms/ModelForm/EvidenceForm.svelte b/frontend/src/lib/components/Forms/ModelForm/EvidenceForm.svelte index cf42cab3e..6d50f2d6c 100644 --- a/frontend/src/lib/components/Forms/ModelForm/EvidenceForm.svelte +++ b/frontend/src/lib/components/Forms/ModelForm/EvidenceForm.svelte @@ -27,7 +27,7 @@ field="attachment" label={m.attachment()} /> -{#if !(initialData.applied_controls || initialData.requirement_assessments)} +{#if !initialData.requirement_assessments}