diff --git a/.ds.baseline b/.ds.baseline index 9c1dcfeb6..3a60a1545 100644 --- a/.ds.baseline +++ b/.ds.baseline @@ -161,7 +161,7 @@ "filename": "app/config.py", "hashed_secret": "577a4c667e4af8682ca431857214b3a920883efc", "is_verified": false, - "line_number": 118, + "line_number": 123, "is_secret": false } ], @@ -634,5 +634,5 @@ } ] }, - "generated_at": "2025-10-07T17:43:26Z" + "generated_at": "2025-10-14T19:37:07Z" } diff --git a/app/config.py b/app/config.py index 92aee1670..f691f7a7a 100644 --- a/app/config.py +++ b/app/config.py @@ -78,6 +78,8 @@ class Config(object): # TODO: reassign this NOTIFY_SERVICE_ID = "d6aa2c68-a2d9-4437-ab19-3ae8eb202553" + ORGANIZATION_DASHBOARD_ENABLED = getenv("ORGANIZATION_DASHBOARD_ENABLED", "False") == "True" + NOTIFY_BILLING_DETAILS = json.loads(getenv("NOTIFY_BILLING_DETAILS") or "null") or { "account_number": "98765432", "sort_code": "01-23-45", @@ -109,6 +111,9 @@ class Development(Config): ASSET_PATH = "/static/" NOTIFY_LOG_LEVEL = "DEBUG" + # Feature Flags - Enable in development for testing + ORGANIZATION_DASHBOARD_ENABLED = getenv("ORGANIZATION_DASHBOARD_ENABLED", "True") == "True" + # Buckets CSV_UPLOAD_BUCKET = _s3_credentials_from_env("CSV") LOGO_UPLOAD_BUCKET = _s3_credentials_from_env("LOGO") diff --git a/app/main/views/organizations.py b/app/main/views/organizations.py index d283af103..ac332f765 100644 --- a/app/main/views/organizations.py +++ b/app/main/views/organizations.py @@ -2,7 +2,7 @@ from collections import OrderedDict from datetime import datetime from functools import partial -from flask import flash, redirect, render_template, request, url_for +from flask import current_app, flash, redirect, render_template, request, url_for from flask_login import current_user from app import ( @@ -70,6 +70,9 @@ def add_organization(): @main.route("/organizations/", methods=["GET"]) @user_has_permissions() def organization_dashboard(org_id): + if not current_app.config.get("ORGANIZATION_DASHBOARD_ENABLED", False): + return redirect(url_for(".organization_usage", org_id=org_id)) + year, current_financial_year = requested_and_current_financial_year(request) services = current_organization.services_and_usage(financial_year=year)["services"] diff --git a/app/templates/components/org_nav.html b/app/templates/components/org_nav.html index a7a41832b..7b54f2ffb 100644 --- a/app/templates/components/org_nav.html +++ b/app/templates/components/org_nav.html @@ -1,6 +1,8 @@