diff --git a/.github/workflows/delete-and-recreate-db.yaml b/.github/workflows/delete-and-recreate-db.yaml
index ecdf54bbc..979f20826 100644
--- a/.github/workflows/delete-and-recreate-db.yaml
+++ b/.github/workflows/delete-and-recreate-db.yaml
@@ -1,8 +1,8 @@
# This workflow can be run from the CLI
# gh workflow run reset-db.yaml -f environment=ENVIRONMENT
-name: Reset database
-run-name: Reset database for ${{ github.event.inputs.environment }}
+name: Delete and Recreate database
+run-name: Delete and Recreate for ${{ github.event.inputs.environment }}
on:
workflow_dispatch:
@@ -53,7 +53,7 @@ jobs:
sudo apt-get update
sudo apt-get install cf8-cli
cf api api.fr.cloud.gov
- cf auth "$CF_USERNAME" "$CF_PASSWORD"
+ cf auth "$cf_username" "$cf_password"
cf target -o cisa-dotgov -s $DESTINATION_ENVIRONMENT
diff --git a/src/registrar/assets/js/get-gov-reports.js b/src/registrar/assets/js/get-gov-reports.js
deleted file mode 100644
index b82a5574f..000000000
--- a/src/registrar/assets/js/get-gov-reports.js
+++ /dev/null
@@ -1,179 +0,0 @@
-
-/** An IIFE for admin in DjangoAdmin to listen to clicks on the growth report export button,
- * attach the seleted start and end dates to a url that'll trigger the view, and finally
- * redirect to that url.
- *
- * This function also sets the start and end dates to match the url params if they exist
-*/
-(function () {
- // Function to get URL parameter value by name
- function getParameterByName(name, url) {
- if (!url) url = window.location.href;
- name = name.replace(/[\[\]]/g, '\\$&');
- var regex = new RegExp('[?&]' + name + '(=([^]*)|&|#|$)'),
- results = regex.exec(url);
- if (!results) return null;
- if (!results[2]) return '';
- return decodeURIComponent(results[2].replace(/\+/g, ' '));
- }
-
- // Get the current date in the format YYYY-MM-DD
- let currentDate = new Date().toISOString().split('T')[0];
-
- // Default the value of the start date input field to the current date
- let startDateInput = document.getElementById('start');
-
- // Default the value of the end date input field to the current date
- let endDateInput = document.getElementById('end');
-
- let exportButtons = document.querySelectorAll('.exportLink');
-
- if (exportButtons.length > 0) {
- // Check if start and end dates are present in the URL
- let urlStartDate = getParameterByName('start_date');
- let urlEndDate = getParameterByName('end_date');
-
- // Set input values based on URL parameters or current date
- startDateInput.value = urlStartDate || currentDate;
- endDateInput.value = urlEndDate || currentDate;
-
- exportButtons.forEach((btn) => {
- btn.addEventListener('click', function () {
- // Get the selected start and end dates
- let startDate = startDateInput.value;
- let endDate = endDateInput.value;
- let exportUrl = btn.dataset.exportUrl;
-
- // Build the URL with parameters
- exportUrl += "?start_date=" + startDate + "&end_date=" + endDate;
-
- // Redirect to the export URL
- window.location.href = exportUrl;
- });
- });
- }
-
-})();
-
-
-/** An IIFE to initialize the analytics page
-*/
-(function () {
-
- /**
- * Creates a diagonal stripe pattern for chart.js
- * Inspired by https://stackoverflow.com/questions/28569667/fill-chart-js-bar-chart-with-diagonal-stripes-or-other-patterns
- * and https://github.com/ashiguruma/patternomaly
- * @param {string} backgroundColor - Background color of the pattern
- * @param {string} [lineColor="white"] - Color of the diagonal lines
- * @param {boolean} [rightToLeft=false] - Direction of the diagonal lines
- * @param {number} [lineGap=1] - Gap between lines
- * @returns {CanvasPattern} A canvas pattern object for use with backgroundColor
- */
- function createDiagonalPattern(backgroundColor, lineColor, rightToLeft=false, lineGap=1) {
- // Define the canvas and the 2d context so we can draw on it
- let shape = document.createElement("canvas");
- shape.width = 20;
- shape.height = 20;
- let context = shape.getContext("2d");
-
- // Fill with specified background color
- context.fillStyle = backgroundColor;
- context.fillRect(0, 0, shape.width, shape.height);
-
- // Set stroke properties
- context.strokeStyle = lineColor;
- context.lineWidth = 2;
-
- // Rotate canvas for a right-to-left pattern
- if (rightToLeft) {
- context.translate(shape.width, 0);
- context.rotate(90 * Math.PI / 180);
- };
-
- // First diagonal line
- let halfSize = shape.width / 2;
- context.moveTo(halfSize - lineGap, -lineGap);
- context.lineTo(shape.width + lineGap, halfSize + lineGap);
-
- // Second diagonal line (x,y are swapped)
- context.moveTo(-lineGap, halfSize - lineGap);
- context.lineTo(halfSize + lineGap, shape.width + lineGap);
-
- context.stroke();
- return context.createPattern(shape, "repeat");
- }
-
- function createComparativeColumnChart(canvasId, title, labelOne, labelTwo) {
- var canvas = document.getElementById(canvasId);
- if (!canvas) {
- return
- }
-
- var ctx = canvas.getContext("2d");
-
- var listOne = JSON.parse(canvas.getAttribute('data-list-one'));
- var listTwo = JSON.parse(canvas.getAttribute('data-list-two'));
-
- var data = {
- labels: ["Total", "Federal", "Interstate", "State/Territory", "Tribal", "County", "City", "Special District", "School District", "Election Board"],
- datasets: [
- {
- label: labelOne,
- backgroundColor: "rgba(255, 99, 132, 0.3)",
- borderColor: "rgba(255, 99, 132, 1)",
- borderWidth: 1,
- data: listOne,
- // Set this line style to be rightToLeft for visual distinction
- backgroundColor: createDiagonalPattern('rgba(255, 99, 132, 0.3)', 'white', true)
- },
- {
- label: labelTwo,
- backgroundColor: "rgba(75, 192, 192, 0.3)",
- borderColor: "rgba(75, 192, 192, 1)",
- borderWidth: 1,
- data: listTwo,
- backgroundColor: createDiagonalPattern('rgba(75, 192, 192, 0.3)', 'white')
- },
- ],
- };
-
- var options = {
- responsive: true,
- maintainAspectRatio: false,
- plugins: {
- legend: {
- position: 'top',
- },
- title: {
- display: true,
- text: title
- }
- },
- scales: {
- y: {
- beginAtZero: true,
- },
- },
- };
-
- new Chart(ctx, {
- type: "bar",
- data: data,
- options: options,
- });
- }
-
- function initComparativeColumnCharts() {
- document.addEventListener("DOMContentLoaded", function () {
- createComparativeColumnChart("myChart1", "Managed domains", "Start Date", "End Date");
- createComparativeColumnChart("myChart2", "Unmanaged domains", "Start Date", "End Date");
- createComparativeColumnChart("myChart3", "Deleted domains", "Start Date", "End Date");
- createComparativeColumnChart("myChart4", "Ready domains", "Start Date", "End Date");
- createComparativeColumnChart("myChart5", "Submitted requests", "Start Date", "End Date");
- createComparativeColumnChart("myChart6", "All requests", "Start Date", "End Date");
- });
- };
-
- initComparativeColumnCharts();
-})();
diff --git a/src/registrar/assets/src/js/getgov-admin/analytics.js b/src/registrar/assets/src/js/getgov-admin/analytics.js
new file mode 100644
index 000000000..47bc81388
--- /dev/null
+++ b/src/registrar/assets/src/js/getgov-admin/analytics.js
@@ -0,0 +1,177 @@
+import { debounce } from '../getgov/helpers.js';
+import { getParameterByName } from './helpers-admin.js';
+
+/** This function also sets the start and end dates to match the url params if they exist
+*/
+function initAnalyticsExportButtons() {
+ // Get the current date in the format YYYY-MM-DD
+ let currentDate = new Date().toISOString().split('T')[0];
+
+ // Default the value of the start date input field to the current date
+ let startDateInput = document.getElementById('start');
+
+ // Default the value of the end date input field to the current date
+ let endDateInput = document.getElementById('end');
+
+ let exportButtons = document.querySelectorAll('.exportLink');
+
+ if (exportButtons.length > 0) {
+ // Check if start and end dates are present in the URL
+ let urlStartDate = getParameterByName('start_date');
+ let urlEndDate = getParameterByName('end_date');
+
+ // Set input values based on URL parameters or current date
+ startDateInput.value = urlStartDate || currentDate;
+ endDateInput.value = urlEndDate || currentDate;
+
+ exportButtons.forEach((btn) => {
+ btn.addEventListener('click', function () {
+ // Get the selected start and end dates
+ let startDate = startDateInput.value;
+ let endDate = endDateInput.value;
+ let exportUrl = btn.dataset.exportUrl;
+
+ // Build the URL with parameters
+ exportUrl += "?start_date=" + startDate + "&end_date=" + endDate;
+
+ // Redirect to the export URL
+ window.location.href = exportUrl;
+ });
+ });
+ }
+};
+
+/**
+ * Creates a diagonal stripe pattern for chart.js
+ * Inspired by https://stackoverflow.com/questions/28569667/fill-chart-js-bar-chart-with-diagonal-stripes-or-other-patterns
+ * and https://github.com/ashiguruma/patternomaly
+ * @param {string} backgroundColor - Background color of the pattern
+ * @param {string} [lineColor="white"] - Color of the diagonal lines
+ * @param {boolean} [rightToLeft=false] - Direction of the diagonal lines
+ * @param {number} [lineGap=1] - Gap between lines
+ * @returns {CanvasPattern} A canvas pattern object for use with backgroundColor
+ */
+function createDiagonalPattern(backgroundColor, lineColor, rightToLeft=false, lineGap=1) {
+ // Define the canvas and the 2d context so we can draw on it
+ let shape = document.createElement("canvas");
+ shape.width = 20;
+ shape.height = 20;
+ let context = shape.getContext("2d");
+
+ // Fill with specified background color
+ context.fillStyle = backgroundColor;
+ context.fillRect(0, 0, shape.width, shape.height);
+
+ // Set stroke properties
+ context.strokeStyle = lineColor;
+ context.lineWidth = 2;
+
+ // Rotate canvas for a right-to-left pattern
+ if (rightToLeft) {
+ context.translate(shape.width, 0);
+ context.rotate(90 * Math.PI / 180);
+ };
+
+ // First diagonal line
+ let halfSize = shape.width / 2;
+ context.moveTo(halfSize - lineGap, -lineGap);
+ context.lineTo(shape.width + lineGap, halfSize + lineGap);
+
+ // Second diagonal line (x,y are swapped)
+ context.moveTo(-lineGap, halfSize - lineGap);
+ context.lineTo(halfSize + lineGap, shape.width + lineGap);
+
+ context.stroke();
+ return context.createPattern(shape, "repeat");
+}
+
+function createComparativeColumnChart(id, title, labelOne, labelTwo) {
+ var canvas = document.getElementById(id);
+ if (!canvas) {
+ return
+ }
+
+ var ctx = canvas.getContext("2d");
+ var listOne = JSON.parse(canvas.getAttribute('data-list-one'));
+ var listTwo = JSON.parse(canvas.getAttribute('data-list-two'));
+
+ var data = {
+ labels: ["Total", "Federal", "Interstate", "State/Territory", "Tribal", "County", "City", "Special District", "School District", "Election Board"],
+ datasets: [
+ {
+ label: labelOne,
+ backgroundColor: "rgba(255, 99, 132, 0.3)",
+ borderColor: "rgba(255, 99, 132, 1)",
+ borderWidth: 1,
+ data: listOne,
+ // Set this line style to be rightToLeft for visual distinction
+ backgroundColor: createDiagonalPattern('rgba(255, 99, 132, 0.3)', 'white', true)
+ },
+ {
+ label: labelTwo,
+ backgroundColor: "rgba(75, 192, 192, 0.3)",
+ borderColor: "rgba(75, 192, 192, 1)",
+ borderWidth: 1,
+ data: listTwo,
+ backgroundColor: createDiagonalPattern('rgba(75, 192, 192, 0.3)', 'white')
+ },
+ ],
+ };
+
+ var options = {
+ responsive: true,
+ maintainAspectRatio: false,
+ plugins: {
+ legend: {
+ position: 'top',
+ },
+ title: {
+ display: true,
+ text: title
+ }
+ },
+ scales: {
+ y: {
+ beginAtZero: true,
+ },
+ },
+ };
+ return new Chart(ctx, {
+ type: "bar",
+ data: data,
+ options: options,
+ });
+}
+
+/** An IIFE to initialize the analytics page
+*/
+export function initAnalyticsDashboard() {
+ const analyticsPageContainer = document.querySelector('.analytics-dashboard-charts');
+ if (analyticsPageContainer) {
+ document.addEventListener("DOMContentLoaded", function () {
+ initAnalyticsExportButtons();
+
+ // Create charts and store each instance of it
+ const chartInstances = new Map();
+ const charts = [
+ { id: "managed-domains-chart", title: "Managed domains" },
+ { id: "unmanaged-domains-chart", title: "Unmanaged domains" },
+ { id: "deleted-domains-chart", title: "Deleted domains" },
+ { id: "ready-domains-chart", title: "Ready domains" },
+ { id: "submitted-requests-chart", title: "Submitted requests" },
+ { id: "all-requests-chart", title: "All requests" }
+ ];
+ charts.forEach(chart => {
+ if (chartInstances.has(chart.id)) chartInstances.get(chart.id).destroy();
+ chartInstances.set(chart.id, createComparativeColumnChart(chart.id, chart.title, "Start Date", "End Date"));
+ });
+
+ // Add resize listener to each chart
+ window.addEventListener("resize", debounce(() => {
+ chartInstances.forEach((chart) => {
+ if (chart?.canvas) chart.resize();
+ });
+ }, 200));
+ });
+ }
+};
diff --git a/src/registrar/assets/src/js/getgov-admin/helpers-admin.js b/src/registrar/assets/src/js/getgov-admin/helpers-admin.js
index ff618a67d..8055e29d3 100644
--- a/src/registrar/assets/src/js/getgov-admin/helpers-admin.js
+++ b/src/registrar/assets/src/js/getgov-admin/helpers-admin.js
@@ -22,3 +22,13 @@ export function addOrRemoveSessionBoolean(name, add){
sessionStorage.removeItem(name);
}
}
+
+export function getParameterByName(name, url) {
+ if (!url) url = window.location.href;
+ name = name.replace(/[\[\]]/g, '\\$&');
+ var regex = new RegExp('[?&]' + name + '(=([^]*)|&|#|$)'),
+ results = regex.exec(url);
+ if (!results) return null;
+ if (!results[2]) return '';
+ return decodeURIComponent(results[2].replace(/\+/g, ' '));
+}
diff --git a/src/registrar/assets/src/js/getgov-admin/main.js b/src/registrar/assets/src/js/getgov-admin/main.js
index 64be572b2..5c6de20ab 100644
--- a/src/registrar/assets/src/js/getgov-admin/main.js
+++ b/src/registrar/assets/src/js/getgov-admin/main.js
@@ -15,6 +15,7 @@ import { initDomainFormTargetBlankButtons } from './domain-form.js';
import { initDynamicPortfolioFields } from './portfolio-form.js';
import { initDynamicDomainInformationFields } from './domain-information-form.js';
import { initDynamicDomainFields } from './domain-form.js';
+import { initAnalyticsDashboard } from './analytics.js';
// General
initModals();
@@ -41,3 +42,6 @@ initDynamicPortfolioFields();
// Domain information
initDynamicDomainInformationFields();
+
+// Analytics dashboard
+initAnalyticsDashboard();
diff --git a/src/registrar/assets/src/sass/_theme/_admin.scss b/src/registrar/assets/src/sass/_theme/_admin.scss
index 322e94bf0..a15d1eabe 100644
--- a/src/registrar/assets/src/sass/_theme/_admin.scss
+++ b/src/registrar/assets/src/sass/_theme/_admin.scss
@@ -558,13 +558,18 @@ details.dja-detail-table {
background-color: transparent;
}
+ thead tr {
+ background-color: var(--darkened-bg);
+ }
+
td, th {
padding-left: 12px;
- border: none
+ border: none;
+ background-color: var(--darkened-bg);
+ color: var(--body-quiet-color);
}
thead > tr > th {
- border-radius: 4px;
border-top: none;
border-bottom: none;
}
@@ -946,3 +951,34 @@ ul.add-list-reset {
background-color: transparent !important;
}
}
+
+@media (min-width: 1080px) {
+ .analytics-dashboard-charts {
+ // Desktop layout - charts in top row, details in bottom row
+ display: grid;
+ gap: 2rem;
+ // Equal columns each gets 1/2 of the space
+ grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
+ grid-template-areas:
+ "chart1 chart2"
+ "details1 details2"
+ "chart3 chart4"
+ "details3 details4"
+ "chart5 chart6"
+ "details5 details6";
+
+ .chart-1 { grid-area: chart1; }
+ .chart-2 { grid-area: chart2; }
+ .chart-3 { grid-area: chart3; }
+ .chart-4 { grid-area: chart4; }
+ .chart-5 { grid-area: chart5; }
+ .chart-6 { grid-area: chart6; }
+ .details-1 { grid-area: details1; }
+ .details-2 { grid-area: details2; }
+ .details-3 { grid-area: details3; }
+ .details-4 { grid-area: details4; }
+ .details-5 { grid-area: details5; }
+ .details-6 { grid-area: details6; }
+ }
+
+}
diff --git a/src/registrar/config/settings.py b/src/registrar/config/settings.py
index 78439188e..fa4c2d8dc 100644
--- a/src/registrar/config/settings.py
+++ b/src/registrar/config/settings.py
@@ -107,6 +107,7 @@ DEBUG = env_debug
# Controls production specific feature toggles
IS_PRODUCTION = env_is_production
SECRET_ENCRYPT_METADATA = secret_encrypt_metadata
+BASE_URL = env_base_url
# Applications are modular pieces of code.
# They are provided by Django, by third-parties, or by yourself.
diff --git a/src/registrar/context_processors.py b/src/registrar/context_processors.py
index a078c81ac..4e17b7fa1 100644
--- a/src/registrar/context_processors.py
+++ b/src/registrar/context_processors.py
@@ -68,19 +68,9 @@ def portfolio_permissions(request):
"has_organization_requests_flag": False,
"has_organization_members_flag": False,
"is_portfolio_admin": False,
- "has_domain_renewal_flag": False,
}
try:
portfolio = request.session.get("portfolio")
-
- # These feature flags will display and doesn't depend on portfolio
- portfolio_context.update(
- {
- "has_organization_feature_flag": True,
- "has_domain_renewal_flag": request.user.has_domain_renewal_flag(),
- }
- )
-
if portfolio:
return {
"has_view_portfolio_permission": request.user.has_view_portfolio_permission(portfolio),
@@ -95,7 +85,6 @@ def portfolio_permissions(request):
"has_organization_requests_flag": request.user.has_organization_requests_flag(),
"has_organization_members_flag": request.user.has_organization_members_flag(),
"is_portfolio_admin": request.user.is_portfolio_admin(portfolio),
- "has_domain_renewal_flag": request.user.has_domain_renewal_flag(),
}
return portfolio_context
diff --git a/src/registrar/fixtures/fixtures_users.py b/src/registrar/fixtures/fixtures_users.py
index 876bc9fb5..fdaa1c135 100644
--- a/src/registrar/fixtures/fixtures_users.py
+++ b/src/registrar/fixtures/fixtures_users.py
@@ -171,6 +171,13 @@ class UserFixture:
"email": "gina.summers@ecstech.com",
"title": "Scrum Master",
},
+ {
+ "username": "89f2db87-87a2-4778-a5ea-5b27b585b131",
+ "first_name": "Jaxon",
+ "last_name": "Silva",
+ "email": "jaxon.silva@cisa.dhs.gov",
+ "title": "Designer",
+ },
]
STAFF = [
diff --git a/src/registrar/forms/portfolio.py b/src/registrar/forms/portfolio.py
index 1a0fe6edf..5aef09389 100644
--- a/src/registrar/forms/portfolio.py
+++ b/src/registrar/forms/portfolio.py
@@ -13,7 +13,16 @@ from registrar.models import (
Portfolio,
SeniorOfficial,
)
-from registrar.models.utility.portfolio_helper import UserPortfolioPermissionChoices, UserPortfolioRoleChoices
+from registrar.models.utility.portfolio_helper import (
+ UserPortfolioPermissionChoices,
+ UserPortfolioRoleChoices,
+ get_domain_requests_description_display,
+ get_domain_requests_display,
+ get_domains_description_display,
+ get_domains_display,
+ get_members_description_display,
+ get_members_display,
+)
logger = logging.getLogger(__name__)
@@ -126,8 +135,16 @@ class BasePortfolioMemberForm(forms.ModelForm):
domain_permissions = forms.ChoiceField(
choices=[
- (UserPortfolioPermissionChoices.VIEW_MANAGED_DOMAINS.value, "Viewer, limited"),
- (UserPortfolioPermissionChoices.VIEW_ALL_DOMAINS.value, "Viewer"),
+ (
+ UserPortfolioPermissionChoices.VIEW_MANAGED_DOMAINS.value,
+ get_domains_display(UserPortfolioRoleChoices.ORGANIZATION_MEMBER, None),
+ ),
+ (
+ UserPortfolioPermissionChoices.VIEW_ALL_DOMAINS.value,
+ get_domains_display(
+ UserPortfolioRoleChoices.ORGANIZATION_MEMBER, [UserPortfolioPermissionChoices.VIEW_ALL_DOMAINS]
+ ),
+ ),
],
widget=forms.RadioSelect,
required=False,
@@ -139,9 +156,19 @@ class BasePortfolioMemberForm(forms.ModelForm):
domain_request_permissions = forms.ChoiceField(
choices=[
- ("no_access", "No access"),
- (UserPortfolioPermissionChoices.VIEW_ALL_REQUESTS.value, "Viewer"),
- (UserPortfolioPermissionChoices.EDIT_REQUESTS.value, "Creator"),
+ ("no_access", get_domain_requests_display(UserPortfolioRoleChoices.ORGANIZATION_MEMBER, None)),
+ (
+ UserPortfolioPermissionChoices.VIEW_ALL_REQUESTS.value,
+ get_domain_requests_display(
+ UserPortfolioRoleChoices.ORGANIZATION_MEMBER, [UserPortfolioPermissionChoices.VIEW_ALL_REQUESTS]
+ ),
+ ),
+ (
+ UserPortfolioPermissionChoices.EDIT_REQUESTS.value,
+ get_domain_requests_display(
+ UserPortfolioRoleChoices.ORGANIZATION_MEMBER, [UserPortfolioPermissionChoices.EDIT_REQUESTS]
+ ),
+ ),
],
widget=forms.RadioSelect,
required=False,
@@ -153,8 +180,13 @@ class BasePortfolioMemberForm(forms.ModelForm):
member_permissions = forms.ChoiceField(
choices=[
- ("no_access", "No access"),
- (UserPortfolioPermissionChoices.VIEW_MEMBERS.value, "Viewer"),
+ ("no_access", get_members_display(UserPortfolioRoleChoices.ORGANIZATION_MEMBER, None)),
+ (
+ UserPortfolioPermissionChoices.VIEW_MEMBERS.value,
+ get_members_display(
+ UserPortfolioRoleChoices.ORGANIZATION_MEMBER, [UserPortfolioPermissionChoices.VIEW_MEMBERS]
+ ),
+ ),
],
widget=forms.RadioSelect,
required=False,
@@ -191,19 +223,31 @@ class BasePortfolioMemberForm(forms.ModelForm):
# Adds a
description beneath each option
self.fields["domain_permissions"].descriptions = {
- UserPortfolioPermissionChoices.VIEW_MANAGED_DOMAINS.value: "Can view only the domains they manage",
- UserPortfolioPermissionChoices.VIEW_ALL_DOMAINS.value: "Can view all domains for the organization",
+ UserPortfolioPermissionChoices.VIEW_MANAGED_DOMAINS.value: get_domains_description_display(
+ UserPortfolioRoleChoices.ORGANIZATION_MEMBER, None
+ ),
+ UserPortfolioPermissionChoices.VIEW_ALL_DOMAINS.value: get_domains_description_display(
+ UserPortfolioRoleChoices.ORGANIZATION_MEMBER, [UserPortfolioPermissionChoices.VIEW_ALL_DOMAINS]
+ ),
}
self.fields["domain_request_permissions"].descriptions = {
UserPortfolioPermissionChoices.EDIT_REQUESTS.value: (
- "Can view all domain requests for the organization and create requests"
+ get_domain_requests_description_display(
+ UserPortfolioRoleChoices.ORGANIZATION_MEMBER, [UserPortfolioPermissionChoices.EDIT_REQUESTS]
+ )
),
- UserPortfolioPermissionChoices.VIEW_ALL_REQUESTS.value: "Can view all domain requests for the organization",
- "no_access": "Cannot view or create domain requests",
+ UserPortfolioPermissionChoices.VIEW_ALL_REQUESTS.value: (
+ get_domain_requests_description_display(
+ UserPortfolioRoleChoices.ORGANIZATION_MEMBER, [UserPortfolioPermissionChoices.VIEW_ALL_REQUESTS]
+ )
+ ),
+ "no_access": get_domain_requests_description_display(UserPortfolioRoleChoices.ORGANIZATION_MEMBER, None),
}
self.fields["member_permissions"].descriptions = {
- UserPortfolioPermissionChoices.VIEW_MEMBERS.value: "Can view all member permissions",
- "no_access": "Cannot view member permissions",
+ UserPortfolioPermissionChoices.VIEW_MEMBERS.value: get_members_description_display(
+ UserPortfolioRoleChoices.ORGANIZATION_MEMBER, [UserPortfolioPermissionChoices.VIEW_MEMBERS]
+ ),
+ "no_access": get_members_description_display(UserPortfolioRoleChoices.ORGANIZATION_MEMBER, None),
}
# Map model instance values to custom form fields
@@ -338,6 +382,24 @@ class BasePortfolioMemberForm(forms.ModelForm):
and UserPortfolioRoleChoices.ORGANIZATION_ADMIN not in new_roles
)
+ def is_change(self) -> bool:
+ """
+ Determines if the form has changed by comparing the initial data
+ with the submitted cleaned data.
+
+ Returns:
+ bool: True if the form has changed, False otherwise.
+ """
+ # Compare role values
+ previous_roles = set(self.initial.get("roles", []))
+ new_roles = set(self.cleaned_data.get("roles", []))
+
+ # Compare additional permissions values
+ previous_permissions = set(self.initial.get("additional_permissions") or [])
+ new_permissions = set(self.cleaned_data.get("additional_permissions") or [])
+
+ return previous_roles != new_roles or previous_permissions != new_permissions
+
class PortfolioMemberForm(BasePortfolioMemberForm):
"""
diff --git a/src/registrar/models/domain.py b/src/registrar/models/domain.py
index 649b3f93d..42310c3bb 100644
--- a/src/registrar/models/domain.py
+++ b/src/registrar/models/domain.py
@@ -41,7 +41,6 @@ from .utility.time_stamped_model import TimeStampedModel
from .public_contact import PublicContact
from .user_domain_role import UserDomainRole
-from waffle.decorators import flag_is_active
logger = logging.getLogger(__name__)
@@ -1172,7 +1171,7 @@ class Domain(TimeStampedModel, DomainHelper):
"""Return the display status of the domain."""
if self.is_expired() and (self.state != self.State.UNKNOWN):
return "Expired"
- elif flag_is_active(request, "domain_renewal") and self.is_expiring():
+ elif self.is_expiring():
return "Expiring soon"
elif self.state == self.State.UNKNOWN or self.state == self.State.DNS_NEEDED:
return "DNS needed"
@@ -1588,7 +1587,7 @@ class Domain(TimeStampedModel, DomainHelper):
# Given expired is not a physical state, but it is displayed as such,
# We need custom logic to determine this message.
help_text = "This domain has expired. Complete the online renewal process to maintain access."
- elif flag_is_active(request, "domain_renewal") and self.is_expiring():
+ elif self.is_expiring():
help_text = "This domain is expiring soon. Complete the online renewal process to maintain access."
else:
help_text = Domain.State.get_help_text(self.state)
diff --git a/src/registrar/models/portfolio_invitation.py b/src/registrar/models/portfolio_invitation.py
index 8feeb0794..fafa99856 100644
--- a/src/registrar/models/portfolio_invitation.py
+++ b/src/registrar/models/portfolio_invitation.py
@@ -9,6 +9,13 @@ from .utility.portfolio_helper import (
UserPortfolioPermissionChoices,
UserPortfolioRoleChoices,
cleanup_after_portfolio_member_deletion,
+ get_domain_requests_description_display,
+ get_domain_requests_display,
+ get_domains_description_display,
+ get_domains_display,
+ get_members_description_display,
+ get_members_display,
+ get_role_display,
validate_portfolio_invitation,
) # type: ignore
from .utility.time_stamped_model import TimeStampedModel
@@ -85,6 +92,90 @@ class PortfolioInvitation(TimeStampedModel):
"""
return UserPortfolioPermission.get_portfolio_permissions(self.roles, self.additional_permissions)
+ @property
+ def role_display(self):
+ """
+ Returns a human-readable display name for the user's role.
+
+ Uses the `get_role_display` function to determine if the user is an "Admin",
+ "Basic" member, or has no role assigned.
+
+ Returns:
+ str: The display name of the user's role.
+ """
+ return get_role_display(self.roles)
+
+ @property
+ def domains_display(self):
+ """
+ Returns a string representation of the user's domain access level.
+
+ Uses the `get_domains_display` function to determine whether the user has
+ "Viewer" access (can view all domains) or "Viewer, limited" access.
+
+ Returns:
+ str: The display name of the user's domain permissions.
+ """
+ return get_domains_display(self.roles, self.additional_permissions)
+
+ @property
+ def domains_description_display(self):
+ """
+ Returns a string description of the user's domain access level.
+
+ Returns:
+ str: The display name of the user's domain permissions description.
+ """
+ return get_domains_description_display(self.roles, self.additional_permissions)
+
+ @property
+ def domain_requests_display(self):
+ """
+ Returns a string representation of the user's access to domain requests.
+
+ Uses the `get_domain_requests_display` function to determine if the user
+ is a "Creator" (can create and edit requests), a "Viewer" (can only view requests),
+ or has "No access" to domain requests.
+
+ Returns:
+ str: The display name of the user's domain request permissions.
+ """
+ return get_domain_requests_display(self.roles, self.additional_permissions)
+
+ @property
+ def domain_requests_description_display(self):
+ """
+ Returns a string description of the user's access to domain requests.
+
+ Returns:
+ str: The display name of the user's domain request permissions description.
+ """
+ return get_domain_requests_description_display(self.roles, self.additional_permissions)
+
+ @property
+ def members_display(self):
+ """
+ Returns a string representation of the user's access to managing members.
+
+ Uses the `get_members_display` function to determine if the user is a
+ "Manager" (can edit members), a "Viewer" (can view members), or has "No access"
+ to member management.
+
+ Returns:
+ str: The display name of the user's member management permissions.
+ """
+ return get_members_display(self.roles, self.additional_permissions)
+
+ @property
+ def members_description_display(self):
+ """
+ Returns a string description of the user's access to managing members.
+
+ Returns:
+ str: The display name of the user's member management permissions description.
+ """
+ return get_members_description_display(self.roles, self.additional_permissions)
+
@transition(field="status", source=PortfolioInvitationStatus.INVITED, target=PortfolioInvitationStatus.RETRIEVED)
def retrieve(self):
"""When an invitation is retrieved, create the corresponding permission.
diff --git a/src/registrar/models/user.py b/src/registrar/models/user.py
index 6f8ee499b..d5476ab9a 100644
--- a/src/registrar/models/user.py
+++ b/src/registrar/models/user.py
@@ -269,10 +269,7 @@ class User(AbstractUser):
return self._has_portfolio_permission(portfolio, UserPortfolioPermissionChoices.EDIT_REQUESTS)
def is_portfolio_admin(self, portfolio):
- return "Admin" in self.portfolio_role_summary(portfolio)
-
- def has_domain_renewal_flag(self):
- return flag_is_active_for_user(self, "domain_renewal")
+ return self.has_edit_portfolio_permission(portfolio)
def get_first_portfolio(self):
permission = self.portfolio_permissions.first()
@@ -280,49 +277,6 @@ class User(AbstractUser):
return permission.portfolio
return None
- def portfolio_role_summary(self, portfolio):
- """Returns a list of roles based on the user's permissions."""
- roles = []
-
- # Define the conditions and their corresponding roles
- conditions_roles = [
- (self.has_edit_portfolio_permission(portfolio), ["Admin"]),
- (
- self.has_view_all_domains_portfolio_permission(portfolio)
- and self.has_any_requests_portfolio_permission(portfolio)
- and self.has_edit_request_portfolio_permission(portfolio),
- ["View-only admin", "Domain requestor"],
- ),
- (
- self.has_view_all_domains_portfolio_permission(portfolio)
- and self.has_any_requests_portfolio_permission(portfolio),
- ["View-only admin"],
- ),
- (
- self.has_view_portfolio_permission(portfolio)
- and self.has_edit_request_portfolio_permission(portfolio)
- and self.has_any_domains_portfolio_permission(portfolio),
- ["Domain requestor", "Domain manager"],
- ),
- (
- self.has_view_portfolio_permission(portfolio) and self.has_edit_request_portfolio_permission(portfolio),
- ["Domain requestor"],
- ),
- (
- self.has_view_portfolio_permission(portfolio) and self.has_any_domains_portfolio_permission(portfolio),
- ["Domain manager"],
- ),
- (self.has_view_portfolio_permission(portfolio), ["Member"]),
- ]
-
- # Evaluate conditions and add roles
- for condition, role_list in conditions_roles:
- if condition:
- roles.extend(role_list)
- break
-
- return roles
-
def get_portfolios(self):
return self.portfolio_permissions.all()
diff --git a/src/registrar/models/user_portfolio_permission.py b/src/registrar/models/user_portfolio_permission.py
index 5378dc185..0a758ff6a 100644
--- a/src/registrar/models/user_portfolio_permission.py
+++ b/src/registrar/models/user_portfolio_permission.py
@@ -6,6 +6,13 @@ from registrar.models.utility.portfolio_helper import (
DomainRequestPermissionDisplay,
MemberPermissionDisplay,
cleanup_after_portfolio_member_deletion,
+ get_domain_requests_display,
+ get_domain_requests_description_display,
+ get_domains_display,
+ get_domains_description_display,
+ get_members_display,
+ get_members_description_display,
+ get_role_display,
validate_user_portfolio_permission,
)
from .utility.time_stamped_model import TimeStampedModel
@@ -181,6 +188,90 @@ class UserPortfolioPermission(TimeStampedModel):
# This is the same as portfolio_permissions & common_forbidden_perms.
return portfolio_permissions.intersection(common_forbidden_perms)
+ @property
+ def role_display(self):
+ """
+ Returns a human-readable display name for the user's role.
+
+ Uses the `get_role_display` function to determine if the user is an "Admin",
+ "Basic" member, or has no role assigned.
+
+ Returns:
+ str: The display name of the user's role.
+ """
+ return get_role_display(self.roles)
+
+ @property
+ def domains_display(self):
+ """
+ Returns a string representation of the user's domain access level.
+
+ Uses the `get_domains_display` function to determine whether the user has
+ "Viewer" access (can view all domains) or "Viewer, limited" access.
+
+ Returns:
+ str: The display name of the user's domain permissions.
+ """
+ return get_domains_display(self.roles, self.additional_permissions)
+
+ @property
+ def domains_description_display(self):
+ """
+ Returns a string description of the user's domain access level.
+
+ Returns:
+ str: The display name of the user's domain permissions description.
+ """
+ return get_domains_description_display(self.roles, self.additional_permissions)
+
+ @property
+ def domain_requests_display(self):
+ """
+ Returns a string representation of the user's access to domain requests.
+
+ Uses the `get_domain_requests_display` function to determine if the user
+ is a "Creator" (can create and edit requests), a "Viewer" (can only view requests),
+ or has "No access" to domain requests.
+
+ Returns:
+ str: The display name of the user's domain request permissions.
+ """
+ return get_domain_requests_display(self.roles, self.additional_permissions)
+
+ @property
+ def domain_requests_description_display(self):
+ """
+ Returns a string description of the user's access to domain requests.
+
+ Returns:
+ str: The display name of the user's domain request permissions description.
+ """
+ return get_domain_requests_description_display(self.roles, self.additional_permissions)
+
+ @property
+ def members_display(self):
+ """
+ Returns a string representation of the user's access to managing members.
+
+ Uses the `get_members_display` function to determine if the user is a
+ "Manager" (can edit members), a "Viewer" (can view members), or has "No access"
+ to member management.
+
+ Returns:
+ str: The display name of the user's member management permissions.
+ """
+ return get_members_display(self.roles, self.additional_permissions)
+
+ @property
+ def members_description_display(self):
+ """
+ Returns a string description of the user's access to managing members.
+
+ Returns:
+ str: The display name of the user's member management permissions description.
+ """
+ return get_members_description_display(self.roles, self.additional_permissions)
+
def clean(self):
"""Extends clean method to perform additional validation, which can raise errors in django admin."""
super().clean()
diff --git a/src/registrar/models/utility/portfolio_helper.py b/src/registrar/models/utility/portfolio_helper.py
index 5feae1cc1..e94733fb6 100644
--- a/src/registrar/models/utility/portfolio_helper.py
+++ b/src/registrar/models/utility/portfolio_helper.py
@@ -79,6 +79,161 @@ class MemberPermissionDisplay(StrEnum):
NONE = "None"
+def get_role_display(roles):
+ """
+ Returns a user-friendly display name for a given list of user roles.
+
+ - If the user has the ORGANIZATION_ADMIN role, return "Admin".
+ - If the user has the ORGANIZATION_MEMBER role, return "Basic".
+ - If the user has neither role, return "-".
+
+ Args:
+ roles (list): A list of role strings assigned to the user.
+
+ Returns:
+ str: The display name for the highest applicable role.
+ """
+ if UserPortfolioRoleChoices.ORGANIZATION_ADMIN in roles:
+ return "Admin"
+ elif UserPortfolioRoleChoices.ORGANIZATION_MEMBER in roles:
+ return "Basic"
+ else:
+ return "-"
+
+
+def get_domains_display(roles, permissions):
+ """
+ Determines the display name for a user's domain viewing permissions.
+
+ - If the user has the VIEW_ALL_DOMAINS permission, return "Viewer".
+ - Otherwise, return "Viewer, limited".
+
+ Args:
+ roles (list): A list of role strings assigned to the user.
+ permissions (list): A list of additional permissions assigned to the user.
+
+ Returns:
+ str: A string representing the user's domain viewing access.
+ """
+ UserPortfolioPermission = apps.get_model("registrar.UserPortfolioPermission")
+ all_permissions = UserPortfolioPermission.get_portfolio_permissions(roles, permissions)
+ if UserPortfolioPermissionChoices.VIEW_ALL_DOMAINS in all_permissions:
+ return "Viewer"
+ else:
+ return "Viewer, limited"
+
+
+def get_domains_description_display(roles, permissions):
+ """
+ Determines the display description for a user's domain viewing permissions.
+
+ Args:
+ roles (list): A list of role strings assigned to the user.
+ permissions (list): A list of additional permissions assigned to the user.
+
+ Returns:
+ str: A string representing the user's domain viewing access description.
+ """
+ UserPortfolioPermission = apps.get_model("registrar.UserPortfolioPermission")
+ all_permissions = UserPortfolioPermission.get_portfolio_permissions(roles, permissions)
+ if UserPortfolioPermissionChoices.VIEW_ALL_DOMAINS in all_permissions:
+ return "Can view all domains for the organization"
+ else:
+ return "Can view only the domains they manage"
+
+
+def get_domain_requests_display(roles, permissions):
+ """
+ Determines the display name for a user's domain request permissions.
+
+ - If the user has the EDIT_REQUESTS permission, return "Creator".
+ - If the user has the VIEW_ALL_REQUESTS permission, return "Viewer".
+ - Otherwise, return "No access".
+
+ Args:
+ roles (list): A list of role strings assigned to the user.
+ permissions (list): A list of additional permissions assigned to the user.
+
+ Returns:
+ str: A string representing the user's domain request access level.
+ """
+ UserPortfolioPermission = apps.get_model("registrar.UserPortfolioPermission")
+ all_permissions = UserPortfolioPermission.get_portfolio_permissions(roles, permissions)
+ if UserPortfolioPermissionChoices.EDIT_REQUESTS in all_permissions:
+ return "Creator"
+ elif UserPortfolioPermissionChoices.VIEW_ALL_REQUESTS in all_permissions:
+ return "Viewer"
+ else:
+ return "No access"
+
+
+def get_domain_requests_description_display(roles, permissions):
+ """
+ Determines the display description for a user's domain request permissions.
+
+ Args:
+ roles (list): A list of role strings assigned to the user.
+ permissions (list): A list of additional permissions assigned to the user.
+
+ Returns:
+ str: A string representing the user's domain request access level description.
+ """
+ UserPortfolioPermission = apps.get_model("registrar.UserPortfolioPermission")
+ all_permissions = UserPortfolioPermission.get_portfolio_permissions(roles, permissions)
+ if UserPortfolioPermissionChoices.EDIT_REQUESTS in all_permissions:
+ return "Can view all domain requests for the organization and create requests"
+ elif UserPortfolioPermissionChoices.VIEW_ALL_REQUESTS in all_permissions:
+ return "Can view all domain requests for the organization"
+ else:
+ return "Cannot view or create domain requests"
+
+
+def get_members_display(roles, permissions):
+ """
+ Determines the display name for a user's member management permissions.
+
+ - If the user has the EDIT_MEMBERS permission, return "Manager".
+ - If the user has the VIEW_MEMBERS permission, return "Viewer".
+ - Otherwise, return "No access".
+
+ Args:
+ roles (list): A list of role strings assigned to the user.
+ permissions (list): A list of additional permissions assigned to the user.
+
+ Returns:
+ str: A string representing the user's member management access level.
+ """
+ UserPortfolioPermission = apps.get_model("registrar.UserPortfolioPermission")
+ all_permissions = UserPortfolioPermission.get_portfolio_permissions(roles, permissions)
+ if UserPortfolioPermissionChoices.EDIT_MEMBERS in all_permissions:
+ return "Manager"
+ elif UserPortfolioPermissionChoices.VIEW_MEMBERS in all_permissions:
+ return "Viewer"
+ else:
+ return "No access"
+
+
+def get_members_description_display(roles, permissions):
+ """
+ Determines the display description for a user's member management permissions.
+
+ Args:
+ roles (list): A list of role strings assigned to the user.
+ permissions (list): A list of additional permissions assigned to the user.
+
+ Returns:
+ str: A string representing the user's member management access level description.
+ """
+ UserPortfolioPermission = apps.get_model("registrar.UserPortfolioPermission")
+ all_permissions = UserPortfolioPermission.get_portfolio_permissions(roles, permissions)
+ if UserPortfolioPermissionChoices.EDIT_MEMBERS in all_permissions:
+ return "Can view and manage all member permissions"
+ elif UserPortfolioPermissionChoices.VIEW_MEMBERS in all_permissions:
+ return "Can view all member permissions"
+ else:
+ return "Cannot view member permissions"
+
+
def validate_user_portfolio_permission(user_portfolio_permission):
"""
Validates a UserPortfolioPermission instance. Located in portfolio_helper to avoid circular imports
diff --git a/src/registrar/templates/admin/analytics.html b/src/registrar/templates/admin/analytics.html
index ccfd54d05..fdebff22c 100644
--- a/src/registrar/templates/admin/analytics.html
+++ b/src/registrar/templates/admin/analytics.html
@@ -18,7 +18,7 @@ https://github.com/django/django/blob/main/django/contrib/admin/templates/admin/
{% block content %}
-
+ {% include "admin/analytics_graph_table.html" with data=data property_name="deleted_domains" %}
+
+
+
+
+
+
+
+
+ Details for ready domains
+
+ {% include "admin/analytics_graph_table.html" with data=data property_name="ready_domains" %}
+
+
+
-
-
-
-
-
-
-
-
+ {% comment %} Requests {% endcomment %}
+
+
+
+
+
+ Details for submitted requests
+
+ {% include "admin/analytics_graph_table.html" with data=data property_name="submitted_requests" %}
+
+
+
+
+
+
+
+
+ Details for all requests
+
+ {% include "admin/analytics_graph_table.html" with data=data property_name="requests" %}
+
+
+
+
diff --git a/src/registrar/templates/admin/analytics_graph_table.html b/src/registrar/templates/admin/analytics_graph_table.html
new file mode 100644
index 000000000..5f10da93a
--- /dev/null
+++ b/src/registrar/templates/admin/analytics_graph_table.html
@@ -0,0 +1,26 @@
+
+
+
+
Type
+
Start date {{ data.start_date }}
+
End date {{ data.end_date }}
+
+
+
+ {% comment %}
+ This ugly notation is equivalent to data.property_name.start_date_count.index.
+ Or represented in the pure python way: data[property_name]["start_date_count"][index]
+ {% endcomment %}
+ {% with start_counts=data|get_item:property_name|get_item:"start_date_count" end_counts=data|get_item:property_name|get_item:"end_date_count" %}
+ {% for org_count_type in data.org_count_types %}
+ {% with index=forloop.counter %}
+
- {% for role in member.user|portfolio_role_summary:original %}
- {{ role }}
- {% endfor %}
-
{% if member.user.email %}
diff --git a/src/registrar/templates/domain_detail.html b/src/registrar/templates/domain_detail.html
index 758c43366..57749f038 100644
--- a/src/registrar/templates/domain_detail.html
+++ b/src/registrar/templates/domain_detail.html
@@ -35,7 +35,7 @@
{# UNKNOWN domains would not have an expiration date and thus would show 'Expired' #}
{% if domain.is_expired and domain.state != domain.State.UNKNOWN %}
Expired
- {% elif has_domain_renewal_flag and domain.is_expiring %}
+ {% elif domain.is_expiring %}
Expiring soon
{% elif domain.state == domain.State.UNKNOWN or domain.state == domain.State.DNS_NEEDED %}
DNS needed
@@ -46,17 +46,17 @@
{% if domain.get_state_help_text %}
- {% if has_domain_renewal_flag and domain.is_expired and is_domain_manager %}
+ {% if domain.is_expired and is_domain_manager %}
This domain has expired, but it is still online.
{% url 'domain-renewal' pk=domain.id as url %}
Renew to maintain access.
- {% elif has_domain_renewal_flag and domain.is_expiring and is_domain_manager %}
+ {% elif domain.is_expiring and is_domain_manager %}
This domain will expire soon.
{% url 'domain-renewal' pk=domain.id as url %}
Renew to maintain access.
- {% elif has_domain_renewal_flag and domain.is_expiring and is_portfolio_user %}
+ {% elif domain.is_expiring and is_portfolio_user %}
This domain will expire soon. Contact one of the listed domain managers to renew the domain.
- {% elif has_domain_renewal_flag and domain.is_expired and is_portfolio_user %}
+ {% elif domain.is_expired and is_portfolio_user %}
This domain has expired, but it is still online. Contact one of the listed domain managers to renew the domain.
{% else %}
{{ domain.get_state_help_text }}
diff --git a/src/registrar/templates/domain_sidebar.html b/src/registrar/templates/domain_sidebar.html
index 5946b6859..3302a6a79 100644
--- a/src/registrar/templates/domain_sidebar.html
+++ b/src/registrar/templates/domain_sidebar.html
@@ -81,7 +81,7 @@
{% endwith %}
- {% if has_domain_renewal_flag and is_domain_manager%}
+ {% if is_domain_manager%}
{% if domain.is_expiring or domain.is_expired %}
{% with url_name="domain-renewal" %}
{% include "includes/domain_sidenav_item.html" with item_text="Renewal form" %}
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 ac563b549..40e5ed899 100644
--- a/src/registrar/templates/emails/action_needed_reasons/bad_name.txt
+++ b/src/registrar/templates/emails/action_needed_reasons/bad_name.txt
@@ -17,7 +17,7 @@ Domains should uniquely identify a government organization and be clear to the g
ACTION NEEDED
-First, we need you to identify a new domain name that meets our naming requirements for your type of organization. Then, log in to the registrar and update the name in your domain request. Once you submit your updated request, we’ll resume the adjudication process.
+First, we need you to identify a new domain name that meets our naming requirements for your type of organization. Then, log in to the registrar and update the name in your domain request. <{{ manage_url }}> Once you submit your updated request, we’ll resume the adjudication process.
If you have questions or want to discuss potential domain names, reply to this email.
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 ef05e17d7..40d068cd9 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
@@ -21,7 +21,7 @@ We expect a senior official to be someone in a role of significant, executive re
ACTION NEEDED
Reply to this email with a justification for naming {{ domain_request.senior_official.get_formatted_name }} as the senior official. If you have questions or comments, include those in your reply.
-Alternatively, you can log in to the registrar and enter a different senior official for this domain request. Once you submit your updated request, we’ll resume the adjudication process.
+Alternatively, you can log in to the registrar and enter a different senior official for this domain request. <{{ manage_url }}> Once you submit your updated request, we’ll resume the adjudication process.
THANK YOU
diff --git a/src/registrar/templates/emails/domain_invitation.txt b/src/registrar/templates/emails/domain_invitation.txt
index 092ff629c..837b19228 100644
--- a/src/registrar/templates/emails/domain_invitation.txt
+++ b/src/registrar/templates/emails/domain_invitation.txt
@@ -4,7 +4,7 @@ Hi,{% if requested_user and requested_user.first_name %} {{ requested_user.first
{{ requestor_email }} has invited you to manage:
{% for domain in domains %}{{ domain.name }}
{% endfor %}
-To manage domain information, visit the .gov registrar .
+To manage domain information, visit the .gov registrar <{{ manage_url }}>.
----------------------------------------------------------------
{% if not requested_user %}
diff --git a/src/registrar/templates/emails/domain_manager_notification.txt b/src/registrar/templates/emails/domain_manager_notification.txt
index c253937e4..b5096a9d8 100644
--- a/src/registrar/templates/emails/domain_manager_notification.txt
+++ b/src/registrar/templates/emails/domain_manager_notification.txt
@@ -15,7 +15,7 @@ The person who received the invitation will become a domain manager once they lo
associated with the invited email address.
If you need to cancel this invitation or remove the domain manager, you can do that by going to
-this domain in the .gov registrar .
+this domain in the .gov registrar <{{ manage_url }}>.
WHY DID YOU RECEIVE THIS EMAIL?
diff --git a/src/registrar/templates/emails/domain_request_withdrawn.txt b/src/registrar/templates/emails/domain_request_withdrawn.txt
index fbdf5b4f1..fe026027b 100644
--- a/src/registrar/templates/emails/domain_request_withdrawn.txt
+++ b/src/registrar/templates/emails/domain_request_withdrawn.txt
@@ -11,7 +11,7 @@ STATUS: Withdrawn
----------------------------------------------------------------
YOU CAN EDIT YOUR WITHDRAWN REQUEST
-You can edit and resubmit this request by signing in to the registrar .
+You can edit and resubmit this request by signing in to the registrar <{{ manage_url }}>.
SOMETHING WRONG?
diff --git a/src/registrar/templates/emails/portfolio_admin_addition_notification.txt b/src/registrar/templates/emails/portfolio_admin_addition_notification.txt
index b8953aa67..9e6da3985 100644
--- a/src/registrar/templates/emails/portfolio_admin_addition_notification.txt
+++ b/src/registrar/templates/emails/portfolio_admin_addition_notification.txt
@@ -16,7 +16,7 @@ The person who received the invitation will become an admin once they log in to
associated with the invited email address.
If you need to cancel this invitation or remove the admin, you can do that by going to
-the Members section for your organization .
+the Members section for your organization <{{ manage_url }}>.
WHY DID YOU RECEIVE THIS EMAIL?
diff --git a/src/registrar/templates/emails/portfolio_admin_removal_notification.txt b/src/registrar/templates/emails/portfolio_admin_removal_notification.txt
index 6a536aa49..bf0338c03 100644
--- a/src/registrar/templates/emails/portfolio_admin_removal_notification.txt
+++ b/src/registrar/templates/emails/portfolio_admin_removal_notification.txt
@@ -8,7 +8,7 @@ REMOVED BY: {{ requestor_email }}
REMOVED ON: {{date}}
ADMIN REMOVED: {{ removed_email_address }}
-You can view this update by going to the Members section for your .gov organization .
+You can view this update by going to the Members section for your .gov organization <{{ manage_url }}>.
----------------------------------------------------------------
diff --git a/src/registrar/templates/emails/portfolio_invitation.txt b/src/registrar/templates/emails/portfolio_invitation.txt
index 775b74c7c..893da153d 100644
--- a/src/registrar/templates/emails/portfolio_invitation.txt
+++ b/src/registrar/templates/emails/portfolio_invitation.txt
@@ -3,7 +3,7 @@ Hi.
{{ requestor_email }} has invited you to {{ portfolio.organization_name }}.
-You can view this organization on the .gov registrar .
+You can view this organization on the .gov registrar <{{ manage_url }}>.
----------------------------------------------------------------
diff --git a/src/registrar/templates/emails/portfolio_update.txt b/src/registrar/templates/emails/portfolio_update.txt
new file mode 100644
index 000000000..aa13a9fb9
--- /dev/null
+++ b/src/registrar/templates/emails/portfolio_update.txt
@@ -0,0 +1,35 @@
+{% autoescape off %}{# In a text file, we don't want to have HTML entities escaped #}
+Hi,{% if requested_user and requested_user.first_name %} {{ requested_user.first_name }}.{% endif %}
+
+Your permissions were updated in the .gov registrar.
+
+ORGANIZATION: {{ portfolio.organization_name }}
+UPDATED BY: {{ requestor_email }}
+UPDATED ON: {{ date }}
+YOUR PERMISSIONS: {{ permissions.role_display }}
+ Domains - {{ permissions.domains_display }}
+ Domain requests - {{ permissions.domain_requests_display }}
+ Members - {{ permissions.members_display }}
+
+Your updated permissions are now active in the .gov registrar .
+
+----------------------------------------------------------------
+
+SOMETHING WRONG?
+If you have questions or concerns, reach out to the person who updated your
+permissions, or reply to this email.
+
+
+THANK YOU
+.Gov helps the public identify official, trusted information. Thank you for using a .gov
+domain.
+
+----------------------------------------------------------------
+
+The .gov team
+Contact us:
+Learn about .gov
+
+The .gov registry is a part of the Cybersecurity and Infrastructure Security Agency
+(CISA)
+{% endautoescape %}
diff --git a/src/registrar/templates/emails/portfolio_update_subject.txt b/src/registrar/templates/emails/portfolio_update_subject.txt
new file mode 100644
index 000000000..2cd806a73
--- /dev/null
+++ b/src/registrar/templates/emails/portfolio_update_subject.txt
@@ -0,0 +1 @@
+Your permissions were updated in the .gov registrar
\ No newline at end of file
diff --git a/src/registrar/templates/emails/status_change_approved.txt b/src/registrar/templates/emails/status_change_approved.txt
index 821e89e42..635b36cbd 100644
--- a/src/registrar/templates/emails/status_change_approved.txt
+++ b/src/registrar/templates/emails/status_change_approved.txt
@@ -8,7 +8,7 @@ REQUESTED BY: {{ domain_request.creator.email }}
REQUEST RECEIVED ON: {{ domain_request.last_submitted_date|date }}
STATUS: Approved
-You can manage your approved domain on the .gov registrar .
+You can manage your approved domain on the .gov registrar <{{ manage_url }}>.
----------------------------------------------------------------
diff --git a/src/registrar/templates/emails/submission_confirmation.txt b/src/registrar/templates/emails/submission_confirmation.txt
index d9d01ec3e..afbde48d5 100644
--- a/src/registrar/templates/emails/submission_confirmation.txt
+++ b/src/registrar/templates/emails/submission_confirmation.txt
@@ -20,7 +20,7 @@ During our review, we’ll verify that:
- You work at the organization and/or can make requests on its behalf
- Your requested domain meets our naming requirements
{% endif %}
-We’ll email you if we have questions. We’ll also email you as soon as we complete our review. You can check the status of your request at any time on the registrar. .
+We’ll email you if we have questions. We’ll also email you as soon as we complete our review. You can check the status of your request at any time on the registrar. <{{ manage_url }}>.
NEED TO MAKE CHANGES?
diff --git a/src/registrar/templates/emails/transition_domain_invitation.txt b/src/registrar/templates/emails/transition_domain_invitation.txt
index b6773d9e9..14dd626dd 100644
--- a/src/registrar/templates/emails/transition_domain_invitation.txt
+++ b/src/registrar/templates/emails/transition_domain_invitation.txt
@@ -31,7 +31,7 @@ CHECK YOUR .GOV DOMAIN CONTACTS
This is a good time to check who has access to your .gov domain{% if domains|length > 1 %}s{% endif %}. The admin, technical, and billing contacts listed for your domain{% if domains|length > 1 %}s{% endif %} in our old system also received this email. In our new registrar, these contacts are all considered “domain managers.” We no longer have the admin, technical, and billing roles, and you aren’t limited to three domain managers like in the old system.
- 1. Once you have your Login.gov account, sign in to the new registrar at .
+ 1. Once you have your Login.gov account, sign in to the new registrar at <{{ manage_url }}>.
2. Click the “Manage” link next to your .gov domain, then click on “Domain managers” to see who has access to your domain.
3. If any of these users should not have access to your domain, let us know in a reply to this email.
@@ -57,7 +57,7 @@ THANK YOU
The .gov team
.Gov blog
-Domain management
+Domain management <{{ manage_url }}}>
Get.gov
The .gov registry is a part of the Cybersecurity and Infrastructure Security Agency (CISA)
diff --git a/src/registrar/templates/emails/update_to_approved_domain.txt b/src/registrar/templates/emails/update_to_approved_domain.txt
index 99f86ea54..070096f62 100644
--- a/src/registrar/templates/emails/update_to_approved_domain.txt
+++ b/src/registrar/templates/emails/update_to_approved_domain.txt
@@ -8,7 +8,7 @@ UPDATED BY: {{user}}
UPDATED ON: {{date}}
INFORMATION UPDATED: {{changes}}
-You can view this update in the .gov registrar .
+You can view this update in the .gov registrar <{{ manage_url }}>.
Get help with managing your .gov domain .
diff --git a/src/registrar/templates/includes/domains_table.html b/src/registrar/templates/includes/domains_table.html
index 94cb4ea6d..3cf04a830 100644
--- a/src/registrar/templates/includes/domains_table.html
+++ b/src/registrar/templates/includes/domains_table.html
@@ -9,7 +9,7 @@
{{url}}
-{% if has_domain_renewal_flag and num_expiring_domains > 0 and has_any_domains_portfolio_permission %}
+{% if num_expiring_domains > 0 and has_any_domains_portfolio_permission %}
@@ -75,7 +75,7 @@
- {% if has_domain_renewal_flag and num_expiring_domains > 0 and not portfolio %}
+ {% if num_expiring_domains > 0 and not portfolio %}