From d40c61a71a718db01df5a2b145be14641e2c5163 Mon Sep 17 00:00:00 2001
From: Robin Appelman <robin@icewind.nl>
Date: Mon, 26 Feb 2018 12:58:19 +0100
Subject: adjust external storage config format to the one used in primary
 storage

Signed-off-by: Robin Appelman <robin@icewind.nl>
---
 apps/files_external/lib/Lib/Auth/OpenStack/OpenStackV3.php |  3 ++-
 apps/files_external/lib/Lib/Storage/Swift.php              | 11 +++++++----
 2 files changed, 9 insertions(+), 5 deletions(-)

(limited to 'apps/files_external')

diff --git a/apps/files_external/lib/Lib/Auth/OpenStack/OpenStackV3.php b/apps/files_external/lib/Lib/Auth/OpenStack/OpenStackV3.php
index adf6b8012a0..ead790e0ab5 100644
--- a/apps/files_external/lib/Lib/Auth/OpenStack/OpenStackV3.php
+++ b/apps/files_external/lib/Lib/Auth/OpenStack/OpenStackV3.php
@@ -37,7 +37,8 @@ class OpenStackV3 extends AuthMechanism {
 			->setScheme(self::SCHEME_OPENSTACK)
 			->setText($l->t('OpenStack v3'))
 			->addParameters([
-				new DefinitionParameter('userid', $l->t('User Id')),
+				new DefinitionParameter('user', $l->t('Username')),
+				new DefinitionParameter('domain', $l->t('Domain')),
 				(new DefinitionParameter('password', $l->t('Password')))
 					->setType(DefinitionParameter::VALUE_PASSWORD),
 				new DefinitionParameter('url', $l->t('Identity endpoint URL'))
diff --git a/apps/files_external/lib/Lib/Storage/Swift.php b/apps/files_external/lib/Lib/Storage/Swift.php
index 2f8207cac4f..a638169dcb2 100644
--- a/apps/files_external/lib/Lib/Storage/Swift.php
+++ b/apps/files_external/lib/Lib/Storage/Swift.php
@@ -162,7 +162,7 @@ class Swift extends \OC\Files\Storage\Common {
 			throw new StorageBadConfigException("API Key or password, Username, Bucket and Region have to be configured.");
 		}
 
-		$user = isset($params['user']) ? $params['user'] : $params['userid'];
+		$user = $params['user'];
 		$this->id = 'swift::' . $user . md5($params['bucket']);
 
 		$bucketUrl = new Uri($params['bucket']);
@@ -181,10 +181,13 @@ class Swift extends \OC\Files\Storage\Common {
 
 		$params['autocreate'] = true;
 
-		if (isset($params['userid'])) {
+		if (isset($params['domain'])) {
 			$params['user'] = [
-				'id' => $params['userid'],
-				'password' => $params['password']
+				'name' => $params['user'],
+				'password' => $params['password'],
+				'domain' => [
+					'name' => $params['domain'],
+				]
 			];
 		}
 
-- 
cgit v1.2.3