diff --git a/languages/messages.en.php b/languages/messages.en.php index b516b4e9a3..b908b11682 100644 --- a/languages/messages.en.php +++ b/languages/messages.en.php @@ -254,7 +254,6 @@ 'error_attribute_validator_regex' => '\'%arg3%\' does not match the expected format of this attribute (%arg2%)', 'error_attribute_validator_not_in_definitions' => '%arg1% is not known in the schema', 'error_attribute_validator_allowed' => '\'%arg3%\' is not an allowed value for this attribute', - 'error_attribute_validator_availability' => '\'%arg3%\' is a reserved schacHomeOrganization for another Identity Provider', 'allowed_scopes' => 'Allowed scopes', 'error_unknown_requesterid_in_authnrequest' => 'Error - Unknown service', diff --git a/languages/messages.nl.php b/languages/messages.nl.php index a853e80a49..82224e0d06 100644 --- a/languages/messages.nl.php +++ b/languages/messages.nl.php @@ -252,7 +252,6 @@ 'error_attribute_validator_regex' => '\'%arg3%\' voldoet niet aan de voorwaarden voor waardes van dit attribuut (%arg2%)', 'error_attribute_validator_not_in_definitions' => '%arg1% is niet bekend in het schema', 'error_attribute_validator_allowed' => '\'%arg3%\' is geen toegestane waarde voor dit attribuut', - 'error_attribute_validator_availability' => '\'%arg3%\' is a gereserveerde SchacHomeOrganization voor een andere Identity Provider', 'allowed_scopes' => 'Toegestane scopes', 'error_unknown_requesterid_in_authnrequest' => 'Error - Deze dienst is niet geregistreerd bij %suiteName%.', diff --git a/languages/messages.pt.php b/languages/messages.pt.php index a51b78c313..ea38e65e10 100644 --- a/languages/messages.pt.php +++ b/languages/messages.pt.php @@ -246,7 +246,6 @@ 'error_attribute_validator_regex' => '\'%arg3%\' não corresponde a formato esperado deste atributo (%arg2%)', 'error_attribute_validator_not_in_definitions' => '%arg1% não é conhecido no schema', 'error_attribute_validator_allowed' => '\'%arg3%\' não é um valor permitido para este atributo', - 'error_attribute_validator_availability' => '\'%arg3%\' é um schacHomeOrganization reservado para outro Fornecedor de Identidade', 'allowed_scopes' => 'Allowed scopes', 'error_unknown_requesterid_in_authnrequest' => 'Erro - Serviço desconhecido', diff --git a/library/EngineBlock/Attributes/Validator/Availability.php b/library/EngineBlock/Attributes/Validator/Availability.php deleted file mode 100644 index ba8a6a42c7..0000000000 --- a/library/EngineBlock/Attributes/Validator/Availability.php +++ /dev/null @@ -1,72 +0,0 @@ -metadataRepository = EngineBlock_ApplicationSingleton::getInstance() - ->getDiContainer() - ->getMetadataRepository(); - } - - public function validate(array $attributes) - { - if (!$this->_options === static::AVAILABILITY_UNRESERVED) { - // @todo warn - return null; - } - - if ($this->_attributeName !== static::SCHAC_HOME_ORGANIZATION_URN) { - // @todo warn - return null; - } - - if (empty($attributes[$this->_attributeName])) { - return null; - } - - if (count($attributes[$this->_attributeName]) > 1) { - return null; - } - - $schacHomeOrganization = $attributes[$this->_attributeName][0]; - - $reservedSchacHomeOrganizations = $this->metadataRepository->findReservedSchacHomeOrganizations(); - - if (in_array($schacHomeOrganization, $reservedSchacHomeOrganizations)) { - return true; - } - - $this->_messages[] = array( - static::ERROR_ATTRIBUTE_VALIDATOR_AVAILABILITY, - $this->_attributeAlias ? $this->_attributeAlias : $this->_attributeName, - $this->_options, - $schacHomeOrganization - ); - - return false; - } -} diff --git a/src/OpenConext/EngineBlock/Metadata/MetadataRepository/CachedDoctrineMetadataRepository.php b/src/OpenConext/EngineBlock/Metadata/MetadataRepository/CachedDoctrineMetadataRepository.php index 0ebfb671b7..cc831abf83 100644 --- a/src/OpenConext/EngineBlock/Metadata/MetadataRepository/CachedDoctrineMetadataRepository.php +++ b/src/OpenConext/EngineBlock/Metadata/MetadataRepository/CachedDoctrineMetadataRepository.php @@ -199,12 +199,4 @@ public function findAllIdentityProviderEntityIds(array $scope = []) { return $this->invoke(__FUNCTION__, func_get_args()); } - - /** - * @return string[] - */ - public function findReservedSchacHomeOrganizations() - { - return $this->invoke(__FUNCTION__, func_get_args()); - } } diff --git a/src/OpenConext/EngineBlock/Metadata/MetadataRepository/DoctrineMetadataRepository.php b/src/OpenConext/EngineBlock/Metadata/MetadataRepository/DoctrineMetadataRepository.php index 8bce74e74c..e3679ed525 100644 --- a/src/OpenConext/EngineBlock/Metadata/MetadataRepository/DoctrineMetadataRepository.php +++ b/src/OpenConext/EngineBlock/Metadata/MetadataRepository/DoctrineMetadataRepository.php @@ -91,26 +91,6 @@ public function findAllIdentityProviderEntityIds(array $scope = []) return array_map(current(...), $queryBuilder->getQuery()->execute(null, AbstractQuery::HYDRATE_ARRAY)); } - /** - * Find all SchacHomeOrganizations that are reserved by Identity Providers. - * - * @return string[] - */ - public function findReservedSchacHomeOrganizations() - { - $queryBuilder = $this->idpRepository - ->createQueryBuilder('role') - ->select('role.schacHomeOrganization') - ->distinct() - ->orderBy('role.schacHomeOrganization'); - - $this->compositeFilter->toQueryBuilder($queryBuilder, $this->idpRepository->getClassName()); - - return $queryBuilder - ->getQuery() - ->execute(); - } - /** * @param array $identityProviderIds * @return array|IdentityProvider[] diff --git a/src/OpenConext/EngineBlock/Metadata/MetadataRepository/InMemoryMetadataRepository.php b/src/OpenConext/EngineBlock/Metadata/MetadataRepository/InMemoryMetadataRepository.php index 93d5c650f8..6b3a87018d 100644 --- a/src/OpenConext/EngineBlock/Metadata/MetadataRepository/InMemoryMetadataRepository.php +++ b/src/OpenConext/EngineBlock/Metadata/MetadataRepository/InMemoryMetadataRepository.php @@ -183,24 +183,6 @@ public function findAllIdentityProviderEntityIds(array $scope = []) return $entityIds; } - /** - * @return string[] - */ - public function findReservedSchacHomeOrganizations() - { - $schacHomeOrganizations = array(); - - $identityProviders = $this->findIdentityProviders(); - foreach ($identityProviders as $identityProvider) { - if (!$identityProvider->getCoins()->schacHomeOrganization()) { - continue; - } - - $schacHomeOrganizations[] = $identityProvider->getCoins()->schacHomeOrganization(); - } - return $schacHomeOrganizations; - } - /** * @param array $identityProviderEntityIds * @return array|IdentityProvider[] diff --git a/src/OpenConext/EngineBlock/Metadata/MetadataRepository/MetadataRepositoryInterface.php b/src/OpenConext/EngineBlock/Metadata/MetadataRepository/MetadataRepositoryInterface.php index df6d1be8be..053c9461fc 100644 --- a/src/OpenConext/EngineBlock/Metadata/MetadataRepository/MetadataRepositoryInterface.php +++ b/src/OpenConext/EngineBlock/Metadata/MetadataRepository/MetadataRepositoryInterface.php @@ -90,9 +90,4 @@ public function findIdentityProvidersByEntityId(array $identityProviderEntityIds * @return string[] */ public function findAllIdentityProviderEntityIds(array $scope = []); - - /** - * @return string[] - */ - public function findReservedSchacHomeOrganizations(); } diff --git a/tests/unit/OpenConext/EngineBlock/Metadata/MetadataRepository/CachedDoctrineMetadataRepositoryTest.php b/tests/unit/OpenConext/EngineBlock/Metadata/MetadataRepository/CachedDoctrineMetadataRepositoryTest.php index 7d0d667e8f..11f2c67c90 100644 --- a/tests/unit/OpenConext/EngineBlock/Metadata/MetadataRepository/CachedDoctrineMetadataRepositoryTest.php +++ b/tests/unit/OpenConext/EngineBlock/Metadata/MetadataRepository/CachedDoctrineMetadataRepositoryTest.php @@ -40,7 +40,6 @@ public function testMethodsCallsAreProxied() $doctrineRepository->shouldReceive('findIdentityProviders'); $doctrineRepository->shouldReceive('findIdentityProvidersByEntityId'); $doctrineRepository->shouldReceive('findAllIdentityProviderEntityIds'); - $doctrineRepository->shouldReceive('findReservedSchacHomeOrganizations'); $repository = new CachedDoctrineMetadataRepository($doctrineRepository); $repository->findIdentityProviderByEntityId('test'); @@ -49,7 +48,6 @@ public function testMethodsCallsAreProxied() $repository->findIdentityProviders(); $repository->findIdentityProvidersByEntityId(['test']); $repository->findAllIdentityProviderEntityIds(); - $repository->findReservedSchacHomeOrganizations(); } public function testFetchIdentityProviderThrowExceptions() diff --git a/tests/unit/OpenConext/EngineBlock/Metadata/MetadataRepository/InMemoryMetadataRepositoryTest.php b/tests/unit/OpenConext/EngineBlock/Metadata/MetadataRepository/InMemoryMetadataRepositoryTest.php index 9fe347f855..69906ca1d1 100644 --- a/tests/unit/OpenConext/EngineBlock/Metadata/MetadataRepository/InMemoryMetadataRepositoryTest.php +++ b/tests/unit/OpenConext/EngineBlock/Metadata/MetadataRepository/InMemoryMetadataRepositoryTest.php @@ -84,13 +84,6 @@ public function testFindIdentityProvider() $this->assertEquals($idp, $idps[$idp->entityId]); } - public function testFindReservedSchacHomeOrganizations() - { - $repository = $this->getFilledRepository(); - - $this->assertEquals(array('idp1.example.edu'), $repository->findReservedSchacHomeOrganizations()); - } - public function testRegisterEntities() { $repository = new InMemoryMetadataRepository(array(), array()); @@ -121,8 +114,6 @@ public function testFilterApplication() $this->assertNull($repository->findIdentityProviderByEntityId('https://idp1.example.edu')); $this->assertNull($repository->findServiceProviderByEntityId('https://sp1.example.edu')); - $this->assertEmpty($repository->findReservedSchacHomeOrganizations()); - // Make sure the filter is also applied to entity roles added after the filter has been registered. $repository->registerIdentityProvider(new IdentityProvider('https://idp4.example.edu')); $this->assertNull($repository->findIdentityProviderByEntityId('https://idp4.example.edu'));