From cdcd90bb89706776399384e6430b2e5f7bc89a73 Mon Sep 17 00:00:00 2001 From: matthewswspence Date: Fri, 9 Aug 2024 14:37:49 -0500 Subject: [PATCH 01/19] add dnssec summary item to overview page --- src/registrar/templates/domain_detail.html | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/registrar/templates/domain_detail.html b/src/registrar/templates/domain_detail.html index 0b6f47481..ad187aa4e 100644 --- a/src/registrar/templates/domain_detail.html +++ b/src/registrar/templates/domain_detail.html @@ -64,6 +64,13 @@ {% endif %} {% endif %} + {% url 'domain-dns-dnssec' pk=domain.id as url %} + {% if domain.dnssecdata is not None %} + {% include "includes/summary_item.html" with title='DNSSEC' value='Enabled' edit_link=url editable=is_editable %} + {% else %} + {% include "includes/summary_item.html" with title='DNSSEC' value='Disabled' edit_link=url editable=is_editable %} + {% endif %} + {% if portfolio %} {% comment %} TODO - uncomment in #2352 and add to edit_link {% url 'domain-suborganization' pk=domain.id as url %} From 38e1c79e751d0d8266c3531b41383d8fce6379d0 Mon Sep 17 00:00:00 2001 From: matthewswspence Date: Fri, 9 Aug 2024 15:10:47 -0500 Subject: [PATCH 02/19] Additional required changes --- src/registrar/templates/domain_base.html | 2 +- src/registrar/templates/domain_detail.html | 8 ++++---- src/registrar/templates/includes/summary_item.html | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/registrar/templates/domain_base.html b/src/registrar/templates/domain_base.html index 9a869ef42..b99b12740 100644 --- a/src/registrar/templates/domain_base.html +++ b/src/registrar/templates/domain_base.html @@ -54,7 +54,7 @@ {% block domain_content %} -

{{ domain.name }}

+

Domain Overview

