summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-01-08 20:13:13 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2016-01-08 20:13:13 +0100
commitd7d0cfc775630e8bf3b66cfa61c73a81d4723eab (patch)
tree759f4e15ae1f4aa407ed298cf59d2bbe272675ff /apps
parentea227aadf2c1b2c326b3aedc9a9bf39d4093ad40 (diff)
parent8799d5563f80b56f9d1354e65f2156e702a86414 (diff)
downloadnextcloud-server-d7d0cfc775630e8bf3b66cfa61c73a81d4723eab.tar.gz
nextcloud-server-d7d0cfc775630e8bf3b66cfa61c73a81d4723eab.zip
Merge pull request #21008 from owncloud/UoM-ResPlat-DevOps-swift-acl-shared-containers
Allowing access to Swift containers shared by ACL
Diffstat (limited to 'apps')
-rw-r--r--apps/files_external/lib/swift.php21
1 files changed, 19 insertions, 2 deletions
diff --git a/apps/files_external/lib/swift.php b/apps/files_external/lib/swift.php
index a64a02a4ed9..4973f576ab6 100644
--- a/apps/files_external/lib/swift.php
+++ b/apps/files_external/lib/swift.php
@@ -32,6 +32,7 @@
namespace OC\Files\Storage;
+use Guzzle\Http\Url;
use Guzzle\Http\Exception\ClientErrorResponseException;
use Icewind\Streams\IteratorDirectory;
use OpenCloud;
@@ -123,7 +124,14 @@ class Swift extends \OC\Files\Storage\Common {
}
$this->id = 'swift::' . $params['user'] . md5($params['bucket']);
- $this->bucket = $params['bucket'];
+
+ $bucketUrl = Url::factory($params['bucket']);
+ if ($bucketUrl->isAbsolute()) {
+ $this->bucket = end(($bucketUrl->getPathSegments()));
+ $params['endpoint_url'] = $bucketUrl->addPath('..')->normalizePath();
+ } else {
+ $this->bucket = $params['bucket'];
+ }
if (empty($params['url'])) {
$params['url'] = 'https://identity.api.rackspacecloud.com/v2.0/';
@@ -514,7 +522,16 @@ class Swift extends \OC\Files\Storage\Common {
$this->anchor = new OpenStack($this->params['url'], $settings);
}
- $this->connection = $this->anchor->objectStoreService($this->params['service_name'], $this->params['region']);
+ $connection = $this->anchor->objectStoreService($this->params['service_name'], $this->params['region']);
+
+ if (!empty($this->params['endpoint_url'])) {
+ $endpoint = $connection->getEndpoint();
+ $endpoint->setPublicUrl($this->params['endpoint_url']);
+ $endpoint->setPrivateUrl($this->params['endpoint_url']);
+ $connection->setEndpoint($endpoint);
+ }
+
+ $this->connection = $connection;
return $this->connection;
}