Skip to content

Commit 8c3d11c

Browse files
committed
Use Symfony DI for Consent factory instead of relying on old corto serviceprovider
1 parent a67d076 commit 8c3d11c

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

config/services/compat.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ services:
5050
class: EngineBlock_Corto_Model_Consent_Factory
5151
arguments:
5252
- "@engineblock.service.consent.ConsentHashService"
53+
- "@OpenConext\\EngineBlockBundle\\Configuration\\FeatureConfiguration"
5354

5455
engineblock.compat.saml2_id_generator:
5556
public: true

library/EngineBlock/Corto/Model/Consent/Factory.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*/
1818

1919
use OpenConext\EngineBlock\Service\Consent\ConsentHashServiceInterface;
20+
use OpenConext\EngineBlockBundle\Configuration\FeatureConfigurationInterface;
2021

2122
/**
2223
* @todo write a test
@@ -25,11 +26,14 @@ class EngineBlock_Corto_Model_Consent_Factory
2526
{
2627

2728
private ConsentHashServiceInterface $hashService;
29+
private FeatureConfigurationInterface $featureConfiguration;
2830

2931
public function __construct(
30-
ConsentHashServiceInterface $hashService
32+
ConsentHashServiceInterface $hashService,
33+
FeatureConfigurationInterface $featureConfiguration
3134
) {
3235
$this->hashService = $hashService;
36+
$this->featureConfiguration = $featureConfiguration;
3337
}
3438

3539
/**
@@ -42,12 +46,8 @@ public function create(
4246
): EngineBlock_Corto_Model_Consent {
4347
// If attribute manipulation was executed before consent, the NameId must be retrieved from the original response
4448
// object, in order to ensure correct 'hashed_user_id' generation.
45-
$featureConfiguration = EngineBlock_ApplicationSingleton::getInstance()
46-
->getDiContainer()
47-
->getFeatureConfiguration();
48-
49-
$amPriorToConsent = $featureConfiguration->isEnabled('eb.run_all_manipulations_prior_to_consent');
50-
$consentEnabled = $featureConfiguration->isEnabled('eb.feature_enable_consent');
49+
$amPriorToConsent = $this->featureConfiguration->isEnabled('eb.run_all_manipulations_prior_to_consent');
50+
$consentEnabled = $this->featureConfiguration->isEnabled('eb.feature_enable_consent');
5151

5252
return new EngineBlock_Corto_Model_Consent(
5353
$proxyServer->getConfig('ConsentStoreValues', true),

0 commit comments

Comments
 (0)