{% endblock %} {# domain_content #} {% endif %} diff --git a/src/registrar/templates/domain_detail.html b/src/registrar/templates/domain_detail.html index ad187aa4e..312c35f40 100644 --- a/src/registrar/templates/domain_detail.html +++ b/src/registrar/templates/domain_detail.html @@ -4,7 +4,7 @@ {% block domain_content %} {{ block.super }}
- +

{{ domain.name }}

DNS name servers +

DNS name servers

No DNS name servers have been added yet. Before your domain can be used we’ll need information about your domain name servers.

Add DNS name servers {% else %} {% include "includes/summary_item.html" with title='DNS name servers' domains='true' value='' edit_link=url editable=is_editable %} {% endif %} {% endif %} - + {% url 'domain-dns-dnssec' pk=domain.id as url %} {% if domain.dnssecdata is not None %} {% include "includes/summary_item.html" with title='DNSSEC' value='Enabled' edit_link=url editable=is_editable %} {% else %} - {% include "includes/summary_item.html" with title='DNSSEC' value='Disabled' edit_link=url editable=is_editable %} + {% include "includes/summary_item.html" with title='DNSSEC' value='Not Enabled' edit_link=url editable=is_editable %} {% endif %} {% if portfolio %} diff --git a/src/registrar/templates/includes/summary_item.html b/src/registrar/templates/includes/summary_item.html index 6ec69b770..ff42c2eaf 100644 --- a/src/registrar/templates/includes/summary_item.html +++ b/src/registrar/templates/includes/summary_item.html @@ -7,7 +7,7 @@ {% if heading_level %} <{{ heading_level }} {% else %} -

{{ sub_header_text }}

From 5e7a7d94d59831bfbeecc5dd00271cccc65183b3 Mon Sep 17 00:00:00 2001 From: matthewswspence Date: Fri, 9 Aug 2024 15:20:32 -0500 Subject: [PATCH 03/19] change subheader text to h4 --- src/registrar/templates/includes/summary_item.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/registrar/templates/includes/summary_item.html b/src/registrar/templates/includes/summary_item.html index ff42c2eaf..f69bbaf96 100644 --- a/src/registrar/templates/includes/summary_item.html +++ b/src/registrar/templates/includes/summary_item.html @@ -22,7 +22,7 @@ {% endif %} {% if sub_header_text %} -

{{ sub_header_text }}

+

{{ sub_header_text }}

{% endif %} {% if address %} {% include "includes/organization_address.html" with organization=value %} From de50972ff1e29c835ee81cfe3f93100a5edd7baa Mon Sep 17 00:00:00 2001 From: Cameron Dixon Date: Mon, 12 Aug 2024 11:40:31 -0400 Subject: [PATCH 04/19] Update domain_invitation.txt --- src/registrar/templates/emails/domain_invitation.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/registrar/templates/emails/domain_invitation.txt b/src/registrar/templates/emails/domain_invitation.txt index e426ae6ef..068040205 100644 --- a/src/registrar/templates/emails/domain_invitation.txt +++ b/src/registrar/templates/emails/domain_invitation.txt @@ -38,5 +38,5 @@ The .gov team Contact us: Learn about .gov -The .gov registry is a part of the Cybersecurity and Infrastructure Security Agency (CISA) +The .gov registry is a part of the Cybersecurity and Infrastructure Security Agency (CISA) {% endautoescape %} From d24c7f64604c03493aa76204da11de743efdf4f2 Mon Sep 17 00:00:00 2001 From: Cameron Dixon Date: Mon, 12 Aug 2024 11:42:11 -0400 Subject: [PATCH 05/19] Update transition_domain_invitation.txt --- src/registrar/templates/emails/transition_domain_invitation.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/registrar/templates/emails/transition_domain_invitation.txt b/src/registrar/templates/emails/transition_domain_invitation.txt index bdce7d107..b6773d9e9 100644 --- a/src/registrar/templates/emails/transition_domain_invitation.txt +++ b/src/registrar/templates/emails/transition_domain_invitation.txt @@ -60,5 +60,5 @@ The .gov team Domain management Get.gov -The .gov registry is a part of the Cybersecurity and Infrastructure Security Agency (CISA) +The .gov registry is a part of the Cybersecurity and Infrastructure Security Agency (CISA) {% endautoescape %} From 5cd0900fe1e2dea415bb79b0e340c14270351706 Mon Sep 17 00:00:00 2001 From: Cameron Dixon Date: Mon, 12 Aug 2024 11:42:32 -0400 Subject: [PATCH 06/19] Update questionable_senior_official.txt --- .../action_needed_reasons/questionable_senior_official.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/registrar/templates/emails/action_needed_reasons/questionable_senior_official.txt b/src/registrar/templates/emails/action_needed_reasons/questionable_senior_official.txt index 94e15b78c..e20e4cb60 100644 --- a/src/registrar/templates/emails/action_needed_reasons/questionable_senior_official.txt +++ b/src/registrar/templates/emails/action_needed_reasons/questionable_senior_official.txt @@ -32,5 +32,5 @@ The .gov team Contact us: Learn about .gov -The .gov registry is a part of the Cybersecurity and Infrastructure Security Agency (CISA) -{% endautoescape %} \ No newline at end of file +The .gov registry is a part of the Cybersecurity and Infrastructure Security Agency (CISA) +{% endautoescape %} From 411b1b655739d1226d78278fc49b5dc717e366e4 Mon Sep 17 00:00:00 2001 From: Cameron Dixon Date: Mon, 12 Aug 2024 11:44:58 -0400 Subject: [PATCH 07/19] Update status_change_rejected.txt --- src/registrar/templates/emails/status_change_rejected.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/registrar/templates/emails/status_change_rejected.txt b/src/registrar/templates/emails/status_change_rejected.txt index 12693deb9..2fcbb1d83 100644 --- a/src/registrar/templates/emails/status_change_rejected.txt +++ b/src/registrar/templates/emails/status_change_rejected.txt @@ -77,5 +77,5 @@ The .gov team Contact us: Learn about .gov -The .gov registry is a part of the Cybersecurity and Infrastructure Security Agency (CISA) +The .gov registry is a part of the Cybersecurity and Infrastructure Security Agency (CISA) {% endautoescape %} From 5ce926f84badebeb3af5efe562ee42a215b1ec2c Mon Sep 17 00:00:00 2001 From: Cameron Dixon Date: Mon, 12 Aug 2024 11:45:56 -0400 Subject: [PATCH 08/19] Update eligibility_unclear.txt --- .../emails/action_needed_reasons/eligibility_unclear.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/registrar/templates/emails/action_needed_reasons/eligibility_unclear.txt b/src/registrar/templates/emails/action_needed_reasons/eligibility_unclear.txt index 280321045..d3a986183 100644 --- a/src/registrar/templates/emails/action_needed_reasons/eligibility_unclear.txt +++ b/src/registrar/templates/emails/action_needed_reasons/eligibility_unclear.txt @@ -31,5 +31,5 @@ The .gov team Contact us: Learn about .gov -The .gov registry is a part of the Cybersecurity and Infrastructure Security Agency (CISA) -{% endautoescape %} \ No newline at end of file +The .gov registry is a part of the Cybersecurity and Infrastructure Security Agency (CISA) +{% endautoescape %} From 77499cdc384fe6cc3292ec901e6aa798da5f577d Mon Sep 17 00:00:00 2001 From: Cameron Dixon Date: Mon, 12 Aug 2024 11:47:53 -0400 Subject: [PATCH 09/19] Update already_has_domains.txt --- .../emails/action_needed_reasons/already_has_domains.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/registrar/templates/emails/action_needed_reasons/already_has_domains.txt b/src/registrar/templates/emails/action_needed_reasons/already_has_domains.txt index 264fe265b..b1b3b0a1c 100644 --- a/src/registrar/templates/emails/action_needed_reasons/already_has_domains.txt +++ b/src/registrar/templates/emails/action_needed_reasons/already_has_domains.txt @@ -47,5 +47,5 @@ The .gov team Contact us: Learn about .gov -The .gov registry is a part of the Cybersecurity and Infrastructure Security Agency (CISA) -{% endautoescape %} \ No newline at end of file +The .gov registry is a part of the Cybersecurity and Infrastructure Security Agency (CISA) +{% endautoescape %} From f8c20946d0b5b6f86da5db1e16f3f22754f99eab Mon Sep 17 00:00:00 2001 From: Cameron Dixon Date: Mon, 12 Aug 2024 11:48:41 -0400 Subject: [PATCH 10/19] Update submission_confirmation.txt --- src/registrar/templates/emails/submission_confirmation.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/registrar/templates/emails/submission_confirmation.txt b/src/registrar/templates/emails/submission_confirmation.txt index 2dd4387a4..740e6f393 100644 --- a/src/registrar/templates/emails/submission_confirmation.txt +++ b/src/registrar/templates/emails/submission_confirmation.txt @@ -38,5 +38,5 @@ The .gov team Contact us: Learn about .gov -The .gov registry is a part of the Cybersecurity and Infrastructure Security Agency (CISA) +The .gov registry is a part of the Cybersecurity and Infrastructure Security Agency (CISA) {% endautoescape %} From c1c89f1c57b37b28982073c0361318f3b79d9881 Mon Sep 17 00:00:00 2001 From: Cameron Dixon Date: Mon, 12 Aug 2024 11:49:03 -0400 Subject: [PATCH 11/19] Update bad_name.txt --- .../templates/emails/action_needed_reasons/bad_name.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/registrar/templates/emails/action_needed_reasons/bad_name.txt b/src/registrar/templates/emails/action_needed_reasons/bad_name.txt index 95967639c..7d088aa4e 100644 --- a/src/registrar/templates/emails/action_needed_reasons/bad_name.txt +++ b/src/registrar/templates/emails/action_needed_reasons/bad_name.txt @@ -30,5 +30,5 @@ The .gov team Contact us: Learn about .gov -The .gov registry is a part of the Cybersecurity and Infrastructure Security Agency (CISA) -{% endautoescape %} \ No newline at end of file +The .gov registry is a part of the Cybersecurity and Infrastructure Security Agency (CISA) +{% endautoescape %} From 6c73175c802e382b63f71ac5af1ee761b06390a4 Mon Sep 17 00:00:00 2001 From: Cameron Dixon Date: Mon, 12 Aug 2024 11:49:22 -0400 Subject: [PATCH 12/19] Update status_change_approved.txt --- src/registrar/templates/emails/status_change_approved.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/registrar/templates/emails/status_change_approved.txt b/src/registrar/templates/emails/status_change_approved.txt index bbef8c81a..70f813599 100644 --- a/src/registrar/templates/emails/status_change_approved.txt +++ b/src/registrar/templates/emails/status_change_approved.txt @@ -49,5 +49,5 @@ The .gov team Contact us: Learn about .gov -The .gov registry is a part of the Cybersecurity and Infrastructure Security Agency (CISA) +The .gov registry is a part of the Cybersecurity and Infrastructure Security Agency (CISA) {% endautoescape %} From 7463e356f948fe7aa72813b467224787b408e4f1 Mon Sep 17 00:00:00 2001 From: Cameron Dixon Date: Mon, 12 Aug 2024 11:54:13 -0400 Subject: [PATCH 13/19] Update domain_request_withdrawn.txt --- src/registrar/templates/emails/domain_request_withdrawn.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/registrar/templates/emails/domain_request_withdrawn.txt b/src/registrar/templates/emails/domain_request_withdrawn.txt index 0c061c53c..6efa92d64 100644 --- a/src/registrar/templates/emails/domain_request_withdrawn.txt +++ b/src/registrar/templates/emails/domain_request_withdrawn.txt @@ -26,5 +26,5 @@ The .gov team Contact us: Learn about .gov -The .gov registry is a part of the Cybersecurity and Infrastructure Security Agency (CISA) +The .gov registry is a part of the Cybersecurity and Infrastructure Security Agency (CISA) {% endautoescape %} From bea53019a5f66940e9ccf650bdd55ab85fc2b3f8 Mon Sep 17 00:00:00 2001 From: David Kennedy Date: Mon, 12 Aug 2024 15:28:02 -0400 Subject: [PATCH 14/19] added clean method which performs validation on user model --- src/registrar/models/user.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/registrar/models/user.py b/src/registrar/models/user.py index 0221c2d50..73d5f6a1d 100644 --- a/src/registrar/models/user.py +++ b/src/registrar/models/user.py @@ -3,6 +3,7 @@ import logging from django.contrib.auth.models import AbstractUser from django.db import models from django.db.models import Q +from django.forms import ValidationError from registrar.models.domain_information import DomainInformation from registrar.models.user_domain_role import UserDomainRole @@ -229,6 +230,15 @@ class User(AbstractUser): def has_contact_info(self): return bool(self.title or self.email or self.phone) + def clean(self): + super().clean() + + if self.portfolio is None and self._get_portfolio_permissions(): + raise ValidationError("When portfolio roles or additional permissions are assigned, portfolio is required.") + + if self.portfolio is not None and not self._get_portfolio_permissions(): + raise ValidationError("When portfolio is assigned, portfolio roles or additional permissions are required.") + def _get_portfolio_permissions(self): """ Retrieve the permissions for the user's portfolio roles. From 334b6eac3816c9b2bff0b15029ac3b5d221be065 Mon Sep 17 00:00:00 2001 From: David Kennedy Date: Mon, 12 Aug 2024 15:29:15 -0400 Subject: [PATCH 15/19] commented --- src/registrar/models/user.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/registrar/models/user.py b/src/registrar/models/user.py index 73d5f6a1d..81d3b9b61 100644 --- a/src/registrar/models/user.py +++ b/src/registrar/models/user.py @@ -231,6 +231,7 @@ class User(AbstractUser): return bool(self.title or self.email or self.phone) def clean(self): + """Extends clean method to perform additional validation, which can raise errors in django admin.""" super().clean() if self.portfolio is None and self._get_portfolio_permissions(): From a2a6b9e68f83bd51dc304a417731d30fab4c818e Mon Sep 17 00:00:00 2001 From: David Kennedy Date: Mon, 12 Aug 2024 15:36:14 -0400 Subject: [PATCH 16/19] fix zap for adding suborganization url --- src/zap.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/src/zap.conf b/src/zap.conf index d6d22995c..c97897aeb 100644 --- a/src/zap.conf +++ b/src/zap.conf @@ -71,6 +71,7 @@ 10038 OUTOFSCOPE http://app:8080/domain_requests/ 10038 OUTOFSCOPE http://app:8080/domains/ 10038 OUTOFSCOPE http://app:8080/organization/ +10038 OUTOFSCOPE http://app:8080/suborganization/ # This URL always returns 404, so include it as well. 10038 OUTOFSCOPE http://app:8080/todo # OIDC isn't configured in the test environment and DEBUG=True so this gives a 500 without CSP headers From 77cf108323d4c7848109adad735e277d6758543f Mon Sep 17 00:00:00 2001 From: David Kennedy Date: Mon, 12 Aug 2024 15:46:52 -0400 Subject: [PATCH 17/19] test cases added --- src/registrar/tests/test_models.py | 36 ++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/registrar/tests/test_models.py b/src/registrar/tests/test_models.py index 8c69517e9..cfb66eb2a 100644 --- a/src/registrar/tests/test_models.py +++ b/src/registrar/tests/test_models.py @@ -1,3 +1,4 @@ +from django.forms import ValidationError from django.test import TestCase from django.db.utils import IntegrityError from django.db import transaction @@ -1348,6 +1349,7 @@ class TestUser(TestCase): self.user.phone = None self.assertFalse(self.user.has_contact_info()) + @less_console_noise_decorator def test_has_portfolio_permission(self): """ 0. Returns False when user does not have a permission @@ -1401,6 +1403,40 @@ class TestUser(TestCase): Portfolio.objects.all().delete() + @less_console_noise_decorator + def test_user_with_portfolio_but_no_roles(self): + # Create an instance of User with a portfolio but no roles or additional permissions + portfolio, _ = Portfolio.objects.get_or_create(creator=self.user, organization_name="Hotel California") + + self.user.portfolio = portfolio + self.user.portfolio_roles = [] + + # Test if the ValidationError is raised with the correct message + with self.assertRaises(ValidationError) as cm: + self.user.clean() + + self.assertEqual( + cm.exception.message, "When portfolio is assigned, portfolio roles or additional permissions are required." + ) + self.user.refresh_from_db() + Portfolio.objects.all().delete() + + @less_console_noise_decorator + def test_user_with_portfolio_roles_but_no_portfolio(self): + # Create an instance of User with a portfolio role but no portfolio + self.user.portfolio = None + self.user.portfolio_roles = [UserPortfolioRoleChoices.ORGANIZATION_ADMIN] + + # Test if the ValidationError is raised with the correct message + with self.assertRaises(ValidationError) as cm: + self.user.clean() + + self.assertEqual( + cm.exception.message, "When portfolio roles or additional permissions are assigned, portfolio is required." + ) + self.user.refresh_from_db() + Portfolio.objects.all().delete() + class TestContact(TestCase): @less_console_noise_decorator From 2c50c35ed485952187f389c2464832880a59ccb3 Mon Sep 17 00:00:00 2001 From: David Kennedy Date: Mon, 12 Aug 2024 17:22:33 -0400 Subject: [PATCH 18/19] fixed tests --- src/registrar/tests/test_models.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/registrar/tests/test_models.py b/src/registrar/tests/test_models.py index cfb66eb2a..5167aac99 100644 --- a/src/registrar/tests/test_models.py +++ b/src/registrar/tests/test_models.py @@ -1418,7 +1418,6 @@ class TestUser(TestCase): self.assertEqual( cm.exception.message, "When portfolio is assigned, portfolio roles or additional permissions are required." ) - self.user.refresh_from_db() Portfolio.objects.all().delete() @less_console_noise_decorator @@ -1434,8 +1433,6 @@ class TestUser(TestCase): self.assertEqual( cm.exception.message, "When portfolio roles or additional permissions are assigned, portfolio is required." ) - self.user.refresh_from_db() - Portfolio.objects.all().delete() class TestContact(TestCase): From 59166fa2e6556d1ed5ac1667c66ffc78aaa6ebbd Mon Sep 17 00:00:00 2001 From: matthewswspence Date: Tue, 13 Aug 2024 09:36:07 -0500 Subject: [PATCH 19/19] remove header specificity on register-form-review-header styling --- src/registrar/assets/sass/_theme/_register-form.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/registrar/assets/sass/_theme/_register-form.scss b/src/registrar/assets/sass/_theme/_register-form.scss index 7c93f0a10..41d2980e3 100644 --- a/src/registrar/assets/sass/_theme/_register-form.scss +++ b/src/registrar/assets/sass/_theme/_register-form.scss @@ -25,7 +25,7 @@ } } -h3.register-form-review-header { +.register-form-review-header { color: color('primary-dark'); margin-top: units(2); margin-bottom: 0;