From: Arthur Schiwon Date: Fri, 21 Jun 2019 08:18:44 +0000 (+0200) Subject: uses "yes" and "no" for config switch over stringified numbers X-Git-Tag: v17.0.0beta1~282^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=29449f85b688deb1f103f3f67993475a040b4d80;p=nextcloud-server.git uses "yes" and "no" for config switch over stringified numbers Signed-off-by: Arthur Schiwon --- diff --git a/apps/provisioning_api/lib/Controller/UsersController.php b/apps/provisioning_api/lib/Controller/UsersController.php index 28ab99a0ee0..252db66c35e 100644 --- a/apps/provisioning_api/lib/Controller/UsersController.php +++ b/apps/provisioning_api/lib/Controller/UsersController.php @@ -237,7 +237,7 @@ class UsersController extends AUserData { $isAdmin = $this->groupManager->isAdmin($user->getUID()); $subAdminManager = $this->groupManager->getSubAdmin(); - if(empty($userid) && $this->config->getAppValue('settings', 'newUser.generateUserID', '0') === '1') { + if(empty($userid) && $this->config->getAppValue('core', 'newUser.generateUserID', 'no') === 'yes') { $userid = $this->createNewUserId(); } @@ -293,7 +293,7 @@ class UsersController extends AUserData { $generatePasswordResetToken = true; } - if ($email === '' && $this->config->getAppValue('settings', 'newUser.requireEmail', '0') === '1') { + if ($email === '' && $this->config->getAppValue('core', 'newUser.requireEmail', 'no') === 'yes') { throw new OCSException('Required email address was not provided', 110); } diff --git a/apps/provisioning_api/tests/Controller/UsersControllerTest.php b/apps/provisioning_api/tests/Controller/UsersControllerTest.php index eaee0380f78..63f9d4c376a 100644 --- a/apps/provisioning_api/tests/Controller/UsersControllerTest.php +++ b/apps/provisioning_api/tests/Controller/UsersControllerTest.php @@ -428,7 +428,7 @@ class UsersControllerTest extends TestCase { ->method('getAppValue') ->willReturnCallback(function($appid, $key, $default) { if($key === 'newUser.generateUserID') { - return true; + return 'yes'; } return null; }); @@ -483,7 +483,7 @@ class UsersControllerTest extends TestCase { ->method('getAppValue') ->willReturnCallback(function($appid, $key, $default) { if($key === 'newUser.generateUserID') { - return '1'; + return 'yes'; } return null; }); @@ -526,7 +526,7 @@ class UsersControllerTest extends TestCase { ->method('getAppValue') ->willReturnCallback(function($appid, $key, $default) { if($key === 'newUser.requireEmail') { - return '1'; + return 'yes'; } return null; }); diff --git a/settings/Controller/UsersController.php b/settings/Controller/UsersController.php index 63d729b282c..93cc040de62 100644 --- a/settings/Controller/UsersController.php +++ b/settings/Controller/UsersController.php @@ -246,8 +246,8 @@ class UsersController extends Controller { // Settings $serverData['defaultQuota'] = $defaultQuota; $serverData['canChangePassword'] = $canChangePassword; - $serverData['newUserGenerateUserID'] = $this->config->getAppValue('settings', 'newUser.generateUserID', '0') === '1'; - $serverData['newUserRequireEmail'] = $this->config->getAppValue('settings', 'newUser.requireEmail', '0') === '1'; + $serverData['newUserGenerateUserID'] = $this->config->getAppValue('core', 'newUser.generateUserID', 'no') === 'yes'; + $serverData['newUserRequireEmail'] = $this->config->getAppValue('core', 'newUser.requireEmail', 'no') === 'yes'; return new TemplateResponse('settings', 'settings-vue', ['serverData' => $serverData]); }