88
99namespace Ibexa \Bundle \Core \DependencyInjection \Configuration \Parser \Repository ;
1010
11- use Ibexa \Bundle \Core \DependencyInjection \Configuration \AbstractParser ;
1211use Ibexa \Bundle \Core \DependencyInjection \Configuration \RepositoryConfigParserInterface ;
13- use Ibexa \Bundle \Core \DependencyInjection \Configuration \SiteAccessAware \ContextualizerInterface ;
1412use Ibexa \Contracts \Core \Repository \Values \User \User ;
1513use Symfony \Component \Config \Definition \Builder \NodeBuilder ;
1614
2927 * update_type_on_change: false
3028 * ```
3129 */
32- final class PasswordHash extends AbstractParser implements RepositoryConfigParserInterface
30+ final class PasswordHash implements RepositoryConfigParserInterface
3331{
3432 public function addSemanticConfig (NodeBuilder $ nodeBuilder ): void
3533 {
@@ -40,6 +38,7 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder): void
4038 ->integerNode ('default_type ' )
4139 ->info ('Default password hash type, see the constants in Ibexa\Contracts\Core\Repository\Values\User\User. ' )
4240 ->example ('!php/const:Ibexa\Contracts\Core\Repository\Values\User\User::PASSWORD_HASH_PHP_DEFAULT ' )
41+ ->defaultValue (User::PASSWORD_HASH_PHP_DEFAULT )
4342 ->validate ()
4443 ->ifTrue (static function ($ value ): bool {
4544 $ hashType = (int ) $ value ;
@@ -58,26 +57,9 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder): void
5857 ->booleanNode ('update_type_on_change ' )
5958 ->info ('Whether the password hash type should be changed when the password is changed if it differs from the default type. ' )
6059 ->example ('false ' )
60+ ->defaultFalse ()
6161 ->end ()
6262 ->end ()
6363 ->end ();
6464 }
65-
66- /**
67- * @param array<string, mixed> $scopeSettings
68- */
69- public function mapConfig (array &$ scopeSettings , $ currentScope , ContextualizerInterface $ contextualizer ): void
70- {
71- if (!isset ($ scopeSettings ['password_hash ' ])) {
72- return ;
73- }
74-
75- $ settings = $ scopeSettings ['password_hash ' ];
76- if (isset ($ settings ['default_type ' ])) {
77- $ contextualizer ->setContextualParameter ('password_hash.default_type ' , $ currentScope , $ settings ['default_type ' ]);
78- }
79- if (isset ($ settings ['update_type_on_change ' ])) {
80- $ contextualizer ->setContextualParameter ('password_hash.update_type_on_change ' , $ currentScope , $ settings ['update_type_on_change ' ]);
81- }
82- }
8365}
0 commit comments