From e0741f8f161547e5810706c38279d4deaef4344e Mon Sep 17 00:00:00 2001 From: Meewan <6198015+Meewan@users.noreply.github.com> Date: Thu, 17 Oct 2024 17:24:53 +0200 Subject: [PATCH] (PC-32501)[BO] fix: connect as when role are not properly synchronized --- api/src/pcapi/routes/backoffice/pro/blueprint.py | 2 +- api/tests/routes/backoffice/pro_test.py | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/api/src/pcapi/routes/backoffice/pro/blueprint.py b/api/src/pcapi/routes/backoffice/pro/blueprint.py index 185e0e5fbc6..4c2374010d3 100644 --- a/api/src/pcapi/routes/backoffice/pro/blueprint.py +++ b/api/src/pcapi/routes/backoffice/pro/blueprint.py @@ -290,7 +290,7 @@ def get_user_id_for_connect_as_base_query() -> BaseQuery: users_models.User.isActive.is_(True), ~users_models.User.has_admin_role, # type: ignore[operator] # pylint: disable=invalid-unary-operand-type ~users_models.User.has_anonymized_role, # type: ignore[operator] # pylint: disable=invalid-unary-operand-type - users_models.User.has_pro_role, + offerers_models.UserOfferer.isValidated, ) ) diff --git a/api/tests/routes/backoffice/pro_test.py b/api/tests/routes/backoffice/pro_test.py index d2b3cb17ab5..55624e96e3d 100644 --- a/api/tests/routes/backoffice/pro_test.py +++ b/api/tests/routes/backoffice/pro_test.py @@ -1270,7 +1270,6 @@ def test_connect_as_venue_without_active_user(self, authenticated_client): [users_models.UserRole.PRO, users_models.UserRole.ADMIN], [users_models.UserRole.ADMIN], [users_models.UserRole.PRO, users_models.UserRole.ANONYMIZED], - [], ], ) def test_connect_as_venue_without_eligible_user(self, authenticated_client, roles): @@ -1399,7 +1398,6 @@ def test_connect_as_offerer_without_active_user(self, authenticated_client): [users_models.UserRole.PRO, users_models.UserRole.ADMIN], [users_models.UserRole.ADMIN], [users_models.UserRole.PRO, users_models.UserRole.ANONYMIZED], - [], ], ) def test_connect_as_offerer_without_eligible_user(self, authenticated_client, roles): @@ -1532,7 +1530,6 @@ def test_connect_as_offer_without_active_user(self, authenticated_client): [users_models.UserRole.PRO, users_models.UserRole.ADMIN], [users_models.UserRole.ADMIN], [users_models.UserRole.PRO, users_models.UserRole.ANONYMIZED], - [], ], ) def test_connect_as_offer_without_eligible_user(self, authenticated_client, roles): @@ -1665,7 +1662,6 @@ def test_connect_as_bank_account_without_active_user(self, authenticated_client) [users_models.UserRole.PRO, users_models.UserRole.ADMIN], [users_models.UserRole.ADMIN], [users_models.UserRole.PRO, users_models.UserRole.ANONYMIZED], - [], ], ) def test_connect_as_bank_account_without_eligible_user(self, authenticated_client, roles): @@ -1800,7 +1796,6 @@ def test_connect_as_collective_offer_without_active_user(self, authenticated_cli [users_models.UserRole.PRO, users_models.UserRole.ADMIN], [users_models.UserRole.ADMIN], [users_models.UserRole.PRO, users_models.UserRole.ANONYMIZED], - [], ], ) def test_connect_as_collective_offer_without_eligible_user(self, authenticated_client, roles): @@ -1936,7 +1931,6 @@ def test_connect_as_collective_offer_template_without_active_user(self, authenti [users_models.UserRole.PRO, users_models.UserRole.ADMIN], [users_models.UserRole.ADMIN], [users_models.UserRole.PRO, users_models.UserRole.ANONYMIZED], - [], ], ) def test_connect_as_collective_offer_template_without_eligible_user(self, authenticated_client, roles):