Skip to content

Commit

Permalink
Creating a service no longer generates a teamname urn
Browse files Browse the repository at this point in the history
Prior to this change, a teamname urn would be created by sp-dashboard.
This feature has been delegated to Invite.
This change removes the code needed to create a new urn.

See #1167
  • Loading branch information
johanib committed Nov 7, 2024
1 parent dc12710 commit 01f2e93
Show file tree
Hide file tree
Showing 14 changed files with 5 additions and 167 deletions.
1 change: 0 additions & 1 deletion assets/js/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import './type_definitions.ts';
import './components/addFlashMessage.ts';
import './components/add_service.ts';
import './components/change_member_role.ts';
import './components/connection_request_widget.ts';
import './components/delete_member.ts';
Expand Down
29 changes: 0 additions & 29 deletions assets/js/components/add_service.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,6 @@ class CreateServiceCommand implements Command
#[Assert\Uuid(strict: false)]
private string $manageId;

/**
* @var string
*/
#[SpDashboardAssert\UniqueTeamName()]
#[Assert\NotBlank]
private $teamName;

/**
* @var string
*/
Expand Down Expand Up @@ -99,14 +92,6 @@ public function setGuid($guid): void
$this->guid = $guid;
}

/**
* @param string $teamName
*/
public function setTeamName($teamName): void
{
$this->teamName = $teamName;
}

/**
* @param string $name
*/
Expand Down Expand Up @@ -166,14 +151,6 @@ public function getManageId(): string
return $this->manageId;
}

/**
* @return string
*/
public function getTeamName()
{
return $this->teamName;
}

/**
* @return string
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function handle(EditServiceCommand $command): void
$service->setInstitutionId($command->getInstitutionId());
$service->setOrganizationNameEn($command->getOrganizationNameEn());
$service->setOrganizationNameNl($command->getOrganizationNameNl());
$service->setTeamName($command->getTeamName());
$service->updateTeamName($command->getTeamName());

$this->serviceRepository->isUnique($service);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,7 @@ public function setPrivacyQuestionsEnabled(bool $privacyQuestionsEnabled): void
$this->privacyQuestionsEnabled = $privacyQuestionsEnabled;
}

/**
* @param string $teamName
*/
public function setTeamName($teamName): void
public function updateTeamName(string $teamName): void
{
$this->teamName = $teamName;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private function createService(string $name, string $teamName): Service
{
$service = new Service();
$service->setName($name);
$service->setTeamName($teamName);
$service->updateTeamName($teamName);
$service->setGuid(Uuid::v4());
$service->setInstitutionId(Uuid::v4());
$service->setGuid(Uuid::v4());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,17 +128,6 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
'required' => true,
]
)
->add(
'teamName',
null,
[
'label' => 'Team identifier',
'attr' => [
'class' => 'teamName',
'readonly' => true,
],
]
)
)
->add('save', SubmitType::class, ['attr' => ['class' => 'button']]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,13 +284,6 @@ services:
tags:
- { name: validator.constraint_validator, alias: unique_entity_id }

Surfnet\ServiceProviderDashboard\Infrastructure\DashboardBundle\Validator\Constraints\UniqueTeamNameValidator:
arguments:
- '@Surfnet\ServiceProviderDashboard\Infrastructure\Teams\Client\QueryClient'
- '%env(team_prefix_group_name_context)%'
tags:
- { name: validator.constraint_validator, alias: unique_team_name }

Surfnet\ServiceProviderDashboard\Infrastructure\DashboardBundle\Validator\Constraints\ExistingTeamNameValidator:
arguments:
- '@Surfnet\ServiceProviderDashboard\Infrastructure\Teams\Client\QueryClient'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ validator.entity_id.invalid_entity_id: 'Invalid entityId.'
validator.entity_id.registry_failure: 'Failed checking registry.'
validator.entity_id.already_exists: 'Entity has already been registered.'
validator.team_name.registry_failure: 'Could not check registry for team name.'
validator.team_name.already_exists: 'Team name has already been registered.'
validator.team_name.does_not_exist: 'Team name does not exist. Please use an existing team name.'
validator.team_name.not_in_urn_format: 'Team name must be in the correct urn-format.'
validator.contact.not_valid: 'The contact information is not valid. Please fill the first name, last name, and email fields.'
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ public function test_it_can_process_a_create_service_command()

$command = new CreateServiceCommand('920392e8-a1fc-4627-acb4-b1f215e11dcd');
$command->setName($service->getName());
$command->setTeamName($service->getTeamName());
$command->setTeamManagerEmail('[email protected]');
$command->setGuid($service->getGuid());
$command->setPrivacyQuestionsEnabled($service->isPrivacyQuestionsEnabled());
Expand All @@ -118,8 +117,6 @@ public function test_it_can_process_a_create_service_command()
$command->setContractSigned($service->getContractSigned());
$command->setInstitutionId($service->getInstitutionId());

// Expect the urn that invite returns to be set as the service team name
$service->setTeamName($inviteUrn);
$this->repository->shouldReceive('save')->with(IsEqual::equalTo($service))->once();
$this->repository->shouldReceive('isUnique')->andReturn(true)->once();
$this->commandHandler->handle($command);
Expand Down Expand Up @@ -150,7 +147,6 @@ public function test_it_rejects_non_unique_create_service_command()
$this->expectException(InvalidArgumentException::class);
$command = new CreateServiceCommand('4b0e422d-d0d0-4b9e-a521-fdd1ee5d2bad');
$command->setName('Foobar');
$command->setTeamName('team-foobar');
$command->setTeamManagerEmail('[email protected]');
$command->setGuid('30dd879c-ee2f-11db-8314-0800200c9a66');
$command->setProductionEntitiesEnabled(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function test_it_can_build_sp_dashboard_metadata()
$entity = m::mock(ManageEntity::class)->makePartial();
$service = new Service();

$service->setTeamName('The A Team');
$service->updateTeamName('The A Team');

$coin = m::mock(Coin::class);
$coin->shouldReceive('getOriginalMetadataUrl')->andReturn('http://the-a-team.com/saml/metadata');
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Application/Service/LoadEntityServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function setUp(): void
$this->attributesMetadataRepository = m::mock(AttributesMetadataRepository::class);

$this->service = new Service();
$this->service->setTeamName('testteam');
$this->service->updateTeamName('testteam');

$this->copyService = new LoadEntityService(
$this->manageTestClient,
Expand Down

0 comments on commit 01f2e93

Please sign in to comment.