diff --git a/assets/js/components/mock/service_create_form.html b/assets/js/components/mock/service_create_form.html index 9ec105c3f..5041f1cb4 100644 --- a/assets/js/components/mock/service_create_form.html +++ b/assets/js/components/mock/service_create_form.html @@ -20,12 +20,6 @@

General

-
-

- -

diff --git a/assets/js/components/mock/service_edit_form.html b/assets/js/components/mock/service_edit_form.html index 6c9fe9756..32b00aac9 100644 --- a/assets/js/components/mock/service_edit_form.html +++ b/assets/js/components/mock/service_edit_form.html @@ -23,12 +23,6 @@

General

-
-

- -

diff --git a/ci/qa/phpstan-baseline.php b/ci/qa/phpstan-baseline.php index 3fb5b6365..b58dcffb2 100644 --- a/ci/qa/phpstan-baseline.php +++ b/ci/qa/phpstan-baseline.php @@ -306,16 +306,6 @@ 'count' => 1, 'path' => __DIR__ . '/../../src/Surfnet/ServiceProviderDashboard/Application/Command/PrivacyQuestions/PrivacyQuestionsCommand.php', ]; -$ignoreErrors[] = [ - 'message' => '#^PHPDoc tag @param for parameter \\$privacyQuestionsAnswered with type bool is incompatible with native type string\\|null\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/ServiceProviderDashboard/Application/Command/Service/EditServiceCommand.php', -]; -$ignoreErrors[] = [ - 'message' => '#^PHPDoc tag @return with type bool is incompatible with native type string\\|null\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/ServiceProviderDashboard/Application/Command/Service/EditServiceCommand.php', -]; $ignoreErrors[] = [ 'message' => '#^Call to an undefined method Symfony\\\\Component\\\\HttpFoundation\\\\Session\\\\SessionInterface\\:\\:getFlashBag\\(\\)\\.$#', 'count' => 3, @@ -3446,11 +3436,6 @@ 'count' => 1, 'path' => __DIR__ . '/../../src/Surfnet/ServiceProviderDashboard/Infrastructure/DashboardBundle/Controller/ServiceController.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Parameter \\#12 \\$privacyQuestionsAnswered of class Surfnet\\\\ServiceProviderDashboard\\\\Application\\\\Command\\\\Service\\\\EditServiceCommand constructor expects string\\|null, bool given\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/../../src/Surfnet/ServiceProviderDashboard/Infrastructure/DashboardBundle/Controller/ServiceController.php', -]; $ignoreErrors[] = [ 'message' => '#^Call to an undefined method Symfony\\\\Component\\\\HttpFoundation\\\\Session\\\\SessionInterface\\:\\:getFlashBag\\(\\)\\.$#', 'count' => 1, diff --git a/composer.json b/composer.json index 343bb6e0c..9e910764b 100644 --- a/composer.json +++ b/composer.json @@ -30,9 +30,7 @@ "ext-mbstring": "*", "ext-openssl": "*", "ext-simplexml": "*", - "ext-soap": "*", "ext-xml": "*", - "ext-zip": "*", "cweagans/composer-patches": "^1.7", "doctrine/doctrine-bundle": "^2.1.2", "doctrine/doctrine-migrations-bundle": "^3.2", diff --git a/composer.lock b/composer.lock index 4e68ef94b..efdedb621 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "57b7b2ae411df5f2b6e8edc3b72e602e", + "content-hash": "5e13d80c447bd7111a618bd48ba7a5b7", "packages": [ { "name": "behat/transliterator", @@ -12818,9 +12818,7 @@ "ext-mbstring": "*", "ext-openssl": "*", "ext-simplexml": "*", - "ext-soap": "*", - "ext-xml": "*", - "ext-zip": "*" + "ext-xml": "*" }, "platform-dev": [], "platform-overrides": { diff --git a/migrations/Version20240514071702.php b/migrations/Version20240514071702.php new file mode 100644 index 000000000..7dc3e48c9 --- /dev/null +++ b/migrations/Version20240514071702.php @@ -0,0 +1,31 @@ +addSql('ALTER TABLE service DROP production_entities_enabled'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE service ADD production_entities_enabled TINYINT(1) NOT NULL'); + } +} 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..0044897a9 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] @@ -51,7 +50,7 @@ public function __construct( private ?string $intakeStatus, private ?string $contractSigned, private ?string $surfconextRepresentativeApproved, - private ?string $privacyQuestionsAnswered, + private bool $privacyQuestionsAnswered, private ?string $institutionId, #[Assert\NotBlank] private ?string $organizationNameNl, @@ -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; @@ -122,10 +116,7 @@ public function setSurfconextRepresentativeApproved(?string $surfconextRepresent $this->surfconextRepresentativeApproved = $surfconextRepresentativeApproved; } - /** - * @param bool $privacyQuestionsAnswered - */ - public function setPrivacyQuestionsAnswered(?string $privacyQuestionsAnswered): void + public function setPrivacyQuestionsAnswered(bool $privacyQuestionsAnswered): void { $this->privacyQuestionsAnswered = $privacyQuestionsAnswered; } @@ -193,16 +184,11 @@ public function getSurfconextRepresentativeApproved(): ?string /** * @return bool */ - public function isPrivacyQuestionsAnswered(): ?string + public function isPrivacyQuestionsAnswered(): bool { 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/Domain/Entity/Service.php b/src/Surfnet/ServiceProviderDashboard/Domain/Entity/Service.php index 3dc698229..908fe41cf 100644 --- a/src/Surfnet/ServiceProviderDashboard/Domain/Entity/Service.php +++ b/src/Surfnet/ServiceProviderDashboard/Domain/Entity/Service.php @@ -21,12 +21,9 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -use Surfnet\ServiceProviderDashboard\Domain\Entity\PrivacyQuestions; use Surfnet\ServiceProviderDashboard\Infrastructure\DashboardBundle\Repository\ServiceRepository; /** - * @package Surfnet\ServiceProviderDashboard\Entity - * * @SuppressWarnings(PHPMD.TooManyFields) */ #[ORM\Entity(repositoryClass: ServiceRepository::class)] @@ -84,9 +81,6 @@ class Service #[ORM\Column(length: 255)] private $teamName; - #[ORM\Column(type: 'boolean')] - private bool $productionEntitiesEnabled = false; - #[ORM\Column(type: 'boolean')] private bool $privacyQuestionsEnabled = true; @@ -190,11 +184,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; @@ -221,11 +210,6 @@ public function setPrivacyQuestions(PrivacyQuestions $privacyQuestions): void $this->privacyQuestions = $privacyQuestions; } - public function isProductionEntitiesEnabled(): bool - { - return $this->productionEntitiesEnabled; - } - public function isPrivacyQuestionsEnabled(): bool { return $this->privacyQuestionsEnabled; 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 %} +

    diff --git a/tests/integration/Application/CommandHandler/Service/CreateServiceCommandHandlerTest.php b/tests/integration/Application/CommandHandler/Service/CreateServiceCommandHandlerTest.php index 46f0cc80f..1ad84e501 100644 --- a/tests/integration/Application/CommandHandler/Service/CreateServiceCommandHandlerTest.php +++ b/tests/integration/Application/CommandHandler/Service/CreateServiceCommandHandlerTest.php @@ -80,7 +80,6 @@ public function test_it_can_process_a_create_service_command() $service->setTeamName('team-foobar'); $service->setGuid('30dd879c-ee2f-11db-8314-0800200c9a66'); $service->setPrivacyQuestionsEnabled(true); - $service->setProductionEntitiesEnabled(true); $service->setServiceType('institution'); $service->setIntakeStatus('yes'); @@ -95,7 +94,6 @@ public function test_it_can_process_a_create_service_command() $command->setTeamManagerEmail('tiffany@aching.do'); $command->setGuid($service->getGuid()); $command->setPrivacyQuestionsEnabled($service->isPrivacyQuestionsEnabled()); - $command->setProductionEntitiesEnabled($service->isProductionEntitiesEnabled()); $command->setOrganizationNameEn($service->getOrganizationNameEn()); $command->setOrganizationNameNl($service->getOrganizationNameNl()); $command->setServiceType($service->getServiceType()); @@ -128,7 +126,6 @@ public function test_it_rejects_non_unique_create_service_command() $command->setTeamName('team-foobar'); $command->setTeamManagerEmail('tiffany@aching.do'); $command->setGuid('30dd879c-ee2f-11db-8314-0800200c9a66'); - $command->setProductionEntitiesEnabled(true); $command->setPrivacyQuestionsEnabled(false); $command->setServiceType('institution'); diff --git a/tests/integration/Application/CommandHandler/Service/EditServiceCommandHandlerTest.php b/tests/integration/Application/CommandHandler/Service/EditServiceCommandHandlerTest.php index ff94d300b..7413d35ac 100644 --- a/tests/integration/Application/CommandHandler/Service/EditServiceCommandHandlerTest.php +++ b/tests/integration/Application/CommandHandler/Service/EditServiceCommandHandlerTest.php @@ -53,7 +53,6 @@ public function test_it_can_process_an_edit_service_command() 'Foobar', 'team-foobar', false, - false, true, 'institution', 'not-applicable', @@ -62,15 +61,14 @@ public function test_it_can_process_an_edit_service_command() true, '123', 'Foobar Inc', - 'Foobar Inc' + 'Foobar Inc', ); $command->setName('Foobar'); $command->setTeamName('team-foobar'); $command->setGuid('30dd879c-ee2f-11db-8314-0800200c9a66'); $command->setPrivacyQuestionsEnabled(false); - $command->setProductionEntitiesEnabled(false); - $command->setPrivacyQuestionsAnswered('yes'); + $command->setPrivacyQuestionsAnswered(true); $command->setServiceType('institution'); $command->setIntakeStatus('not-applicable'); $command->setSurfconextRepresentativeApproved('no'); @@ -81,12 +79,11 @@ public function test_it_can_process_an_edit_service_command() $this->repository ->shouldReceive('save') - ->with(m::on(function ($arg) { + ->with(m::on(function (Service $arg) { $this->assertEquals(1, $arg->getId()); $this->assertEquals('Foobar', $arg->getName()); $this->assertEquals('team-foobar', $arg->getTeamName()); $this->assertEquals('30dd879c-ee2f-11db-8314-0800200c9a66', $arg->getGuid()); - $this->assertEquals(false, $arg->isPrivacyQuestionsEnabled()); $this->assertEquals('no', $arg->getContractSigned()); $this->assertEquals('no', $arg->getSurfconextRepresentativeApproved()); $this->assertEquals('not-applicable', $arg->getIntakeStatus()); @@ -125,8 +122,6 @@ public function test_it_rejects_non_existing_service() '123', 'Foobar Inc', 'Foobar Inc', - 'Foobar Inc', - 'Foobar Inc' ); $this->repository->shouldReceive('findById')->andReturn(null)->once(); @@ -156,8 +151,6 @@ public function test_it_rejects_non_unique_edit_service_command() '123', 'Foobar Inc', 'Foobar Inc', - 'Foobar Inc', - 'Foobar Inc' ); $mockEntity = m::mock(Service::class)->makePartial();