expose user provided credentials for admin mounts

This commit is contained in:
Robin Appelman 2016-01-19 12:18:09 +01:00
parent 419507c118
commit f3e9729a5f
2 changed files with 10 additions and 1 deletions

View File

@ -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);

View File

@ -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) {
}
}
}
}