From f3e9729a5f68fa36ee6633955b7913f37e1c890e Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 19 Jan 2016 12:18:09 +0100 Subject: [PATCH] expose user provided credentials for admin mounts --- .../controller/usercredentialscontroller.php | 1 - .../controller/userglobalstoragescontroller.php | 10 ++++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/files_external/controller/usercredentialscontroller.php b/apps/files_external/controller/usercredentialscontroller.php index 2944611d8a..bc514cba08 100644 --- a/apps/files_external/controller/usercredentialscontroller.php +++ b/apps/files_external/controller/usercredentialscontroller.php @@ -49,7 +49,6 @@ class UserCredentialsController extends Controller { * @param string $password * * @NoAdminRequired - * @NoCSRFRequired */ public function store($storageId, $username, $password) { $this->authMechanism->saveCredentials($this->userSession->getUser(), $storageId, $username, $password); diff --git a/apps/files_external/controller/userglobalstoragescontroller.php b/apps/files_external/controller/userglobalstoragescontroller.php index 6d4548754d..97b5c90e20 100644 --- a/apps/files_external/controller/userglobalstoragescontroller.php +++ b/apps/files_external/controller/userglobalstoragescontroller.php @@ -22,6 +22,8 @@ namespace OCA\Files_External\Controller; use OCA\Files_External\Lib\Auth\AuthMechanism; +use OCA\Files_External\Lib\Auth\Password\UserProvided; +use OCA\Files_External\Lib\InsufficientDataForMeaningfulAnswerException; use \OCP\IRequest; use \OCP\IL10N; use \OCP\AppFramework\Http\DataResponse; @@ -135,6 +137,14 @@ class UserGlobalStoragesController extends StoragesController { protected function sanitizeStorage(StorageConfig $storage) { $storage->setBackendOptions([]); $storage->setMountOptions([]); + + if ($storage->getAuthMechanism() instanceof UserProvided) { + try { + $storage->getAuthMechanism()->manipulateStorageConfig($storage, $this->userSession->getUser()); + } catch (InsufficientDataForMeaningfulAnswerException $e) { + + } + } } }