From 7ccff666e555b084074dc782172d4fd6c391aeaa Mon Sep 17 00:00:00 2001 From: Iqpal Mannan Date: Mon, 4 Nov 2024 13:32:28 +0000 Subject: [PATCH 01/12] Remove multi client flag from ReportController --- .../Controller/Report/ReportController.php | 82 ++++++++----------- 1 file changed, 34 insertions(+), 48 deletions(-) diff --git a/client/app/src/Controller/Report/ReportController.php b/client/app/src/Controller/Report/ReportController.php index 71c14b951d..22dd9d33ee 100755 --- a/client/app/src/Controller/Report/ReportController.php +++ b/client/app/src/Controller/Report/ReportController.php @@ -25,7 +25,6 @@ use App\Service\Client\RestClient; use App\Service\Csv\TransactionsCsvGenerator; use App\Service\File\Storage\S3Storage; -use App\Service\ParameterStoreService; use App\Service\Redirector; use App\Service\ReportSubmissionService; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; @@ -120,7 +119,7 @@ public function __construct( * * @return RedirectResponse */ - public function indexAction(Redirector $redirector, ParameterStoreService $parameterStoreService) + public function indexAction() { // Moved to ClientController::indexAction() return $this->redirectToRoute('homepage'); @@ -135,35 +134,29 @@ public function indexAction(Redirector $redirector, ParameterStoreService $param * * @return array|RedirectResponse */ - public function clientHomepageAction(Redirector $redirector, string $clientId, ParameterStoreService $parameterStoreService) + public function clientHomepageAction(Redirector $redirector, string $clientId) { // not ideal to specify both user-client and client-users, but can't fix this differently with DDPB-1711. Consider a separate call to get // due to the way $user = $this->userApi->getUserWithData(['user-clients', 'client', 'client-reports', 'report', 'status']); - $isMultiClientFeatureEnabled = $parameterStoreService->getFeatureFlag(ParameterStoreService::FLAG_MULTI_ACCOUNTS); + // redirect back to log out page if signing in with non-primary account with primary email + if (!$user->getIsPrimary()) { + $primaryEmail = $this->userApi->returnPrimaryEmail($user->getDeputyUid()); - $deputyHasMultiClients = false; + $this->addFlash('nonPrimaryRedirect', + [ + 'sentenceOne' => 'This account has been closed.', + 'sentenceTwo' => 'You can now access all of your reports in the same place from your account under', + 'primaryEmail' => $primaryEmail, + ] + ); - if ('1' == $isMultiClientFeatureEnabled) { - // redirect back to log out page if signing in with non-primary account with primary email - if (!$user->getIsPrimary()) { - $primaryEmail = $this->userApi->returnPrimaryEmail($user->getDeputyUid()); - - $this->addFlash('nonPrimaryRedirect', - [ - 'sentenceOne' => 'This account has been closed.', - 'sentenceTwo' => 'You can now access all of your reports in the same place from your account under', - 'primaryEmail' => $primaryEmail, - ] - ); - - return $this->redirectToRoute('app_logout', ['notPrimaryAccount' => true]); - } - - $deputyHasMultiClients = $this->clientApi->checkDeputyHasMultiClients($user->getDeputyUid()); + return $this->redirectToRoute('app_logout', ['notPrimaryAccount' => true]); } + $deputyHasMultiClients = $this->clientApi->checkDeputyHasMultiClients($user->getDeputyUid()); + // redirect if user has missing details or is on wrong page $route = $redirector->getCorrectRouteIfDifferent($user, 'lay_home'); if (is_string($route)) { @@ -193,26 +186,23 @@ public function clientHomepageAction(Redirector $redirector, string $clientId, P * * @return array|RedirectResponse */ - public function chooseAClientAction(Redirector $redirector, ParameterStoreService $parameterStoreService) + public function chooseAClientAction(Redirector $redirector) { $user = $this->userApi->getUserWithData(['user-clients', 'client']); - $isMultiClientFeatureEnabled = $parameterStoreService->getFeatureFlag(ParameterStoreService::FLAG_MULTI_ACCOUNTS); - - if ('1' == $isMultiClientFeatureEnabled) { - // redirect back to log out page if signing in with non-primary account with primary email - if (!$user->getIsPrimary()) { - $primaryEmail = $this->userApi->returnPrimaryEmail($user->getDeputyUid()); - - $this->addFlash('nonPrimaryRedirect', - [ - 'sentenceOne' => 'This account has been closed.', - 'sentenceTwo' => 'You can now access all of your reports in the same place from your account under', - 'primaryEmail' => $primaryEmail, - ] - ); - - return $this->redirectToRoute('app_logout', ['notPrimaryAccount' => true]); - } + + // redirect back to log out page if signing in with non-primary account with primary email + if (!$user->getIsPrimary()) { + $primaryEmail = $this->userApi->returnPrimaryEmail($user->getDeputyUid()); + + $this->addFlash('nonPrimaryRedirect', + [ + 'sentenceOne' => 'This account has been closed.', + 'sentenceTwo' => 'You can now access all of your reports in the same place from your account under', + 'primaryEmail' => $primaryEmail, + ] + ); + + return $this->redirectToRoute('app_logout', ['notPrimaryAccount' => true]); } // redirect if user has missing details or is on wrong page @@ -331,7 +321,7 @@ public function createAction(Request $request, $clientId, $action = false) * * @return RedirectResponse|Response|null */ - public function overviewAction(Redirector $redirector, $reportId, ParameterStoreService $parameterStore, Request $request) + public function overviewAction(Redirector $redirector, $reportId) { $reportJmsGroup = ['status', 'balance', 'user', 'client', 'client-reports', 'balance-state']; // redirect if user has missing details or is on wrong page @@ -377,13 +367,9 @@ public function overviewAction(Redirector $redirector, $reportId, ParameterStore $activeReport = $activeReportId ? $this->reportApi->getReportIfNotSubmitted($activeReportId, $reportJmsGroup) : null; - $isMultiClientFeatureEnabled = $parameterStore->getFeatureFlag(ParameterStoreService::FLAG_MULTI_ACCOUNTS); - - $deputyHasMultiClients = false; - - if ('1' == $isMultiClientFeatureEnabled && !$user->isDeputyOrg()) { - $deputyHasMultiClients = $this->clientApi->checkDeputyHasMultiClients($user->getDeputyUid()); - } + $deputyHasMultiClients = !$user->isDeputyOrg() && $this->clientApi->checkDeputyHasMultiClients( + $user->getDeputyUid() + ); return $this->render($template, [ 'user' => $user, From 5000d0f64718037959d613b9f25a4ada717b2047 Mon Sep 17 00:00:00 2001 From: Iqpal Mannan Date: Mon, 4 Nov 2024 14:37:55 +0000 Subject: [PATCH 02/12] Remove multi client flag from ClientController --- client/app/src/Controller/ClientController.php | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/client/app/src/Controller/ClientController.php b/client/app/src/Controller/ClientController.php index 0ade192586..23a98fd2ac 100644 --- a/client/app/src/Controller/ClientController.php +++ b/client/app/src/Controller/ClientController.php @@ -16,7 +16,6 @@ use App\Service\Client\Internal\PreRegistrationApi; use App\Service\Client\Internal\UserApi; use App\Service\Client\RestClient; -use App\Service\ParameterStoreService; use App\Service\Redirector; use Psr\Log\LoggerInterface; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; @@ -53,7 +52,7 @@ public function showAction(Redirector $redirector) * * @Template("@App/Client/show.html.twig") */ - public function showClientDetailsAction(Redirector $redirector, int $clientId, ParameterStoreService $parameterStore) + public function showClientDetailsAction(Redirector $redirector, int $clientId) { // redirect if user has missing details or is on wrong page $user = $this->userApi->getUserWithData(); @@ -66,13 +65,7 @@ public function showClientDetailsAction(Redirector $redirector, int $clientId, P $client = $this->clientApi->getById($clientId); - $isMultiClientFeatureEnabled = $parameterStore->getFeatureFlag(ParameterStoreService::FLAG_MULTI_ACCOUNTS); - - $deputyHasMultiClients = false; - - if ('1' == $isMultiClientFeatureEnabled) { - $deputyHasMultiClients = $this->clientApi->checkDeputyHasMultiClients($user->getDeputyUid()); - } + $deputyHasMultiClients = $this->clientApi->checkDeputyHasMultiClients($user->getDeputyUid()); return [ 'client' => $client, From d3f237f2ce5f29f1923d51de9c16dcb36c7a5649 Mon Sep 17 00:00:00 2001 From: Iqpal Mannan Date: Mon, 4 Nov 2024 15:44:39 +0000 Subject: [PATCH 03/12] Remove multi client flag from SettingsController --- client/app/src/Controller/SettingsController.php | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/client/app/src/Controller/SettingsController.php b/client/app/src/Controller/SettingsController.php index 0c56a97b25..11ca31c056 100644 --- a/client/app/src/Controller/SettingsController.php +++ b/client/app/src/Controller/SettingsController.php @@ -11,7 +11,6 @@ use App\Service\Logger; use App\Service\Mailer\MailFactory; use App\Service\Mailer\MailSender; -use App\Service\ParameterStoreService; use App\Service\Redirector; use App\Service\Time\DateTimeProvider; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; @@ -84,7 +83,7 @@ public function __construct( * * @Template("@App/Settings/index.html.twig") **/ - public function indexAction(Redirector $redirector, ParameterStoreService $parameterStore) + public function indexAction(Redirector $redirector) { if ($this->getUser()->isDeputyOrg()) { $user = $this->userApi->getUserWithData(['user-organisations', 'organisation']); @@ -100,15 +99,7 @@ public function indexAction(Redirector $redirector, ParameterStoreService $param return $this->redirectToRoute($route); } - $deputyHasMultiClients = false; - - if ($this->getUser()->isLayDeputy()) { - $isMultiClientFeatureEnabled = $parameterStore->getFeatureFlag(ParameterStoreService::FLAG_MULTI_ACCOUNTS); - - if ('1' == $isMultiClientFeatureEnabled) { - $deputyHasMultiClients = $this->clientApi->checkDeputyHasMultiClients($user->getDeputyUid()); - } - } + $deputyHasMultiClients = $this->getUser()->isLayDeputy() && $this->clientApi->checkDeputyHasMultiClients($user->getDeputyUid()); return ['deputyHasMultiClients' => $deputyHasMultiClients]; } From 1726bce6fbaaea3be760ae90cfd452e7d155fcda Mon Sep 17 00:00:00 2001 From: Iqpal Mannan Date: Tue, 5 Nov 2024 08:53:23 +0000 Subject: [PATCH 04/12] Remove multi client flag from Redirector --- client/app/src/Service/Redirector.php | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/client/app/src/Service/Redirector.php b/client/app/src/Service/Redirector.php index 956d8eeac1..99e22d7f29 100644 --- a/client/app/src/Service/Redirector.php +++ b/client/app/src/Service/Redirector.php @@ -48,8 +48,7 @@ public function __construct( protected RouterInterface $router, protected Session $session, protected string $env, - private ClientApi $clientApi, - private ParameterStoreService $parameterStoreService + private ClientApi $clientApi ) { } @@ -98,15 +97,13 @@ public function getFirstPageAfterLogin(SessionInterface $session) */ public function getCorrectRouteIfDifferent(User $user, $currentRoute) { - $isMultiClientFeatureEnabled = $this->parameterStoreService->getFeatureFlag(ParameterStoreService::FLAG_MULTI_ACCOUNTS); - // Check if user has multiple clients $clients = !is_null($user->getDeputyUid()) ? $this->clientApi->getAllClientsByDeputyUid($user->getDeputyUid()) : []; $multiClientDeputy = !is_null($clients) && count($clients) > 1; // Redirect to appropriate homepage if (in_array($currentRoute, ['lay_home', 'ndr_index'])) { - if ($multiClientDeputy && '1' == $isMultiClientFeatureEnabled) { + if ($multiClientDeputy) { $route = 'lay_home'; } else { $route = $user->isNdrEnabled() ? 'ndr_index' : 'lay_home'; @@ -118,7 +115,7 @@ public function getCorrectRouteIfDifferent(User $user, $currentRoute) if ($user->getIsCoDeputy()) { // already verified - shouldn't be on verification page if ('codep_verification' == $currentRoute && $user->getCoDeputyClientConfirmed()) { - if ($multiClientDeputy && '1' == $isMultiClientFeatureEnabled) { + if ($multiClientDeputy) { $route = 'lay_home'; } else { $route = $user->isNdrEnabled() ? 'ndr_index' : 'lay_home'; @@ -263,21 +260,16 @@ private function getChooseAClientHomepage(User $user, $enabledLastAccessedUrl = private function getCorrectLayHomepage() { - $isMultiClientFeatureEnabled = $this->parameterStoreService->getFeatureFlag(ParameterStoreService::FLAG_MULTI_ACCOUNTS); $user = $this->getLoggedUser(); $clients = !is_null($user->getDeputyUid()) ? $this->clientApi->getAllClientsByDeputyUid($user->getDeputyUid()) : []; $activeClientId = count($clients) > 0 ? array_values($clients)[0]->getId() : null; - if ('1' == $isMultiClientFeatureEnabled) { - if (!(null === $clients)) { - if (1 < count($clients)) { - return $this->getChooseAClientHomepage($user); - } else { - return $this->getLayDeputyHomepage($user, $activeClientId); - } + if (!(null === $clients)) { + if (1 < count($clients)) { + return $this->getChooseAClientHomepage($user); } else { - return $this->getLayDeputyHomepage($user); + return $this->getLayDeputyHomepage($user, $activeClientId); } } else { return $this->getLayDeputyHomepage($user); From d94352f623e64d6159e0f372e57722be3175a732 Mon Sep 17 00:00:00 2001 From: Iqpal Mannan Date: Tue, 5 Nov 2024 10:23:28 +0000 Subject: [PATCH 05/12] Remove multi client flag from integration tests --- .../v2/Common/BaseFeatureContext.php | 16 --------------- .../Behat/features-v2/acl/login/login.feature | 20 +++++++++---------- .../deputy/edit-client.feature | 4 ++-- 3 files changed, 12 insertions(+), 28 deletions(-) diff --git a/api/app/tests/Behat/bootstrap/v2/Common/BaseFeatureContext.php b/api/app/tests/Behat/bootstrap/v2/Common/BaseFeatureContext.php index 98ac4d329e..6b2be5bb84 100644 --- a/api/app/tests/Behat/bootstrap/v2/Common/BaseFeatureContext.php +++ b/api/app/tests/Behat/bootstrap/v2/Common/BaseFeatureContext.php @@ -613,22 +613,6 @@ public function expireDocumentFromUnSubmittedDeputyReport(string $storageReferen $this->fixtureHelper->deleteFilesFromS3($storageReference); } - /** - * @BeforeScenario @multi-feature-flag-enabled - */ - public function theMultiAccountFeatureFlagIsSetToTrue(): void - { - $this->parameterStoreService->putFeatureFlag(ParameterStoreService::FLAG_MULTI_ACCOUNTS, '1'); - } - - /** - * @AfterScenario @multi-feature-flag-enabled - */ - public function theMultiAccountFeatureFlagIsSetToFalse(): void - { - $this->parameterStoreService->putFeatureFlag(ParameterStoreService::FLAG_MULTI_ACCOUNTS, '0'); - } - /** * @BeforeScenario @lay-pfa-high-not-started-multi-client-deputy */ diff --git a/api/app/tests/Behat/features-v2/acl/login/login.feature b/api/app/tests/Behat/features-v2/acl/login/login.feature index 12618d53e4..a5a975e125 100644 --- a/api/app/tests/Behat/features-v2/acl/login/login.feature +++ b/api/app/tests/Behat/features-v2/acl/login/login.feature @@ -38,7 +38,7 @@ Feature: Users logging into the service Then the form should be valid - @multi-feature-flag-enabled @lay-pfa-high-not-started-multi-client-deputy + @lay-pfa-high-not-started-multi-client-deputy Scenario: A user tries to login to the service with their non primary account Given a Lay Deputy tries to login with their "non-primary" email address Then they get redirected back to the log in page @@ -46,7 +46,7 @@ Feature: Users logging into the service When the user tries to access their clients report overview page Then they get redirected back to the log in page - @multi-feature-flag-enabled @lay-pfa-high-not-started-multi-client-deputy + @lay-pfa-high-not-started-multi-client-deputy Scenario: A user tries to login to the service with their primary account And a Lay Deputy tries to login with their "primary" email address Then they should be on the Choose a Client homepage @@ -57,7 +57,7 @@ Feature: Users logging into the service Then they should be on the "non-primary" Client's dashboard And when they log out they shouldn't see a flash message for non primary accounts - @multi-feature-flag-enabled @lay-pfa-high-not-started-multi-client-deputy-with-ndr + @lay-pfa-high-not-started-multi-client-deputy-with-ndr Scenario: A user tries to login to the service with their primary account and has an NDR And a Lay Deputy tries to login with their "primary" email address Then they should be on the Choose a Client homepage @@ -68,14 +68,14 @@ Feature: Users logging into the service Then they should be on the "non-primary" Client's dashboard And when they log out they shouldn't see a flash message for non primary accounts - @multi-feature-flag-enabled @lay-pfa-high-not-started-multi-client-deputy + @lay-pfa-high-not-started-multi-client-deputy Scenario: A user logs in with their primary account and uses breadcrumbs to navigate client dashboard And a Lay Deputy tries to login with their "primary" email address When they choose their "primary" Client Then they should be on the "primary" Client's dashboard And the Lay deputy navigates back to the Choose a Client homepage using the breadcrumb - @multi-feature-flag-enabled @lay-pfa-high-not-started-multi-client-deputy + @lay-pfa-high-not-started-multi-client-deputy Scenario: A user logs in with their primary account and uses breadcrumbs to navigate report overview page And a Lay Deputy tries to login with their "primary" email address When they choose their "primary" Client @@ -86,13 +86,13 @@ Feature: Users logging into the service When the Lay deputy navigates to the report overview page And the Lay deputy navigates back to the Choose a Client homepage using the breadcrumb - @multi-feature-flag-enabled @lay-pfa-high-not-started-multi-client-deputy + @lay-pfa-high-not-started-multi-client-deputy Scenario: A user logs in with their primary account and uses breadcrumbs to navigate Your details page And a Lay Deputy tries to login with their "primary" email address When the Lay deputy navigates to your details page And the Lay deputy navigates back to the Choose a Client homepage using the breadcrumb - @multi-feature-flag-enabled @lay-pfa-high-not-started-multi-client-deputy + @lay-pfa-high-not-started-multi-client-deputy Scenario: A user logs in with their primary account and uses breadcrumbs to navigate Client details page And a Lay Deputy tries to login with their "primary" email address When they choose their "primary" Client @@ -105,7 +105,7 @@ Feature: Users logging into the service And the Lay Deputy navigates back to the Client dashboard using the breadcrumb Then they should be on the "primary" Client's dashboard - @multi-feature-flag-enabled @lay-pfa-high-started-multi-client-deputy-primary-client-discharged-two-active-clients + @lay-pfa-high-started-multi-client-deputy-primary-client-discharged-two-active-clients Scenario: A user logs into the service with their primary account given they're active clients are linked to their secondary accounts Given a Lay Deputy tries to login with their "primary" email address Then they should be on the Choose a Client homepage @@ -113,14 +113,14 @@ Feature: Users logging into the service When they try to access their "primary" discharged Client Then I should be redirected and denied access to continue as client not found - @multi-feature-flag-enabled @super-admin @lay-pfa-high-started-multi-client-deputy-primary-client-discharged-two-active-clients + @super-admin @lay-pfa-high-started-multi-client-deputy-primary-client-discharged-two-active-clients Scenario: A user logs into the service with their primary account given they're remaining active client is linked to their secondary account Given a super admin user accesses the admin app And they discharge the deputy from "1" secondary client(s) Then a Lay Deputy tries to login with their "primary" email address And should arrive on the client dashboard of their only active client - @multi-feature-flag-enabled @super-admin @lay-pfa-high-started-multi-client-deputy-primary-client-discharged-two-active-clients + @super-admin @lay-pfa-high-started-multi-client-deputy-primary-client-discharged-two-active-clients Scenario: A user logs into the service with their primary account given all of their clients are discharged Given a super admin user accesses the admin app And they discharge the deputy from "2" secondary client(s) diff --git a/api/app/tests/Behat/features-v2/client-management/deputy/edit-client.feature b/api/app/tests/Behat/features-v2/client-management/deputy/edit-client.feature index 96521e1731..23478c2cef 100644 --- a/api/app/tests/Behat/features-v2/client-management/deputy/edit-client.feature +++ b/api/app/tests/Behat/features-v2/client-management/deputy/edit-client.feature @@ -24,13 +24,13 @@ Feature: View client details Given I view the lay deputy your details page Then I should not see the link for client details - @multi-feature-flag-enabled @lay-pfa-high-not-started-multi-client-deputy + @lay-pfa-high-not-started-multi-client-deputy Scenario: A user does not see Client details in nav bar on choose a client homepage Given a Lay Deputy tries to login with their "primary" email address Then they should be on the Choose a Client homepage Then I should not see "Client details" - @multi-feature-flag-enabled @lay-pfa-high-not-started-multi-client-deputy + @lay-pfa-high-not-started-multi-client-deputy Scenario: A user has access to the client details page of the client they have selected Given a Lay Deputy tries to login with their "primary" email address Then they should be on the Choose a Client homepage From 3c542e1366bce18d6cf2b908777f9463229b861d Mon Sep 17 00:00:00 2001 From: Iqpal Mannan Date: Tue, 5 Nov 2024 10:55:46 +0000 Subject: [PATCH 06/12] Remove multi client flag from integration test pipeline --- .github/workflows/workflow-pull-request-path.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/workflow-pull-request-path.yml b/.github/workflows/workflow-pull-request-path.yml index ac7d172d00..6a54c41f59 100644 --- a/.github/workflows/workflow-pull-request-path.yml +++ b/.github/workflows/workflow-pull-request-path.yml @@ -248,7 +248,7 @@ jobs: account_name: development task_name: "integration_test_v2" timeout: "1200" - override: "sh,./tests/Behat/run-tests.sh,--tags,@multi-feature-flag-enabled,--profile,v2-tests-browserkit" + override: "sh,./tests/Behat/run-tests.sh,--tags,--profile,v2-tests-browserkit" secrets: inherit integration_tests_1: @@ -264,7 +264,7 @@ jobs: account_name: development task_name: "integration_test_v2" timeout: "1200" - override: "sh,./tests/Behat/run-tests-parallel.sh,--tags,@v2_reporting_1&&~multi-feature-flag-enabled,--profile,v2-tests-browserkit" + override: "sh,./tests/Behat/run-tests-parallel.sh,--tags,@v2_reporting_1,--profile,v2-tests-browserkit" secrets: inherit integration_tests_2: @@ -280,7 +280,7 @@ jobs: account_name: development task_name: "integration_test_v2" timeout: "1200" - override: "sh,./tests/Behat/run-tests-parallel.sh,--tags,@v2_reporting_2&&~multi-feature-flag-enabled,--profile,v2-tests-browserkit" + override: "sh,./tests/Behat/run-tests-parallel.sh,--tags,@v2_reporting_2,--profile,v2-tests-browserkit" secrets: inherit integration_tests_admin: @@ -296,7 +296,7 @@ jobs: account_name: development task_name: "integration_test_v2" timeout: "1200" - override: "sh,./tests/Behat/run-tests-parallel.sh,--tags,@v2_admin&&~multi-feature-flag-enabled,--profile,v2-tests-browserkit" + override: "sh,./tests/Behat/run-tests-parallel.sh,--tags,@v2_admin,--profile,v2-tests-browserkit" secrets: inherit integration_tests_sequential_1: @@ -312,7 +312,7 @@ jobs: account_name: development task_name: "integration_test_v2" timeout: "1200" - override: "sh,./tests/Behat/run-tests.sh,--tags,@v2_sequential_1&&~multi-feature-flag-enabled,--profile,v2-tests-browserkit" + override: "sh,./tests/Behat/run-tests.sh,--tags,@v2_sequential_1,--profile,v2-tests-browserkit" secrets: inherit integration_tests_sequential_2: @@ -328,7 +328,7 @@ jobs: account_name: development task_name: "integration_test_v2" timeout: "1200" - override: "sh,./tests/Behat/run-tests.sh,--tags,@v2_sequential_2&&~multi-feature-flag-enabled,--profile,v2-tests-browserkit" + override: "sh,./tests/Behat/run-tests.sh,--tags,@v2_sequential_2,--profile,v2-tests-browserkit" secrets: inherit integration_tests_sequential_3: @@ -344,7 +344,7 @@ jobs: account_name: development task_name: "integration_test_v2" timeout: "1200" - override: "sh,./tests/Behat/run-tests.sh,--tags,@v2_sequential_3&&~multi-feature-flag-enabled,--profile,v2-tests-browserkit" + override: "sh,./tests/Behat/run-tests.sh,--tags,@v2_sequential_3,--profile,v2-tests-browserkit" secrets: inherit scale_services_down: From 5ba1c65ffa98c356a819e7ff4bc71d0c507e29f7 Mon Sep 17 00:00:00 2001 From: Iqpal Mannan Date: Tue, 5 Nov 2024 12:10:43 +0000 Subject: [PATCH 07/12] Remove multi client flag from integration test pipeline part 2 --- .../workflows/workflow-pull-request-path.yml | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/.github/workflows/workflow-pull-request-path.yml b/.github/workflows/workflow-pull-request-path.yml index 6a54c41f59..bf15a84121 100644 --- a/.github/workflows/workflow-pull-request-path.yml +++ b/.github/workflows/workflow-pull-request-path.yml @@ -236,21 +236,6 @@ jobs: timeout: "900" secrets: inherit - integration_tests_sequential_multi_flag: - name: integration tests sequential multi flag - uses: ./.github/workflows/_run-task.yml - needs: - - workflow_variables - - reset_database - - scale_services_up - with: - workspace: ${{ needs.workflow_variables.outputs.build_identifier }} - account_name: development - task_name: "integration_test_v2" - timeout: "1200" - override: "sh,./tests/Behat/run-tests.sh,--tags,--profile,v2-tests-browserkit" - secrets: inherit - integration_tests_1: name: integration tests frontend 1 uses: ./.github/workflows/_run-task.yml @@ -258,7 +243,6 @@ jobs: - workflow_variables - reset_database - scale_services_up - - integration_tests_sequential_multi_flag with: workspace: ${{ needs.workflow_variables.outputs.build_identifier }} account_name: development @@ -274,7 +258,6 @@ jobs: - workflow_variables - reset_database - scale_services_up - - integration_tests_sequential_multi_flag with: workspace: ${{ needs.workflow_variables.outputs.build_identifier }} account_name: development @@ -290,7 +273,6 @@ jobs: - workflow_variables - reset_database - scale_services_up - - integration_tests_sequential_multi_flag with: workspace: ${{ needs.workflow_variables.outputs.build_identifier }} account_name: development @@ -306,7 +288,6 @@ jobs: - workflow_variables - reset_database - scale_services_up - - integration_tests_sequential_multi_flag with: workspace: ${{ needs.workflow_variables.outputs.build_identifier }} account_name: development @@ -322,7 +303,6 @@ jobs: - workflow_variables - reset_database - scale_services_up - - integration_tests_sequential_multi_flag with: workspace: ${{ needs.workflow_variables.outputs.build_identifier }} account_name: development @@ -338,7 +318,6 @@ jobs: - workflow_variables - reset_database - scale_services_up - - integration_tests_sequential_multi_flag with: workspace: ${{ needs.workflow_variables.outputs.build_identifier }} account_name: development From e63d9d4b76ff58688479b5105aa639f4b12d6301 Mon Sep 17 00:00:00 2001 From: Iqpal Mannan Date: Tue, 5 Nov 2024 13:02:52 +0000 Subject: [PATCH 08/12] Remove multi client flag from infrastructure setup --- api/app/src/Service/ParameterStoreService.php | 2 -- .../app/src/Service/ParameterStoreService.php | 5 ----- terraform/environment/region/ecs_iam_front.tf | 20 ------------------- .../region/ecs_iam_integration_tests.tf | 3 +-- 4 files changed, 1 insertion(+), 29 deletions(-) diff --git a/api/app/src/Service/ParameterStoreService.php b/api/app/src/Service/ParameterStoreService.php index 87e94b82cc..32a05e988e 100644 --- a/api/app/src/Service/ParameterStoreService.php +++ b/api/app/src/Service/ParameterStoreService.php @@ -10,8 +10,6 @@ class ParameterStoreService { public const FLAG_DOCUMENT_SYNC = 'document-sync'; - public const FLAG_MULTI_ACCOUNTS = 'multi-accounts'; - /** @var SsmClient */ private $ssmClient; diff --git a/client/app/src/Service/ParameterStoreService.php b/client/app/src/Service/ParameterStoreService.php index 4f60fb8f02..b5d5c5d306 100644 --- a/client/app/src/Service/ParameterStoreService.php +++ b/client/app/src/Service/ParameterStoreService.php @@ -10,13 +10,8 @@ class ParameterStoreService { public const PARAMETER_CHECKLIST_SYNC_ROW_LIMIT = 'checklist-sync-row-limit'; public const PARAMETER_DOCUMENT_SYNC_ROW_LIMIT = 'document-sync-row-limit'; - public const PARAMETER_DOCUMENT_SYNC_INTERVAL_MINUTES = 'document-sync-interval-minutes'; - public const FLAG_CHECKLIST_SYNC = 'checklist-sync'; public const FLAG_DOCUMENT_SYNC = 'document-sync'; - public const FLAG_PAPER_REPORTS = 'paper-reports'; - - public const FLAG_MULTI_ACCOUNTS = 'multi-accounts'; /** @var SsmClient */ private $ssmClient; diff --git a/terraform/environment/region/ecs_iam_front.tf b/terraform/environment/region/ecs_iam_front.tf index 8377e243c8..9d962b248d 100644 --- a/terraform/environment/region/ecs_iam_front.tf +++ b/terraform/environment/region/ecs_iam_front.tf @@ -81,26 +81,6 @@ resource "aws_iam_role_policy" "front_task_logs" { role = aws_iam_role.front.id } -data "aws_iam_policy_document" "front_ssm" { - statement { - sid = "AllowGetSSMParameters" - effect = "Allow" - actions = [ - "ssm:GetParameter", - "ssm:GetParameters" - ] - resources = [ - aws_ssm_parameter.flag_multi_accounts.arn - ] - } -} - -resource "aws_iam_role_policy" "front_ssm" { - name = "front-ssm.${local.environment}" - policy = data.aws_iam_policy_document.front_ssm.json - role = aws_iam_role.front.id -} - # ======= INVOKE API GATEWAY PERMISSIONS ===== resource "aws_iam_role_policy" "front_invoke_api_gateway" { name = "front-api-gw.${local.environment}" diff --git a/terraform/environment/region/ecs_iam_integration_tests.tf b/terraform/environment/region/ecs_iam_integration_tests.tf index 86dad1c9a0..f08d677840 100644 --- a/terraform/environment/region/ecs_iam_integration_tests.tf +++ b/terraform/environment/region/ecs_iam_integration_tests.tf @@ -14,8 +14,7 @@ data "aws_iam_policy_document" "integration_tests" { "ssm:GetParameters" ] resources = [ - aws_ssm_parameter.flag_document_sync.arn, - aws_ssm_parameter.flag_multi_accounts.arn + aws_ssm_parameter.flag_document_sync.arn ] } From 5a57f288b7b469f83aa78e4cebfdfafecbbb0b11 Mon Sep 17 00:00:00 2001 From: Iqpal Mannan Date: Tue, 5 Nov 2024 13:39:42 +0000 Subject: [PATCH 09/12] Remove multi client flag from infrastructure setup part 2 --- terraform/environment/region/ecs_iam_admin.tf | 6 ------ 1 file changed, 6 deletions(-) diff --git a/terraform/environment/region/ecs_iam_admin.tf b/terraform/environment/region/ecs_iam_admin.tf index 03554a635a..7a0298542e 100644 --- a/terraform/environment/region/ecs_iam_admin.tf +++ b/terraform/environment/region/ecs_iam_admin.tf @@ -50,9 +50,3 @@ resource "aws_iam_role_policy" "admin_task_logs" { policy = data.aws_iam_policy_document.ecs_task_logs.json role = aws_iam_role.admin.id } - -resource "aws_iam_role_policy" "admin_ssm" { - name = "admin-ssm.${local.environment}" - policy = data.aws_iam_policy_document.front_ssm.json - role = aws_iam_role.admin.id -} From b90260ae4d40db420f9a3d72c82dbe67cd249d63 Mon Sep 17 00:00:00 2001 From: Iqpal Mannan Date: Tue, 5 Nov 2024 14:08:51 +0000 Subject: [PATCH 10/12] Remove multi client flag from infrastructure setup part 3 --- terraform/environment/region/ecs_iam_api.tf | 3 +-- terraform/environment/region/ssm_parameters.tf | 12 ------------ 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/terraform/environment/region/ecs_iam_api.tf b/terraform/environment/region/ecs_iam_api.tf index cb6ce629dc..7ef9a5c73a 100644 --- a/terraform/environment/region/ecs_iam_api.tf +++ b/terraform/environment/region/ecs_iam_api.tf @@ -27,8 +27,7 @@ data "aws_iam_policy_document" "api_permissions" { aws_ssm_parameter.flag_document_sync.arn, aws_ssm_parameter.document_sync_row_limit.arn, aws_ssm_parameter.flag_checklist_sync.arn, - aws_ssm_parameter.checklist_sync_row_limit.arn, - aws_ssm_parameter.flag_multi_accounts.arn + aws_ssm_parameter.checklist_sync_row_limit.arn ] } diff --git a/terraform/environment/region/ssm_parameters.tf b/terraform/environment/region/ssm_parameters.tf index 4becd5236a..0c306ee1d5 100644 --- a/terraform/environment/region/ssm_parameters.tf +++ b/terraform/environment/region/ssm_parameters.tf @@ -71,15 +71,3 @@ resource "aws_ssm_parameter" "flag_paper_reports" { ignore_changes = [value] } } - -resource "aws_ssm_parameter" "flag_multi_accounts" { - name = "${local.feature_flag_prefix}multi-accounts" - type = "String" - value = "0" - - tags = var.default_tags - - lifecycle { - ignore_changes = [value] - } -} From ff4120b000c2aa336b3f659fcfde549bfc4c545c Mon Sep 17 00:00:00 2001 From: Iqpal Mannan Date: Tue, 5 Nov 2024 15:33:24 +0000 Subject: [PATCH 11/12] Remove multi client flag from localstack --- local-resources/localstack/localstack-init.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/local-resources/localstack/localstack-init.sh b/local-resources/localstack/localstack-init.sh index 7c8255f376..3f24cb6f19 100644 --- a/local-resources/localstack/localstack-init.sh +++ b/local-resources/localstack/localstack-init.sh @@ -30,7 +30,6 @@ awslocal s3api put-bucket-policy \ awslocal ssm put-parameter --name "/local/flag/checklist-sync" --value "1" --type String --overwrite awslocal ssm put-parameter --name "/local/flag/document-sync" --value "1" --type String --overwrite awslocal ssm put-parameter --name "/local/flag/paper-reports" --value "0" --type String --overwrite -awslocal ssm put-parameter --name "/local/flag/multi-accounts" --value "0" --type String --overwrite awslocal ssm put-parameter --name "/local/parameter/checklist-sync-row-limit" --value "100" --type String --overwrite awslocal ssm put-parameter --name "/local/parameter/document-sync-interval-minutes" --value "4" --type String --overwrite From 194796584b544d411c7c15befc52051d48472e7f Mon Sep 17 00:00:00 2001 From: Iqpal Mannan Date: Wed, 6 Nov 2024 09:41:17 +0000 Subject: [PATCH 12/12] Add check for Lay Deputy before checking if multi deputy --- client/app/src/Controller/ClientController.php | 2 +- client/app/src/Controller/Report/ReportController.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/app/src/Controller/ClientController.php b/client/app/src/Controller/ClientController.php index 23a98fd2ac..fbdf43efab 100644 --- a/client/app/src/Controller/ClientController.php +++ b/client/app/src/Controller/ClientController.php @@ -65,7 +65,7 @@ public function showClientDetailsAction(Redirector $redirector, int $clientId) $client = $this->clientApi->getById($clientId); - $deputyHasMultiClients = $this->clientApi->checkDeputyHasMultiClients($user->getDeputyUid()); + $deputyHasMultiClients = $this->getUser()->isLayDeputy() && $this->clientApi->checkDeputyHasMultiClients($user->getDeputyUid()); return [ 'client' => $client, diff --git a/client/app/src/Controller/Report/ReportController.php b/client/app/src/Controller/Report/ReportController.php index 22dd9d33ee..388e49442b 100755 --- a/client/app/src/Controller/Report/ReportController.php +++ b/client/app/src/Controller/Report/ReportController.php @@ -155,7 +155,7 @@ public function clientHomepageAction(Redirector $redirector, string $clientId) return $this->redirectToRoute('app_logout', ['notPrimaryAccount' => true]); } - $deputyHasMultiClients = $this->clientApi->checkDeputyHasMultiClients($user->getDeputyUid()); + $deputyHasMultiClients = $this->getUser()->isLayDeputy() && $this->clientApi->checkDeputyHasMultiClients($user->getDeputyUid()); // redirect if user has missing details or is on wrong page $route = $redirector->getCorrectRouteIfDifferent($user, 'lay_home');