From 603655341e12f84abc9a26f298478838c7b300ea Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 9 Sep 2019 17:14:21 +0200 Subject: allow setting user provided global credentials trough credentials popup Signed-off-by: Robin Appelman --- apps/files_external/lib/Lib/Auth/Password/UserGlobalAuth.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'apps/files_external/lib/Lib') diff --git a/apps/files_external/lib/Lib/Auth/Password/UserGlobalAuth.php b/apps/files_external/lib/Lib/Auth/Password/UserGlobalAuth.php index 6326830f020..8ea9ad0f785 100644 --- a/apps/files_external/lib/Lib/Auth/Password/UserGlobalAuth.php +++ b/apps/files_external/lib/Lib/Auth/Password/UserGlobalAuth.php @@ -44,11 +44,20 @@ class UserGlobalAuth extends AuthMechanism { $this ->setIdentifier('password::global::user') - ->setVisibility(BackendService::VISIBILITY_ADMIN) + ->setVisibility(BackendService::VISIBILITY_DEFAULT) ->setScheme(self::SCHEME_PASSWORD) ->setText($l->t('Global credentials, user entered')); } + public function saveBackendOptions(IUser $user, $id, $backendOptions) { + // make sure we're not setting any unexpected keys + $credentials = [ + 'user' => $backendOptions['user'], + 'password' => $backendOptions['password'], + ]; + $this->credentialsManager->store($user->getUID(), self::CREDENTIALS_IDENTIFIER, $credentials); + } + public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) { if ($user === null) { throw new InsufficientDataForMeaningfulAnswerException('No credentials saved'); -- cgit v1.2.3