diff --git a/config/settings/base.py b/config/settings/base.py
index 18ae084c22..38187b2586 100644
--- a/config/settings/base.py
+++ b/config/settings/base.py
@@ -436,23 +436,6 @@
# Kept as a setting to not let User pks or Company asp_ids in clear in the code.
STATS_SIAE_USER_PK_WHITELIST = json.loads(os.getenv("STATS_SIAE_USER_PK_WHITELIST", "[]"))
STATS_SIAE_PK_WHITELIST = json.loads(os.getenv("STATS_SIAE_PK_WHITELIST", "[]"))
-STATS_CD_DEPARTMENT_WHITELIST = [
- "02",
- "13",
- "16",
- "18",
- "31",
- "37",
- "38",
- "41",
- "45",
- "48",
- "49",
- "55",
- "63",
- "93",
- "94",
-]
STATS_ACI_DEPARTMENT_WHITELIST = ["31", "84"]
# Slack notifications sent by Metabase cronjobs.
diff --git a/itou/templates/dashboard/includes/stats.html b/itou/templates/dashboard/includes/stats.html
index a6fa2c8ce3..2b3dfbae12 100644
--- a/itou/templates/dashboard/includes/stats.html
+++ b/itou/templates/dashboard/includes/stats.html
@@ -76,8 +76,6 @@
{% include "dashboard/includes/stats_new_badge.html" %}
- {% endif %}
- {% if can_view_stats_cd_whitelist %}
diff --git a/itou/www/dashboard/views.py b/itou/www/dashboard/views.py
index ce74562cc9..ad0d382477 100644
--- a/itou/www/dashboard/views.py
+++ b/itou/www/dashboard/views.py
@@ -127,7 +127,6 @@ def dashboard(request, template_name="dashboard/dashboard.html"):
"can_view_stats_siae_etp": stats_utils.can_view_stats_siae_etp(request),
"can_view_stats_siae_orga_etp": stats_utils.can_view_stats_siae_orga_etp(request),
"can_view_stats_cd": stats_utils.can_view_stats_cd(request),
- "can_view_stats_cd_whitelist": stats_utils.can_view_stats_cd_whitelist(request),
"can_view_stats_cd_aci": stats_utils.can_view_stats_cd_aci(request),
"can_view_stats_ft": stats_utils.can_view_stats_ft(request),
"can_view_stats_ph": stats_utils.can_view_stats_ph(request),
diff --git a/itou/www/stats/utils.py b/itou/www/stats/utils.py
index f2295cf57d..2667b8d572 100644
--- a/itou/www/stats/utils.py
+++ b/itou/www/stats/utils.py
@@ -92,13 +92,6 @@ def can_view_stats_cd(request):
)
-def can_view_stats_cd_whitelist(request):
- return (
- can_view_stats_cd(request)
- and request.current_organization.department in settings.STATS_CD_DEPARTMENT_WHITELIST
- )
-
-
def can_view_stats_cd_aci(request):
return (
can_view_stats_cd(request)
diff --git a/itou/www/stats/views.py b/itou/www/stats/views.py
index 8aa541a0a3..a790e15cf7 100644
--- a/itou/www/stats/views.py
+++ b/itou/www/stats/views.py
@@ -340,8 +340,6 @@ def stats_cd_iae(request):
@login_required
def stats_cd_hiring(request):
- if not utils.can_view_stats_cd_whitelist(request):
- raise PermissionDenied
context = {
"pilotage_webinar_banners": [
{
@@ -357,8 +355,6 @@ def stats_cd_hiring(request):
@login_required
def stats_cd_brsa(request):
- if not utils.can_view_stats_cd_whitelist(request):
- raise PermissionDenied
context = {
"pilotage_webinar_banners": [
{
diff --git a/tests/www/stats/test_utils.py b/tests/www/stats/test_utils.py
index ccde5ca46d..fd19737159 100644
--- a/tests/www/stats/test_utils.py
+++ b/tests/www/stats/test_utils.py
@@ -2,7 +2,7 @@
import pytest
from django.contrib.messages.middleware import MessageMiddleware
from django.contrib.sessions.middleware import SessionMiddleware
-from django.test import RequestFactory, override_settings
+from django.test import RequestFactory
from itou.common_apps.address.departments import DEPARTMENTS, REGIONS
from itou.companies.enums import CompanyKind
@@ -61,63 +61,6 @@ def test_can_view_stats_siae_aci():
assert utils.can_view_stats_dashboard_widget(request)
-@override_settings(STATS_CD_DEPARTMENT_WHITELIST=["93"])
-def test_can_view_stats_cd_whitelist():
- """
- CD as in "Conseil Départemental".
- """
- # Department outside of the whitelist cannot access.
- org = PrescriberOrganizationWithMembershipFactory(
- authorized=True, kind=PrescriberOrganizationKind.DEPT, department="01"
- )
- request = get_request(org.members.get())
- assert not utils.can_view_stats_cd_whitelist(request)
- assert utils.can_view_stats_dashboard_widget(request)
-
- # Admin prescriber of authorized CD can access.
- org = PrescriberOrganizationWithMembershipFactory(
- authorized=True, kind=PrescriberOrganizationKind.DEPT, department="93"
- )
- request = get_request(org.members.get())
- assert utils.can_view_stats_cd_whitelist(request)
- assert utils.can_view_stats_dashboard_widget(request)
-
- # Non admin prescriber can access as well.
- org = PrescriberOrganizationWithMembershipFactory(
- authorized=True,
- kind=PrescriberOrganizationKind.DEPT,
- membership__is_admin=False,
- department="93",
- )
- request = get_request(org.members.get())
- assert utils.can_view_stats_cd_whitelist(request)
- assert utils.can_view_stats_dashboard_widget(request)
-
- # Non authorized organization does not give access.
- org = PrescriberOrganizationWithMembershipFactory(
- kind=PrescriberOrganizationKind.DEPT,
- department="93",
- )
- request = get_request(org.members.get())
- assert not utils.can_view_stats_cd_whitelist(request)
- assert utils.can_view_stats_dashboard_widget(request)
-
- # Non CD organization does not give access.
- org = PrescriberOrganizationWithMembershipFactory(
- authorized=True,
- kind=PrescriberOrganizationKind.CHRS,
- department="93",
- )
- request = get_request(org.members.get())
- assert not utils.can_view_stats_cd_whitelist(request)
- assert utils.can_view_stats_dashboard_widget(request)
-
- # Prescriber without organization cannot access.
- request = get_request(PrescriberFactory())
- assert not utils.can_view_stats_cd_whitelist(request)
- assert utils.can_view_stats_dashboard_widget(request)
-
-
def test_can_view_stats_cd_aci(settings):
"""
CD as in "Conseil Départemental".
diff --git a/tests/www/stats/test_views.py b/tests/www/stats/test_views.py
index f528611459..c960cda64f 100644
--- a/tests/www/stats/test_views.py
+++ b/tests/www/stats/test_views.py
@@ -91,7 +91,6 @@ def test_stats_cd_log_visit(client, settings, view_name):
prescriber_org = PrescriberOrganizationWithMembershipFactory(kind="DEPT", authorized=True)
user = prescriber_org.members.get()
- settings.STATS_CD_DEPARTMENT_WHITELIST = [prescriber_org.department]
settings.STATS_ACI_DEPARTMENT_WHITELIST = [prescriber_org.department]
client.force_login(user)