remove user registration settings (#3832)
* can be re-activated through kimai.yaml
This commit is contained in:
@@ -87,7 +87,7 @@
|
|||||||
"phpstan/phpstan-phpunit": "^1.0",
|
"phpstan/phpstan-phpunit": "^1.0",
|
||||||
"phpstan/phpstan-strict-rules": "^1.0",
|
"phpstan/phpstan-strict-rules": "^1.0",
|
||||||
"phpstan/phpstan-symfony": "^1.0",
|
"phpstan/phpstan-symfony": "^1.0",
|
||||||
"phpunit/phpunit": "^9.0",
|
"phpunit/phpunit": "9.5.*",
|
||||||
"symfony/browser-kit": "^6.0",
|
"symfony/browser-kit": "^6.0",
|
||||||
"symfony/css-selector": "^6.0",
|
"symfony/css-selector": "^6.0",
|
||||||
"symfony/debug-bundle": "^6.0",
|
"symfony/debug-bundle": "^6.0",
|
||||||
|
|||||||
40
composer.lock
generated
40
composer.lock
generated
@@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "11d70b2ed4a4024ab1fb5d7e9bd8e436",
|
"content-hash": "bfeea56e227232b40a907b0c514f7db2",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "bacon/bacon-qr-code",
|
"name": "bacon/bacon-qr-code",
|
||||||
@@ -10720,16 +10720,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "dama/doctrine-test-bundle",
|
"name": "dama/doctrine-test-bundle",
|
||||||
"version": "v7.2.0",
|
"version": "v7.2.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/dmaicher/doctrine-test-bundle.git",
|
"url": "https://github.com/dmaicher/doctrine-test-bundle.git",
|
||||||
"reference": "91abe52540370d596199a79eff3d823d5b81d41d"
|
"reference": "175b47153609a369117d97d36049b8a8c3b69dc1"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/dmaicher/doctrine-test-bundle/zipball/91abe52540370d596199a79eff3d823d5b81d41d",
|
"url": "https://api.github.com/repos/dmaicher/doctrine-test-bundle/zipball/175b47153609a369117d97d36049b8a8c3b69dc1",
|
||||||
"reference": "91abe52540370d596199a79eff3d823d5b81d41d",
|
"reference": "175b47153609a369117d97d36049b8a8c3b69dc1",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -10781,9 +10781,9 @@
|
|||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/dmaicher/doctrine-test-bundle/issues",
|
"issues": "https://github.com/dmaicher/doctrine-test-bundle/issues",
|
||||||
"source": "https://github.com/dmaicher/doctrine-test-bundle/tree/v7.2.0"
|
"source": "https://github.com/dmaicher/doctrine-test-bundle/tree/v7.2.1"
|
||||||
},
|
},
|
||||||
"time": "2023-02-05T09:12:26+00:00"
|
"time": "2023-02-07T10:02:27+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "doctrine/data-fixtures",
|
"name": "doctrine/data-fixtures",
|
||||||
@@ -11346,16 +11346,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpstan/phpstan",
|
"name": "phpstan/phpstan",
|
||||||
"version": "1.9.14",
|
"version": "1.9.16",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/phpstan/phpstan.git",
|
"url": "https://github.com/phpstan/phpstan.git",
|
||||||
"reference": "e5fcc96289cf737304286a9b505fbed091f02e58"
|
"reference": "922e2689bb180575d0f57de0443c431a5a698e8f"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/e5fcc96289cf737304286a9b505fbed091f02e58",
|
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/922e2689bb180575d0f57de0443c431a5a698e8f",
|
||||||
"reference": "e5fcc96289cf737304286a9b505fbed091f02e58",
|
"reference": "922e2689bb180575d0f57de0443c431a5a698e8f",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -11385,7 +11385,7 @@
|
|||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/phpstan/phpstan/issues",
|
"issues": "https://github.com/phpstan/phpstan/issues",
|
||||||
"source": "https://github.com/phpstan/phpstan/tree/1.9.14"
|
"source": "https://github.com/phpstan/phpstan/tree/1.9.16"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@@ -11401,7 +11401,7 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2023-01-19T10:47:09+00:00"
|
"time": "2023-02-07T10:42:21+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpstan/phpstan-doctrine",
|
"name": "phpstan/phpstan-doctrine",
|
||||||
@@ -11964,16 +11964,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/phpunit",
|
"name": "phpunit/phpunit",
|
||||||
"version": "9.6.3",
|
"version": "9.5.28",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||||
"reference": "e7b1615e3e887d6c719121c6d4a44b0ab9645555"
|
"reference": "954ca3113a03bf780d22f07bf055d883ee04b65e"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e7b1615e3e887d6c719121c6d4a44b0ab9645555",
|
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/954ca3113a03bf780d22f07bf055d883ee04b65e",
|
||||||
"reference": "e7b1615e3e887d6c719121c6d4a44b0ab9645555",
|
"reference": "954ca3113a03bf780d22f07bf055d883ee04b65e",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -12015,7 +12015,7 @@
|
|||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "9.6-dev"
|
"dev-master": "9.5-dev"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
@@ -12046,7 +12046,7 @@
|
|||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
||||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.3"
|
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.28"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@@ -12062,7 +12062,7 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2023-02-04T13:37:15+00:00"
|
"time": "2023-01-14T12:32:24+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "sebastian/cli-parser",
|
"name": "sebastian/cli-parser",
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ final class Version20230126002049 extends AbstractMigration
|
|||||||
$this->addSql("UPDATE kimai2_user_preferences SET `name` = 'update_browser_title' WHERE `name` = 'theme.update_browser_title'");
|
$this->addSql("UPDATE kimai2_user_preferences SET `name` = 'update_browser_title' WHERE `name` = 'theme.update_browser_title'");
|
||||||
$this->addSql("UPDATE kimai2_configuration SET `value` = '15' WHERE `name` = 'timesheet.time_increment' and `value` = '0'");
|
$this->addSql("UPDATE kimai2_configuration SET `value` = '15' WHERE `name` = 'timesheet.time_increment' and `value` = '0'");
|
||||||
$this->addSql("UPDATE kimai2_configuration SET `value` = '5' WHERE `name` = 'timesheet.time_increment' and `value` IN ('1', '2', '3', '4')");
|
$this->addSql("UPDATE kimai2_configuration SET `value` = '5' WHERE `name` = 'timesheet.time_increment' and `value` IN ('1', '2', '3', '4')");
|
||||||
|
$this->addSql("UPDATE kimai2_configuration SET `value` = '0' WHERE `name` = 'user.registration'");
|
||||||
$this->addSql("UPDATE kimai2_roles SET `name` = UPPER(`name`)");
|
$this->addSql("UPDATE kimai2_roles SET `name` = UPPER(`name`)");
|
||||||
$this->addSql("UPDATE kimai2_invoice_templates SET `renderer` = 'service-date' WHERE `renderer` = 'freelancer'");
|
$this->addSql("UPDATE kimai2_invoice_templates SET `renderer` = 'service-date' WHERE `renderer` = 'freelancer'");
|
||||||
$this->addSql("UPDATE kimai2_invoice_templates SET `renderer` = 'invoice' WHERE `renderer` = 'default'");
|
$this->addSql("UPDATE kimai2_invoice_templates SET `renderer` = 'invoice' WHERE `renderer` = 'default'");
|
||||||
|
|||||||
@@ -1590,11 +1590,6 @@ parameters:
|
|||||||
count: 1
|
count: 1
|
||||||
path: src/Controller/Security/SelfRegistrationController.php
|
path: src/Controller/Security/SelfRegistrationController.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Cannot call method setEnabled\\(\\) on App\\\\Form\\\\Model\\\\Configuration\\|null\\.$#"
|
|
||||||
count: 3
|
|
||||||
path: src/Controller/SystemConfigurationController.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Parameter \\#1 \\$value of method App\\\\Form\\\\Model\\\\Configuration\\:\\:setValue\\(\\) expects bool\\|int\\|object\\|string\\|null, bool\\|float\\|int\\|string given\\.$#"
|
message: "#^Parameter \\#1 \\$value of method App\\\\Form\\\\Model\\\\Configuration\\:\\:setValue\\(\\) expects bool\\|int\\|object\\|string\\|null, bool\\|float\\|int\\|string given\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
|||||||
@@ -278,13 +278,18 @@ final class SystemConfigurationController extends AbstractController
|
|||||||
->setType(IntegerType::class),
|
->setType(IntegerType::class),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$allowRegistration = $this->systemConfiguration->find('features.user_registration');
|
||||||
|
if ($allowRegistration === false) {
|
||||||
|
$authentication->getConfigurationByName('user.registration')?->setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
if (!$this->systemConfiguration->isSamlActive()) {
|
if (!$this->systemConfiguration->isSamlActive()) {
|
||||||
$authentication->getConfigurationByName('user.login')->setEnabled(false);
|
$authentication->getConfigurationByName('user.login')?->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->systemConfiguration->isPasswordResetActive()) {
|
if (!$this->systemConfiguration->isPasswordResetActive()) {
|
||||||
$authentication->getConfigurationByName('user.password_reset_retry_ttl')->setEnabled(false);
|
$authentication->getConfigurationByName('user.password_reset_retry_ttl')?->setEnabled(false);
|
||||||
$authentication->getConfigurationByName('user.password_reset_token_ttl')->setEnabled(false);
|
$authentication->getConfigurationByName('user.password_reset_token_ttl')?->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -69,21 +69,18 @@ final class AppExtension extends Extension
|
|||||||
}
|
}
|
||||||
|
|
||||||
// this should happen always at the end, so bundles do not mess with the base configuration
|
// 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')) { // @phpstan-ignore-line
|
||||||
if ($container->hasParameter('kimai.bundles.config')) {
|
|
||||||
$bundleConfig = $container->getParameter('kimai.bundles.config');
|
$bundleConfig = $container->getParameter('kimai.bundles.config');
|
||||||
if (!\is_array($bundleConfig)) {
|
if (!\is_array($bundleConfig)) {
|
||||||
trigger_error('Invalid bundle configuration found, skipping all bundle configuration');
|
throw new \Exception('Invalid bundle configuration found, skipping all bundle configuration');
|
||||||
} else {
|
}
|
||||||
foreach ($bundleConfig as $key => $value) {
|
foreach ($bundleConfig as $key => $value) {
|
||||||
if (\array_key_exists($key, $config)) {
|
if (\array_key_exists($key, $config)) {
|
||||||
trigger_error(sprintf('Invalid bundle configuration "%s" found, skipping', $key));
|
throw new \Exception(sprintf('Invalid bundle configuration "%s" found, skipping', $key));
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
$config[$key] = $value;
|
$config[$key] = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// cleanup for caching
|
// cleanup for caching
|
||||||
unset($config['invoice']['documents']);
|
unset($config['invoice']['documents']);
|
||||||
|
|||||||
@@ -55,12 +55,32 @@ final class Configuration implements ConfigurationInterface
|
|||||||
->append($this->getQuickEntryNode())
|
->append($this->getQuickEntryNode())
|
||||||
->append($this->getActivityNode())
|
->append($this->getActivityNode())
|
||||||
->append($this->getProjectNode())
|
->append($this->getProjectNode())
|
||||||
|
->append($this->getFeaturesNode())
|
||||||
->end()
|
->end()
|
||||||
->end();
|
->end();
|
||||||
|
|
||||||
return $treeBuilder;
|
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
|
private function getQuickEntryNode(): ArrayNodeDefinition
|
||||||
{
|
{
|
||||||
$builder = new TreeBuilder('quick_entry');
|
$builder = new TreeBuilder('quick_entry');
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ class AppExtensionTest extends TestCase
|
|||||||
|
|
||||||
public function testWithBundleConfigurationFailsOnDuplicatedKey(): void
|
public function testWithBundleConfigurationFailsOnDuplicatedKey(): void
|
||||||
{
|
{
|
||||||
$this->expectNotice();
|
$this->expectException(\Exception::class);
|
||||||
$this->expectExceptionMessage('Invalid bundle configuration "timesheet" found, skipping');
|
$this->expectExceptionMessage('Invalid bundle configuration "timesheet" found, skipping');
|
||||||
|
|
||||||
$bundleConfig = [
|
$bundleConfig = [
|
||||||
@@ -268,7 +268,7 @@ class AppExtensionTest extends TestCase
|
|||||||
|
|
||||||
public function testWithBundleConfigurationFailsOnNonArray(): void
|
public function testWithBundleConfigurationFailsOnNonArray(): void
|
||||||
{
|
{
|
||||||
$this->expectNotice();
|
$this->expectException(\Exception::class);
|
||||||
$this->expectExceptionMessage('Invalid bundle configuration found, skipping all bundle configuration');
|
$this->expectExceptionMessage('Invalid bundle configuration found, skipping all bundle configuration');
|
||||||
|
|
||||||
$container = $this->getContainer();
|
$container = $this->getContainer();
|
||||||
|
|||||||
@@ -435,6 +435,9 @@ class ConfigurationTest extends TestCase
|
|||||||
'allow_duplicate_number' => false,
|
'allow_duplicate_number' => false,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
'features' => [
|
||||||
|
'user_registration' => false,
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->assertConfig($this->getMinConfig(), $fullDefaultConfig);
|
$this->assertConfig($this->getMinConfig(), $fullDefaultConfig);
|
||||||
|
|||||||
Reference in New Issue
Block a user