From 7faaa566fdd4673fa7e1633355435bec966511aa Mon Sep 17 00:00:00 2001 From: Michiel Kodde Date: Tue, 14 May 2024 09:39:22 +0200 Subject: [PATCH] Remove project references to production ent enabled --- .../Command/Service/CreateServiceCommand.php | 11 ----------- .../Command/Service/EditServiceCommand.php | 11 ----------- .../Service/CreateServiceCommandHandler.php | 1 - .../Service/EditServiceCommandHandler.php | 1 - .../Application/ViewObject/Service.php | 7 ------- .../Controller/EntityCreateController.php | 6 +----- .../DashboardBundle/Controller/ServiceController.php | 1 - .../DataFixtures/ORM/WebTestFixtures.php | 2 -- .../Form/Service/CreateServiceType.php | 7 ------- .../DashboardBundle/Form/Service/EditServiceType.php | 7 ------- templates/EntityModal/addEntityModal.html.twig | 2 +- templates/Service/overview.html.twig | 10 ++-------- 12 files changed, 4 insertions(+), 62 deletions(-) diff --git a/src/Surfnet/ServiceProviderDashboard/Application/Command/Service/CreateServiceCommand.php b/src/Surfnet/ServiceProviderDashboard/Application/Command/Service/CreateServiceCommand.php index 4861d8fec..ee0bc04b5 100644 --- a/src/Surfnet/ServiceProviderDashboard/Application/Command/Service/CreateServiceCommand.php +++ b/src/Surfnet/ServiceProviderDashboard/Application/Command/Service/CreateServiceCommand.php @@ -58,7 +58,6 @@ class CreateServiceCommand implements Command */ private $institutionId; - private bool $productionEntitiesEnabled = false; private bool $privacyQuestionsEnabled = true; @@ -104,11 +103,6 @@ public function setName($name): void $this->name = $name; } - public function setProductionEntitiesEnabled(bool $enabled): void - { - $this->productionEntitiesEnabled = $enabled; - } - public function setPrivacyQuestionsEnabled(bool $privacyQuestionsEnabled): void { $this->privacyQuestionsEnabled = $privacyQuestionsEnabled; @@ -166,11 +160,6 @@ public function getName() return $this->name; } - public function isProductionEntitiesEnabled(): bool - { - return $this->productionEntitiesEnabled; - } - public function isPrivacyQuestionsEnabled(): bool { return $this->privacyQuestionsEnabled; diff --git a/src/Surfnet/ServiceProviderDashboard/Application/Command/Service/EditServiceCommand.php b/src/Surfnet/ServiceProviderDashboard/Application/Command/Service/EditServiceCommand.php index ab252b58d..e8365a614 100644 --- a/src/Surfnet/ServiceProviderDashboard/Application/Command/Service/EditServiceCommand.php +++ b/src/Surfnet/ServiceProviderDashboard/Application/Command/Service/EditServiceCommand.php @@ -42,7 +42,6 @@ public function __construct( #[SpDashboardAssert\UrnFormattedTeamName] #[Assert\NotBlank] private string $teamName, - private bool $productionEntitiesEnabled, private bool $privacyQuestionsEnabled, private bool $clientCredentialClientsEnabled, #[Assert\NotBlank] @@ -75,11 +74,6 @@ public function setName(string $name): void $this->name = $name; } - public function setProductionEntitiesEnabled(bool $enabled): void - { - $this->productionEntitiesEnabled = $enabled; - } - public function setPrivacyQuestionsEnabled(bool $privacyQuestionsEnabled): void { $this->privacyQuestionsEnabled = $privacyQuestionsEnabled; @@ -198,11 +192,6 @@ public function isPrivacyQuestionsAnswered(): ?string return $this->privacyQuestionsAnswered; } - public function isProductionEntitiesEnabled(): bool - { - return $this->productionEntitiesEnabled; - } - public function isPrivacyQuestionsEnabled(): bool { return $this->privacyQuestionsEnabled; diff --git a/src/Surfnet/ServiceProviderDashboard/Application/CommandHandler/Service/CreateServiceCommandHandler.php b/src/Surfnet/ServiceProviderDashboard/Application/CommandHandler/Service/CreateServiceCommandHandler.php index c8e15d047..e6e369ea8 100644 --- a/src/Surfnet/ServiceProviderDashboard/Application/CommandHandler/Service/CreateServiceCommandHandler.php +++ b/src/Surfnet/ServiceProviderDashboard/Application/CommandHandler/Service/CreateServiceCommandHandler.php @@ -61,7 +61,6 @@ public function handle(CreateServiceCommand $command): void $service->setName($name); $service->setGuid($command->getGuid()); $service->setTeamName($fullTeamName); - $service->setProductionEntitiesEnabled($command->isProductionEntitiesEnabled()); $service->setPrivacyQuestionsEnabled($command->isPrivacyQuestionsEnabled()); $service->setClientCredentialClientsEnabled($command->isClientCredentialClientsEnabled()); $service->setServiceType($command->getServiceType()); diff --git a/src/Surfnet/ServiceProviderDashboard/Application/CommandHandler/Service/EditServiceCommandHandler.php b/src/Surfnet/ServiceProviderDashboard/Application/CommandHandler/Service/EditServiceCommandHandler.php index 83f829d12..1452dff37 100644 --- a/src/Surfnet/ServiceProviderDashboard/Application/CommandHandler/Service/EditServiceCommandHandler.php +++ b/src/Surfnet/ServiceProviderDashboard/Application/CommandHandler/Service/EditServiceCommandHandler.php @@ -46,7 +46,6 @@ public function handle(EditServiceCommand $command): void $service->setName($command->getName()); $service->setGuid($command->getGuid()); - $service->setProductionEntitiesEnabled($command->isProductionEntitiesEnabled()); $service->setPrivacyQuestionsEnabled($command->isPrivacyQuestionsEnabled()); $service->setClientCredentialClientsEnabled($command->isClientCredentialClientsEnabled()); diff --git a/src/Surfnet/ServiceProviderDashboard/Application/ViewObject/Service.php b/src/Surfnet/ServiceProviderDashboard/Application/ViewObject/Service.php index 5443eda8b..41367f54a 100644 --- a/src/Surfnet/ServiceProviderDashboard/Application/ViewObject/Service.php +++ b/src/Surfnet/ServiceProviderDashboard/Application/ViewObject/Service.php @@ -28,7 +28,6 @@ public function __construct( private readonly bool $privacyQuestionsEnabled, private readonly EntityList $entityList, private readonly RouterInterface $router, - private readonly bool $productionEntitiesEnabled = false, ) { } @@ -40,7 +39,6 @@ public static function fromService(DomainService $service, EntityList $entityLis $service->isPrivacyQuestionsEnabled(), $entityList, $router, - $service->isProductionEntitiesEnabled() ); } @@ -73,9 +71,4 @@ public function hasTestEntities() : bool { return $this->getEntityList()->hasTestEntities(); } - - public function isProductionEntitiesEnabled(): bool - { - return $this->productionEntitiesEnabled || $this->hasTestEntities(); - } } diff --git a/src/Surfnet/ServiceProviderDashboard/Infrastructure/DashboardBundle/Controller/EntityCreateController.php b/src/Surfnet/ServiceProviderDashboard/Infrastructure/DashboardBundle/Controller/EntityCreateController.php index 6d02c2662..fae7f45f5 100644 --- a/src/Surfnet/ServiceProviderDashboard/Infrastructure/DashboardBundle/Controller/EntityCreateController.php +++ b/src/Surfnet/ServiceProviderDashboard/Infrastructure/DashboardBundle/Controller/EntityCreateController.php @@ -81,7 +81,6 @@ public function type( $entityList = $this->entityService ->getEntityListForService($service) ->sortEntitiesByEnvironment(); - $isProductionEnabled = $entityList->hasTestEntities() || $service->isProductionEntitiesEnabled(); $form = $this->createForm(CreateNewEntityType::class, $formId); $form->handleRequest($request); @@ -129,7 +128,6 @@ public function type( 'environment' => $targetEnvironment, 'inputId' => $inputId, 'protocols' => $choices, - 'productionEnabled' => $isProductionEnabled, 'entities' => $entityList->getEntities(), 'manageId' => $formId, ] @@ -156,9 +154,7 @@ public function create(Request $request, $serviceId, $targetEnvironment, $type): $hasTestEntities = $this->entityService ->getEntityListForService($service)->hasTestEntities(); - if (!$service->isProductionEntitiesEnabled() && !$hasTestEntities - && $targetEnvironment !== Constants::ENVIRONMENT_TEST - ) { + if (!$hasTestEntities && $targetEnvironment !== Constants::ENVIRONMENT_TEST) { throw $this->createAccessDeniedException( 'You do not have access to create entities without publishing to the test environment first' ); diff --git a/src/Surfnet/ServiceProviderDashboard/Infrastructure/DashboardBundle/Controller/ServiceController.php b/src/Surfnet/ServiceProviderDashboard/Infrastructure/DashboardBundle/Controller/ServiceController.php index 24bd24a0c..97ae1ef34 100644 --- a/src/Surfnet/ServiceProviderDashboard/Infrastructure/DashboardBundle/Controller/ServiceController.php +++ b/src/Surfnet/ServiceProviderDashboard/Infrastructure/DashboardBundle/Controller/ServiceController.php @@ -161,7 +161,6 @@ public function edit(Request $request, int $serviceId): RedirectResponse|Respons $service->getGuid(), $service->getName(), $service->getTeamName(), - $service->isProductionEntitiesEnabled(), $service->isPrivacyQuestionsEnabled(), $service->isClientCredentialClientsEnabled(), $service->getServiceType(), diff --git a/src/Surfnet/ServiceProviderDashboard/Infrastructure/DashboardBundle/DataFixtures/ORM/WebTestFixtures.php b/src/Surfnet/ServiceProviderDashboard/Infrastructure/DashboardBundle/DataFixtures/ORM/WebTestFixtures.php index 2b1d22c82..47fbf0660 100644 --- a/src/Surfnet/ServiceProviderDashboard/Infrastructure/DashboardBundle/DataFixtures/ORM/WebTestFixtures.php +++ b/src/Surfnet/ServiceProviderDashboard/Infrastructure/DashboardBundle/DataFixtures/ORM/WebTestFixtures.php @@ -30,11 +30,9 @@ class WebTestFixtures extends Fixture public function load(ObjectManager $manager): void { $service = $this->createService('SURFnet', 'urn:collab:group:vm.openconext.org:demo:openconext:org:surf.nl'); - $service->setProductionEntitiesEnabled(false); $manager->persist($service); $service = $this->createService('Ibuildings B.V.', 'urn:collab:group:vm.openconext.org:demo:openconext:org:ibuildings.nl'); - $service->setProductionEntitiesEnabled(true); $service->setPrivacyQuestionsEnabled(true); $service->setClientCredentialClientsEnabled(true); $manager->persist($service); diff --git a/src/Surfnet/ServiceProviderDashboard/Infrastructure/DashboardBundle/Form/Service/CreateServiceType.php b/src/Surfnet/ServiceProviderDashboard/Infrastructure/DashboardBundle/Form/Service/CreateServiceType.php index feafafba3..c2dfc8844 100644 --- a/src/Surfnet/ServiceProviderDashboard/Infrastructure/DashboardBundle/Form/Service/CreateServiceType.php +++ b/src/Surfnet/ServiceProviderDashboard/Infrastructure/DashboardBundle/Form/Service/CreateServiceType.php @@ -72,13 +72,6 @@ public function buildForm(FormBuilderInterface $builder, array $options): void 'attr' => ['class' => 'institution-id-container'], ] ) - ->add( - 'productionEntitiesEnabled', - CheckboxType::class, - [ - 'required' => false, - ] - ) ->add( 'privacyQuestionsEnabled', CheckboxType::class, diff --git a/src/Surfnet/ServiceProviderDashboard/Infrastructure/DashboardBundle/Form/Service/EditServiceType.php b/src/Surfnet/ServiceProviderDashboard/Infrastructure/DashboardBundle/Form/Service/EditServiceType.php index 3763c3df3..ac03bbcc8 100644 --- a/src/Surfnet/ServiceProviderDashboard/Infrastructure/DashboardBundle/Form/Service/EditServiceType.php +++ b/src/Surfnet/ServiceProviderDashboard/Infrastructure/DashboardBundle/Form/Service/EditServiceType.php @@ -69,13 +69,6 @@ public function buildForm(FormBuilderInterface $builder, array $options): void 'attr' => ['class' => 'institution-id-container'], ] ) - ->add( - 'productionEntitiesEnabled', - CheckboxType::class, - [ - 'required' => false, - ] - ) ->add( 'privacyQuestionsEnabled', CheckboxType::class, diff --git a/templates/EntityModal/addEntityModal.html.twig b/templates/EntityModal/addEntityModal.html.twig index bf1433da4..5a8ea2f39 100644 --- a/templates/EntityModal/addEntityModal.html.twig +++ b/templates/EntityModal/addEntityModal.html.twig @@ -7,7 +7,7 @@ {% set fieldName = manageId ~ '_environment' %}
  • {% set fieldId = manageId ~ '_prod' %} - +
  • diff --git a/templates/Service/overview.html.twig b/templates/Service/overview.html.twig index 058ec0ebd..c26a3b401 100644 --- a/templates/Service/overview.html.twig +++ b/templates/Service/overview.html.twig @@ -21,9 +21,7 @@ {% set testId = "add-for-test-" ~ shortName %} {% set productionId = "add-for-production-" ~ shortName %} - {% if service.isProductionEntitiesEnabled %} - - {% endif %} +

    {{ service.name }}

      @@ -114,7 +112,6 @@ {{ 'service.overview.entitylist.empty'|trans }} {% endif %} - {% if service.isProductionEntitiesEnabled %} - {% endif %} {# Test entities #} @@ -182,9 +178,7 @@
    - {% if service.isProductionEntitiesEnabled %} - - {% endif %} +