remove user registration settings (#3832)
* can be re-activated through kimai.yaml
This commit is contained in:
@@ -278,13 +278,18 @@ final class SystemConfigurationController extends AbstractController
|
||||
->setType(IntegerType::class),
|
||||
]);
|
||||
|
||||
$allowRegistration = $this->systemConfiguration->find('features.user_registration');
|
||||
if ($allowRegistration === false) {
|
||||
$authentication->getConfigurationByName('user.registration')?->setEnabled(false);
|
||||
}
|
||||
|
||||
if (!$this->systemConfiguration->isSamlActive()) {
|
||||
$authentication->getConfigurationByName('user.login')->setEnabled(false);
|
||||
$authentication->getConfigurationByName('user.login')?->setEnabled(false);
|
||||
}
|
||||
|
||||
if (!$this->systemConfiguration->isPasswordResetActive()) {
|
||||
$authentication->getConfigurationByName('user.password_reset_retry_ttl')->setEnabled(false);
|
||||
$authentication->getConfigurationByName('user.password_reset_token_ttl')->setEnabled(false);
|
||||
$authentication->getConfigurationByName('user.password_reset_retry_ttl')?->setEnabled(false);
|
||||
$authentication->getConfigurationByName('user.password_reset_token_ttl')?->setEnabled(false);
|
||||
}
|
||||
|
||||
return [
|
||||
|
||||
@@ -69,19 +69,16 @@ final class AppExtension extends Extension
|
||||
}
|
||||
|
||||
// this should happen always at the end, so bundles do not mess with the base configuration
|
||||
/* @phpstan-ignore-next-line */
|
||||
if ($container->hasParameter('kimai.bundles.config')) {
|
||||
if ($container->hasParameter('kimai.bundles.config')) { // @phpstan-ignore-line
|
||||
$bundleConfig = $container->getParameter('kimai.bundles.config');
|
||||
if (!\is_array($bundleConfig)) {
|
||||
trigger_error('Invalid bundle configuration found, skipping all bundle configuration');
|
||||
} else {
|
||||
foreach ($bundleConfig as $key => $value) {
|
||||
if (\array_key_exists($key, $config)) {
|
||||
trigger_error(sprintf('Invalid bundle configuration "%s" found, skipping', $key));
|
||||
continue;
|
||||
}
|
||||
$config[$key] = $value;
|
||||
throw new \Exception('Invalid bundle configuration found, skipping all bundle configuration');
|
||||
}
|
||||
foreach ($bundleConfig as $key => $value) {
|
||||
if (\array_key_exists($key, $config)) {
|
||||
throw new \Exception(sprintf('Invalid bundle configuration "%s" found, skipping', $key));
|
||||
}
|
||||
$config[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,12 +55,32 @@ final class Configuration implements ConfigurationInterface
|
||||
->append($this->getQuickEntryNode())
|
||||
->append($this->getActivityNode())
|
||||
->append($this->getProjectNode())
|
||||
->append($this->getFeaturesNode())
|
||||
->end()
|
||||
->end();
|
||||
|
||||
return $treeBuilder;
|
||||
}
|
||||
|
||||
private function getFeaturesNode(): ArrayNodeDefinition
|
||||
{
|
||||
$builder = new TreeBuilder('features');
|
||||
/** @var ArrayNodeDefinition $node */
|
||||
$node = $builder->getRootNode();
|
||||
|
||||
$node
|
||||
->addDefaultsIfNotSet()
|
||||
->children()
|
||||
// this feature was deactivated in order to deprecate/remove it in the future, very likely not necessary for anyone
|
||||
->integerNode('user_registration')
|
||||
->defaultFalse()
|
||||
->end()
|
||||
->end()
|
||||
;
|
||||
|
||||
return $node;
|
||||
}
|
||||
|
||||
private function getQuickEntryNode(): ArrayNodeDefinition
|
||||
{
|
||||
$builder = new TreeBuilder('quick_entry');
|
||||
|
||||
Reference in New Issue
Block a user