Skip to content

Commit

Permalink
Remove project references to production ent enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
MKodde committed May 14, 2024
1 parent 216c8e4 commit 7faaa56
Show file tree
Hide file tree
Showing 12 changed files with 4 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ class CreateServiceCommand implements Command
*/
private $institutionId;

private bool $productionEntitiesEnabled = false;

private bool $privacyQuestionsEnabled = true;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -166,11 +160,6 @@ public function getName()
return $this->name;
}

public function isProductionEntitiesEnabled(): bool
{
return $this->productionEntitiesEnabled;
}

public function isPrivacyQuestionsEnabled(): bool
{
return $this->privacyQuestionsEnabled;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public function __construct(
private readonly bool $privacyQuestionsEnabled,
private readonly EntityList $entityList,
private readonly RouterInterface $router,
private readonly bool $productionEntitiesEnabled = false,
) {
}

Expand All @@ -40,7 +39,6 @@ public static function fromService(DomainService $service, EntityList $entityLis
$service->isPrivacyQuestionsEnabled(),
$entityList,
$router,
$service->isProductionEntitiesEnabled()
);
}

Expand Down Expand Up @@ -73,9 +71,4 @@ public function hasTestEntities() : bool
{
return $this->getEntityList()->hasTestEntities();
}

public function isProductionEntitiesEnabled(): bool
{
return $this->productionEntitiesEnabled || $this->hasTestEntities();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -129,7 +128,6 @@ public function type(
'environment' => $targetEnvironment,
'inputId' => $inputId,
'protocols' => $choices,
'productionEnabled' => $isProductionEnabled,
'entities' => $entityList->getEntities(),
'manageId' => $formId,
]
Expand All @@ -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'
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion templates/EntityModal/addEntityModal.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{% set fieldName = manageId ~ '_environment' %}
<li class="add-entity-field">
{% set fieldId = manageId ~ '_prod' %}
<input class="add-entity-radio" type="radio" name={{ fieldName }} id="{{ fieldId }}" value="production"{% if not productionEnabled %} disabled="disabled"{% endif %}{% if environment is same as('production') and productionEnabled %} checked="checked"{% endif %}>
<input class="add-entity-radio" type="radio" name={{ fieldName }} id="{{ fieldId }}" value="production"{% if environment is same as('production') %} checked="checked"{% endif %}>
<label class="add-entity-label" for="{{ fieldId }}">{{ 'entity.add.environment.production'|trans }}</label>
</li>
<li class="add-entity-field">
Expand Down
10 changes: 2 additions & 8 deletions templates/Service/overview.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
{% set testId = "add-for-test-" ~ shortName %}
{% set productionId = "add-for-production-" ~ shortName %}
<input type="checkbox" id="{{ testId }}" name="{{ testId }}" />
{% if service.isProductionEntitiesEnabled %}
<input type="checkbox" id="{{ productionId }}" name="{{ productionId }}" />
{% endif %}
<input type="checkbox" id="{{ productionId }}" name="{{ productionId }}" />
<div class="service-status-container">
<h2 class="service-status-title">{{ service.name }}</h2>
<ul class="service-status-title-actions">
Expand Down Expand Up @@ -114,15 +112,13 @@
<td colspan="5" class="no-entities-production">{{ 'service.overview.entitylist.empty'|trans }}</td>
</tr>
{% endif %}
{% if service.isProductionEntitiesEnabled %}
<tr class="service-status-entities-table-add-entity">
<td colspan="5">
<label for="{{ productionId }}" class="link">
{{ 'entity.list.add_to_production'|trans}}
</label>
</td>
</tr>
{% endif %}
</table>

{# Test entities #}
Expand Down Expand Up @@ -182,9 +178,7 @@
</section>
</div>
<div class="blocker">
{% if service.isProductionEntitiesEnabled %}
<div class="modal add-entity-modal" role="dialog" aria-label="{{ 'entity.list.add_to_production'|trans ~ ' for ' ~ shortName }}" data-for="{{ productionId }}">{{ render(controller('Surfnet\\ServiceProviderDashboard\\Infrastructure\\DashboardBundle\\Controller\\EntityCreateController::type', {serviceId: service.id, targetEnvironment: "production", inputId: productionId })) }}</div>
{% endif %}
<div class="modal add-entity-modal" role="dialog" aria-label="{{ 'entity.list.add_to_production'|trans ~ ' for ' ~ shortName }}" data-for="{{ productionId }}">{{ render(controller('Surfnet\\ServiceProviderDashboard\\Infrastructure\\DashboardBundle\\Controller\\EntityCreateController::type', {serviceId: service.id, targetEnvironment: "production", inputId: productionId })) }}</div>
<div class="modal add-entity-modal" role="dialog" aria-label="{{ 'entity.list.add_to_test'|trans ~ ' for ' ~ shortName }}" data-for="{{ testId }}">{{ render(controller('Surfnet\\ServiceProviderDashboard\\Infrastructure\\DashboardBundle\\Controller\\EntityCreateController::type', {serviceId: service.id, targetEnvironment: "test", inputId: testId})) }}</div>
</div>
<p class="service-status-back-to-top">
Expand Down

0 comments on commit 7faaa56

Please sign in to comment.