Skip to content
Snippets Groups Projects
Commit d7d0cfc7 authored by Thomas Müller's avatar Thomas Müller
Browse files

Merge pull request #21008 from owncloud/UoM-ResPlat-DevOps-swift-acl-shared-containers

Allowing access to Swift containers shared by ACL
parents ea227aad 8799d556
No related branches found
No related tags found
No related merge requests found
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
namespace OC\Files\Storage; namespace OC\Files\Storage;
use Guzzle\Http\Url;
use Guzzle\Http\Exception\ClientErrorResponseException; use Guzzle\Http\Exception\ClientErrorResponseException;
use Icewind\Streams\IteratorDirectory; use Icewind\Streams\IteratorDirectory;
use OpenCloud; use OpenCloud;
...@@ -123,7 +124,14 @@ class Swift extends \OC\Files\Storage\Common { ...@@ -123,7 +124,14 @@ class Swift extends \OC\Files\Storage\Common {
} }
$this->id = 'swift::' . $params['user'] . md5($params['bucket']); $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'])) { if (empty($params['url'])) {
$params['url'] = 'https://identity.api.rackspacecloud.com/v2.0/'; $params['url'] = 'https://identity.api.rackspacecloud.com/v2.0/';
...@@ -514,7 +522,16 @@ class Swift extends \OC\Files\Storage\Common { ...@@ -514,7 +522,16 @@ class Swift extends \OC\Files\Storage\Common {
$this->anchor = new OpenStack($this->params['url'], $settings); $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; return $this->connection;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment