Skip to content

Commit c91b89b

Browse files
authored
Merge pull request #916 from nextcloud/fix/noid/require_provisioned_account-env_mode
fix(UI): set value to the require_provisioned_account option also in env mode
2 parents 8b01f38 + 63379a1 commit c91b89b

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

lib/Settings/Admin.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,14 @@ public function getForm() {
175175
}
176176

177177
$type = $this->config->getAppValue('user_saml', 'type');
178+
179+
$generalSettings['require_provisioned_account'] = [
180+
'text' => $this->l10n->t('Only allow authentication if an account exists on some other backend (e.g. LDAP).', [$this->defaults->getName()]),
181+
'type' => 'checkbox',
182+
'global' => true,
183+
'value' => $this->config->getAppValue('user_saml', 'general-require_provisioned_account', '0')
184+
];
178185
if ($type === 'saml') {
179-
$generalSettings['require_provisioned_account'] = [
180-
'text' => $this->l10n->t('Only allow authentication if an account exists on some other backend (e.g. LDAP).', [$this->defaults->getName()]),
181-
'type' => 'checkbox',
182-
'global' => true,
183-
'value' => $this->config->getAppValue('user_saml', 'general-require_provisioned_account', '0')
184-
];
185186
$generalSettings['idp0_display_name'] = [
186187
'text' => $this->l10n->t('Optional display name of the identity provider (default: "SSO & SAML log in")'),
187188
'type' => 'line',

tests/unit/Settings/AdminTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ public function formDataProvider() {
9393
'text' => 'Only allow authentication if an account exists on some other backend (e.g. LDAP).',
9494
'type' => 'checkbox',
9595
'global' => true,
96+
'value' => '0'
9697
],
9798
'allow_multiple_user_back_ends' => [
9899
'text' => $this->l10n->t('Allow the use of multiple user back-ends (e.g. LDAP)'),
@@ -220,10 +221,10 @@ public function testGetFormWithoutType() {
220221
2 => 'Provider 2',
221222
]);
222223
$this->config
223-
->expects($this->once())
224+
->expects($this->exactly(2)) // 'type' and 'general-require_provisioned_account'
224225
->method('getAppValue')
225-
->with('user_saml', 'type')
226-
->willReturn('');
226+
->with('user_saml', $this->anything(), $this->anything())
227+
->willReturn($this->returnArgument(2));
227228

228229
$params = $this->formDataProvider();
229230
unset($params['general']['idp0_display_name']);

0 commit comments

Comments
 (0)