Skip to content

Commit

Permalink
Merge pull request #916 from nextcloud/fix/noid/require_provisioned_a…
Browse files Browse the repository at this point in the history
…ccount-env_mode

fix(UI): set value to the require_provisioned_account option also in env mode
  • Loading branch information
blizzz authored Jan 30, 2025
2 parents 8b01f38 + 63379a1 commit c91b89b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
13 changes: 7 additions & 6 deletions lib/Settings/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,14 @@ public function getForm() {
}

$type = $this->config->getAppValue('user_saml', 'type');

$generalSettings['require_provisioned_account'] = [
'text' => $this->l10n->t('Only allow authentication if an account exists on some other backend (e.g. LDAP).', [$this->defaults->getName()]),
'type' => 'checkbox',
'global' => true,
'value' => $this->config->getAppValue('user_saml', 'general-require_provisioned_account', '0')
];
if ($type === 'saml') {
$generalSettings['require_provisioned_account'] = [
'text' => $this->l10n->t('Only allow authentication if an account exists on some other backend (e.g. LDAP).', [$this->defaults->getName()]),
'type' => 'checkbox',
'global' => true,
'value' => $this->config->getAppValue('user_saml', 'general-require_provisioned_account', '0')
];
$generalSettings['idp0_display_name'] = [
'text' => $this->l10n->t('Optional display name of the identity provider (default: "SSO & SAML log in")'),
'type' => 'line',
Expand Down
7 changes: 4 additions & 3 deletions tests/unit/Settings/AdminTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public function formDataProvider() {
'text' => 'Only allow authentication if an account exists on some other backend (e.g. LDAP).',
'type' => 'checkbox',
'global' => true,
'value' => '0'
],
'allow_multiple_user_back_ends' => [
'text' => $this->l10n->t('Allow the use of multiple user back-ends (e.g. LDAP)'),
Expand Down Expand Up @@ -220,10 +221,10 @@ public function testGetFormWithoutType() {
2 => 'Provider 2',
]);
$this->config
->expects($this->once())
->expects($this->exactly(2)) // 'type' and 'general-require_provisioned_account'
->method('getAppValue')
->with('user_saml', 'type')
->willReturn('');
->with('user_saml', $this->anything(), $this->anything())
->willReturn($this->returnArgument(2));

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

0 comments on commit c91b89b

Please sign in to comment.