diff options
Diffstat (limited to 'apps/files_external/lib/backend')
-rw-r--r-- | apps/files_external/lib/backend/amazons3.php | 61 | ||||
-rw-r--r-- | apps/files_external/lib/backend/backend.php | 165 | ||||
-rw-r--r-- | apps/files_external/lib/backend/dav.php | 55 | ||||
-rw-r--r-- | apps/files_external/lib/backend/dropbox.php | 51 | ||||
-rw-r--r-- | apps/files_external/lib/backend/ftp.php | 55 | ||||
-rw-r--r-- | apps/files_external/lib/backend/google.php | 51 | ||||
-rw-r--r-- | apps/files_external/lib/backend/legacybackend.php | 104 | ||||
-rw-r--r-- | apps/files_external/lib/backend/local.php | 49 | ||||
-rw-r--r-- | apps/files_external/lib/backend/owncloud.php | 52 | ||||
-rw-r--r-- | apps/files_external/lib/backend/sftp.php | 51 | ||||
-rw-r--r-- | apps/files_external/lib/backend/sftp_key.php | 50 | ||||
-rw-r--r-- | apps/files_external/lib/backend/smb.php | 69 | ||||
-rw-r--r-- | apps/files_external/lib/backend/smb_oc.php | 72 | ||||
-rw-r--r-- | apps/files_external/lib/backend/swift.php | 62 |
14 files changed, 0 insertions, 947 deletions
diff --git a/apps/files_external/lib/backend/amazons3.php b/apps/files_external/lib/backend/amazons3.php deleted file mode 100644 index b2dedc10e4a..00000000000 --- a/apps/files_external/lib/backend/amazons3.php +++ /dev/null @@ -1,61 +0,0 @@ -<?php -/** - * @author Robin McCorkell <robin@mccorkell.me.uk> - * - * @copyright Copyright (c) 2016, ownCloud, Inc. - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * - */ - -namespace OCA\Files_External\Lib\Backend; - -use \OCP\IL10N; -use \OCA\Files_External\Lib\Backend\Backend; -use \OCA\Files_External\Lib\DefinitionParameter; -use \OCA\Files_External\Lib\Auth\AuthMechanism; -use \OCA\Files_External\Service\BackendService; -use \OCA\Files_External\Lib\LegacyDependencyCheckPolyfill; - -use \OCA\Files_External\Lib\Auth\AmazonS3\AccessKey; - -class AmazonS3 extends Backend { - - use LegacyDependencyCheckPolyfill; - - public function __construct(IL10N $l, AccessKey $legacyAuth) { - $this - ->setIdentifier('amazons3') - ->addIdentifierAlias('\OC\Files\Storage\AmazonS3') // legacy compat - ->setStorageClass('\OC\Files\Storage\AmazonS3') - ->setText($l->t('Amazon S3')) - ->addParameters([ - (new DefinitionParameter('bucket', $l->t('Bucket'))), - (new DefinitionParameter('hostname', $l->t('Hostname'))) - ->setFlag(DefinitionParameter::FLAG_OPTIONAL), - (new DefinitionParameter('port', $l->t('Port'))) - ->setFlag(DefinitionParameter::FLAG_OPTIONAL), - (new DefinitionParameter('region', $l->t('Region'))) - ->setFlag(DefinitionParameter::FLAG_OPTIONAL), - (new DefinitionParameter('use_ssl', $l->t('Enable SSL'))) - ->setType(DefinitionParameter::VALUE_BOOLEAN), - (new DefinitionParameter('use_path_style', $l->t('Enable Path Style'))) - ->setType(DefinitionParameter::VALUE_BOOLEAN), - ]) - ->addAuthScheme(AccessKey::SCHEME_AMAZONS3_ACCESSKEY) - ->setLegacyAuthMechanism($legacyAuth) - ; - } - -} diff --git a/apps/files_external/lib/backend/backend.php b/apps/files_external/lib/backend/backend.php deleted file mode 100644 index 8fb84b0e835..00000000000 --- a/apps/files_external/lib/backend/backend.php +++ /dev/null @@ -1,165 +0,0 @@ -<?php -/** - * @author Robin McCorkell <robin@mccorkell.me.uk> - * - * @copyright Copyright (c) 2016, ownCloud, Inc. - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * - */ - -namespace OCA\Files_External\Lib\Backend; - -use \OCA\Files_External\Lib\StorageConfig; -use \OCA\Files_External\Lib\VisibilityTrait; -use \OCA\Files_External\Lib\FrontendDefinitionTrait; -use \OCA\Files_External\Lib\PriorityTrait; -use \OCA\Files_External\Lib\DependencyTrait; -use \OCA\Files_External\Lib\StorageModifierTrait; -use \OCA\Files_External\Lib\IdentifierTrait; -use \OCA\Files_External\Lib\Auth\AuthMechanism; - -/** - * Storage backend - * - * A backend can have services injected during construction, - * such as \OCP\IDB for database operations. This allows a backend - * to perform advanced operations based on provided information. - * - * An authenication scheme defines the parameter interface, common to the - * storage implementation, the backend and the authentication mechanism. - * A storage implementation expects parameters according to the authentication - * scheme, which are provided from the authentication mechanism. - * - * This class uses the following traits: - * - VisibilityTrait - * Restrict usage to admin-only/none - * - FrontendDefinitionTrait - * Specify configuration parameters and other definitions - * - PriorityTrait - * Allow objects to prioritize over others with the same mountpoint - * - DependencyTrait - * The object requires certain dependencies to be met - * - StorageModifierTrait - * Object can affect storage mounting - */ -class Backend implements \JsonSerializable { - - use VisibilityTrait; - use FrontendDefinitionTrait; - use PriorityTrait; - use DependencyTrait; - use StorageModifierTrait; - use IdentifierTrait; - - /** @var string storage class */ - private $storageClass; - - /** @var array 'scheme' => true, supported authentication schemes */ - private $authSchemes = []; - - /** @var AuthMechanism|callable authentication mechanism fallback */ - private $legacyAuthMechanism; - - /** - * @return string - */ - public function getStorageClass() { - return $this->storageClass; - } - - /** - * @param string $class - * @return self - */ - public function setStorageClass($class) { - $this->storageClass = $class; - return $this; - } - - /** - * @return array - */ - public function getAuthSchemes() { - if (empty($this->authSchemes)) { - return [AuthMechanism::SCHEME_NULL => true]; - } - return $this->authSchemes; - } - - /** - * @param string $scheme - * @return self - */ - public function addAuthScheme($scheme) { - $this->authSchemes[$scheme] = true; - return $this; - } - - /** - * @param array $parameters storage parameters, for dynamic mechanism selection - * @return AuthMechanism - */ - public function getLegacyAuthMechanism(array $parameters = []) { - if (is_callable($this->legacyAuthMechanism)) { - return call_user_func($this->legacyAuthMechanism, $parameters); - } - return $this->legacyAuthMechanism; - } - - /** - * @param AuthMechanism $authMechanism - * @return self - */ - public function setLegacyAuthMechanism(AuthMechanism $authMechanism) { - $this->legacyAuthMechanism = $authMechanism; - return $this; - } - - /** - * @param callable $callback dynamic auth mechanism selection - * @return self - */ - public function setLegacyAuthMechanismCallback(callable $callback) { - $this->legacyAuthMechanism = $callback; - } - - /** - * Serialize into JSON for client-side JS - * - * @return array - */ - public function jsonSerialize() { - $data = $this->jsonSerializeDefinition(); - $data += $this->jsonSerializeIdentifier(); - - $data['backend'] = $data['name']; // legacy compat - $data['priority'] = $this->getPriority(); - $data['authSchemes'] = $this->getAuthSchemes(); - - return $data; - } - - /** - * Check if parameters are satisfied in a StorageConfig - * - * @param StorageConfig $storage - * @return bool - */ - public function validateStorage(StorageConfig $storage) { - return $this->validateStorageDefinition($storage); - } - -} - diff --git a/apps/files_external/lib/backend/dav.php b/apps/files_external/lib/backend/dav.php deleted file mode 100644 index c6e9630be9e..00000000000 --- a/apps/files_external/lib/backend/dav.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php -/** - * @author Robin McCorkell <robin@mccorkell.me.uk> - * - * @copyright Copyright (c) 2016, ownCloud, Inc. - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * - */ - -namespace OCA\Files_External\Lib\Backend; - -use \OCP\IL10N; -use \OCA\Files_External\Lib\Backend\Backend; -use \OCA\Files_External\Lib\DefinitionParameter; -use \OCA\Files_External\Lib\Auth\AuthMechanism; -use \OCA\Files_External\Service\BackendService; -use \OCA\Files_External\Lib\LegacyDependencyCheckPolyfill; - -use \OCA\Files_External\Lib\Auth\Password\Password; - -class DAV extends Backend { - - use LegacyDependencyCheckPolyfill; - - public function __construct(IL10N $l, Password $legacyAuth) { - $this - ->setIdentifier('dav') - ->addIdentifierAlias('\OC\Files\Storage\DAV') // legacy compat - ->setStorageClass('\OC\Files\Storage\DAV') - ->setText($l->t('WebDAV')) - ->addParameters([ - (new DefinitionParameter('host', $l->t('URL'))), - (new DefinitionParameter('root', $l->t('Remote subfolder'))) - ->setFlag(DefinitionParameter::FLAG_OPTIONAL), - (new DefinitionParameter('secure', $l->t('Secure https://'))) - ->setType(DefinitionParameter::VALUE_BOOLEAN), - ]) - ->addAuthScheme(AuthMechanism::SCHEME_PASSWORD) - ->setLegacyAuthMechanism($legacyAuth) - ; - } - -} diff --git a/apps/files_external/lib/backend/dropbox.php b/apps/files_external/lib/backend/dropbox.php deleted file mode 100644 index 7a414731192..00000000000 --- a/apps/files_external/lib/backend/dropbox.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php -/** - * @author Robin McCorkell <robin@mccorkell.me.uk> - * - * @copyright Copyright (c) 2016, ownCloud, Inc. - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * - */ - -namespace OCA\Files_External\Lib\Backend; - -use \OCP\IL10N; -use \OCA\Files_External\Lib\Backend\Backend; -use \OCA\Files_External\Lib\DefinitionParameter; -use \OCA\Files_External\Lib\Auth\AuthMechanism; -use \OCA\Files_External\Service\BackendService; -use \OCA\Files_External\Lib\LegacyDependencyCheckPolyfill; - -use \OCA\Files_External\Lib\Auth\OAuth1\OAuth1; - -class Dropbox extends Backend { - - use LegacyDependencyCheckPolyfill; - - public function __construct(IL10N $l, OAuth1 $legacyAuth) { - $this - ->setIdentifier('dropbox') - ->addIdentifierAlias('\OC\Files\Storage\Dropbox') // legacy compat - ->setStorageClass('\OC\Files\Storage\Dropbox') - ->setText($l->t('Dropbox')) - ->addParameters([ - // all parameters handled in OAuth1 mechanism - ]) - ->addAuthScheme(AuthMechanism::SCHEME_OAUTH1) - ->setLegacyAuthMechanism($legacyAuth) - ; - } - -} diff --git a/apps/files_external/lib/backend/ftp.php b/apps/files_external/lib/backend/ftp.php deleted file mode 100644 index b2b83a27405..00000000000 --- a/apps/files_external/lib/backend/ftp.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php -/** - * @author Robin McCorkell <robin@mccorkell.me.uk> - * - * @copyright Copyright (c) 2016, ownCloud, Inc. - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * - */ - -namespace OCA\Files_External\Lib\Backend; - -use \OCP\IL10N; -use \OCA\Files_External\Lib\Backend\Backend; -use \OCA\Files_External\Lib\DefinitionParameter; -use \OCA\Files_External\Lib\Auth\AuthMechanism; -use \OCA\Files_External\Service\BackendService; -use \OCA\Files_External\Lib\LegacyDependencyCheckPolyfill; - -use \OCA\Files_External\Lib\Auth\Password\Password; - -class FTP extends Backend { - - use LegacyDependencyCheckPolyfill; - - public function __construct(IL10N $l, Password $legacyAuth) { - $this - ->setIdentifier('ftp') - ->addIdentifierAlias('\OC\Files\Storage\FTP') // legacy compat - ->setStorageClass('\OC\Files\Storage\FTP') - ->setText($l->t('FTP')) - ->addParameters([ - (new DefinitionParameter('host', $l->t('Host'))), - (new DefinitionParameter('root', $l->t('Remote subfolder'))) - ->setFlag(DefinitionParameter::FLAG_OPTIONAL), - (new DefinitionParameter('secure', $l->t('Secure ftps://'))) - ->setType(DefinitionParameter::VALUE_BOOLEAN), - ]) - ->addAuthScheme(AuthMechanism::SCHEME_PASSWORD) - ->setLegacyAuthMechanism($legacyAuth) - ; - } - -} diff --git a/apps/files_external/lib/backend/google.php b/apps/files_external/lib/backend/google.php deleted file mode 100644 index 93a8cd2177d..00000000000 --- a/apps/files_external/lib/backend/google.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php -/** - * @author Robin McCorkell <robin@mccorkell.me.uk> - * - * @copyright Copyright (c) 2016, ownCloud, Inc. - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * - */ - -namespace OCA\Files_External\Lib\Backend; - -use \OCP\IL10N; -use \OCA\Files_External\Lib\Backend\Backend; -use \OCA\Files_External\Lib\DefinitionParameter; -use \OCA\Files_External\Lib\Auth\AuthMechanism; -use \OCA\Files_External\Service\BackendService; -use \OCA\Files_External\Lib\LegacyDependencyCheckPolyfill; - -use \OCA\Files_External\Lib\Auth\OAuth2\OAuth2; - -class Google extends Backend { - - use LegacyDependencyCheckPolyfill; - - public function __construct(IL10N $l, OAuth2 $legacyAuth) { - $this - ->setIdentifier('googledrive') - ->addIdentifierAlias('\OC\Files\Storage\Google') // legacy compat - ->setStorageClass('\OC\Files\Storage\Google') - ->setText($l->t('Google Drive')) - ->addParameters([ - // all parameters handled in OAuth2 mechanism - ]) - ->addAuthScheme(AuthMechanism::SCHEME_OAUTH2) - ->setLegacyAuthMechanism($legacyAuth) - ; - } - -} diff --git a/apps/files_external/lib/backend/legacybackend.php b/apps/files_external/lib/backend/legacybackend.php deleted file mode 100644 index 084758ff78a..00000000000 --- a/apps/files_external/lib/backend/legacybackend.php +++ /dev/null @@ -1,104 +0,0 @@ -<?php -/** - * @author Robin McCorkell <robin@mccorkell.me.uk> - * - * @copyright Copyright (c) 2016, ownCloud, Inc. - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * - */ - -namespace OCA\Files_External\Lib\Backend; - -use \OCA\Files_External\Lib\DefinitionParameter; -use \OCA\Files_External\Lib\Backend\Backend; -use \OCA\Files_External\Lib\Auth\Builtin; -use \OCA\Files_External\Lib\MissingDependency; -use \OCA\Files_External\Lib\LegacyDependencyCheckPolyfill; - -/** - * Legacy compatibility for OC_Mount_Config::registerBackend() - */ -class LegacyBackend extends Backend { - - use LegacyDependencyCheckPolyfill { - LegacyDependencyCheckPolyfill::checkDependencies as doCheckDependencies; - } - - /** @var bool */ - protected $hasDependencies = false; - - /** - * @param string $class - * @param array $definition - * @param Builtin $authMechanism - */ - public function __construct($class, array $definition, Builtin $authMechanism) { - $this - ->setIdentifier($class) - ->setStorageClass($class) - ->setText($definition['backend']) - ->addAuthScheme(Builtin::SCHEME_BUILTIN) - ->setLegacyAuthMechanism($authMechanism) - ; - - foreach ($definition['configuration'] as $name => $placeholder) { - $flags = DefinitionParameter::FLAG_NONE; - $type = DefinitionParameter::VALUE_TEXT; - if ($placeholder[0] === '&') { - $flags = DefinitionParameter::FLAG_OPTIONAL; - $placeholder = substr($placeholder, 1); - } - switch ($placeholder[0]) { - case '!': - $type = DefinitionParameter::VALUE_BOOLEAN; - $placeholder = substr($placeholder, 1); - break; - case '*': - $type = DefinitionParameter::VALUE_PASSWORD; - $placeholder = substr($placeholder, 1); - break; - case '#': - $type = DefinitionParameter::VALUE_HIDDEN; - $placeholder = substr($placeholder, 1); - break; - } - $this->addParameter((new DefinitionParameter($name, $placeholder)) - ->setType($type) - ->setFlags($flags) - ); - } - - if (isset($definition['priority'])) { - $this->setPriority($definition['priority']); - } - if (isset($definition['custom'])) { - $this->setCustomJs($definition['custom']); - } - if (isset($definition['has_dependencies']) && $definition['has_dependencies']) { - $this->hasDependencies = true; - } - } - - /** - * @return MissingDependency[] - */ - public function checkDependencies() { - if ($this->hasDependencies) { - return $this->doCheckDependencies(); - } - return []; - } - -} diff --git a/apps/files_external/lib/backend/local.php b/apps/files_external/lib/backend/local.php deleted file mode 100644 index 1db707e7247..00000000000 --- a/apps/files_external/lib/backend/local.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php -/** - * @author Robin McCorkell <robin@mccorkell.me.uk> - * - * @copyright Copyright (c) 2016, ownCloud, Inc. - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * - */ - -namespace OCA\Files_External\Lib\Backend; - -use \OCP\IL10N; -use \OCA\Files_External\Lib\Backend\Backend; -use \OCA\Files_External\Lib\DefinitionParameter; -use \OCA\Files_External\Lib\Auth\AuthMechanism; -use \OCA\Files_External\Service\BackendService; -use \OCA\Files_External\Lib\Auth\NullMechanism; - -class Local extends Backend { - - public function __construct(IL10N $l, NullMechanism $legacyAuth) { - $this - ->setIdentifier('local') - ->addIdentifierAlias('\OC\Files\Storage\Local') // legacy compat - ->setStorageClass('\OC\Files\Storage\Local') - ->setText($l->t('Local')) - ->addParameters([ - (new DefinitionParameter('datadir', $l->t('Location'))), - ]) - ->setAllowedVisibility(BackendService::VISIBILITY_ADMIN) - ->setPriority(BackendService::PRIORITY_DEFAULT + 50) - ->addAuthScheme(AuthMechanism::SCHEME_NULL) - ->setLegacyAuthMechanism($legacyAuth) - ; - } - -} diff --git a/apps/files_external/lib/backend/owncloud.php b/apps/files_external/lib/backend/owncloud.php deleted file mode 100644 index e7da328c5f1..00000000000 --- a/apps/files_external/lib/backend/owncloud.php +++ /dev/null @@ -1,52 +0,0 @@ -<?php -/** - * @author Robin McCorkell <robin@mccorkell.me.uk> - * - * @copyright Copyright (c) 2016, ownCloud, Inc. - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * - */ - -namespace OCA\Files_External\Lib\Backend; - -use \OCP\IL10N; -use \OCA\Files_External\Lib\Backend\Backend; -use \OCA\Files_External\Lib\DefinitionParameter; -use \OCA\Files_External\Lib\Auth\AuthMechanism; -use \OCA\Files_External\Service\BackendService; - -use \OCA\Files_External\Lib\Auth\Password\Password; - -class OwnCloud extends Backend { - - public function __construct(IL10N $l, Password $legacyAuth) { - $this - ->setIdentifier('owncloud') - ->addIdentifierAlias('\OC\Files\Storage\OwnCloud') // legacy compat - ->setStorageClass('\OC\Files\Storage\OwnCloud') - ->setText($l->t('ownCloud')) - ->addParameters([ - (new DefinitionParameter('host', $l->t('URL'))), - (new DefinitionParameter('root', $l->t('Remote subfolder'))) - ->setFlag(DefinitionParameter::FLAG_OPTIONAL), - (new DefinitionParameter('secure', $l->t('Secure https://'))) - ->setType(DefinitionParameter::VALUE_BOOLEAN), - ]) - ->addAuthScheme(AuthMechanism::SCHEME_PASSWORD) - ->setLegacyAuthMechanism($legacyAuth) - ; - } - -} diff --git a/apps/files_external/lib/backend/sftp.php b/apps/files_external/lib/backend/sftp.php deleted file mode 100644 index 3e5ecb90131..00000000000 --- a/apps/files_external/lib/backend/sftp.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php -/** - * @author Robin McCorkell <robin@mccorkell.me.uk> - * - * @copyright Copyright (c) 2016, ownCloud, Inc. - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * - */ - -namespace OCA\Files_External\Lib\Backend; - -use \OCP\IL10N; -use \OCA\Files_External\Lib\Backend\Backend; -use \OCA\Files_External\Lib\DefinitionParameter; -use \OCA\Files_External\Lib\Auth\AuthMechanism; -use \OCA\Files_External\Service\BackendService; - -use \OCA\Files_External\Lib\Auth\Password\Password; - -class SFTP extends Backend { - - public function __construct(IL10N $l, Password $legacyAuth) { - $this - ->setIdentifier('sftp') - ->addIdentifierAlias('\OC\Files\Storage\SFTP') // legacy compat - ->setStorageClass('\OC\Files\Storage\SFTP') - ->setText($l->t('SFTP')) - ->addParameters([ - (new DefinitionParameter('host', $l->t('Host'))), - (new DefinitionParameter('root', $l->t('Root'))) - ->setFlag(DefinitionParameter::FLAG_OPTIONAL), - ]) - ->addAuthScheme(AuthMechanism::SCHEME_PASSWORD) - ->addAuthScheme(AuthMechanism::SCHEME_PUBLICKEY) - ->setLegacyAuthMechanism($legacyAuth) - ; - } - -} diff --git a/apps/files_external/lib/backend/sftp_key.php b/apps/files_external/lib/backend/sftp_key.php deleted file mode 100644 index 58dddedf784..00000000000 --- a/apps/files_external/lib/backend/sftp_key.php +++ /dev/null @@ -1,50 +0,0 @@ -<?php -/** - * @author Robin McCorkell <robin@mccorkell.me.uk> - * - * @copyright Copyright (c) 2016, ownCloud, Inc. - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * - */ - -namespace OCA\Files_External\Lib\Backend; - -use \OCP\IL10N; -use \OCA\Files_External\Lib\Backend\Backend; -use \OCA\Files_External\Lib\DefinitionParameter; -use \OCA\Files_External\Lib\Auth\AuthMechanism; -use \OCA\Files_External\Service\BackendService; -use \OCA\Files_External\Lib\Auth\PublicKey\RSA; -use \OCA\Files_External\Lib\Backend\SFTP; - -class SFTP_Key extends Backend { - - public function __construct(IL10N $l, RSA $legacyAuth, SFTP $sftpBackend) { - $this - ->setIdentifier('\OC\Files\Storage\SFTP_Key') - ->setStorageClass('\OC\Files\Storage\SFTP') - ->setText($l->t('SFTP with secret key login')) - ->addParameters([ - (new DefinitionParameter('host', $l->t('Host'))), - (new DefinitionParameter('root', $l->t('Remote subfolder'))) - ->setFlag(DefinitionParameter::FLAG_OPTIONAL), - ]) - ->addAuthScheme(AuthMechanism::SCHEME_PUBLICKEY) - ->setLegacyAuthMechanism($legacyAuth) - ->deprecateTo($sftpBackend) - ; - } - -} diff --git a/apps/files_external/lib/backend/smb.php b/apps/files_external/lib/backend/smb.php deleted file mode 100644 index 9b71636936a..00000000000 --- a/apps/files_external/lib/backend/smb.php +++ /dev/null @@ -1,69 +0,0 @@ -<?php -/** - * @author Robin McCorkell <robin@mccorkell.me.uk> - * - * @copyright Copyright (c) 2016, ownCloud, Inc. - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * - */ - -namespace OCA\Files_External\Lib\Backend; - -use \OCP\IL10N; -use \OCA\Files_External\Lib\Backend\Backend; -use \OCA\Files_External\Lib\DefinitionParameter; -use \OCA\Files_External\Lib\Auth\AuthMechanism; -use \OCA\Files_External\Service\BackendService; -use \OCA\Files_External\Lib\StorageConfig; -use \OCA\Files_External\Lib\LegacyDependencyCheckPolyfill; - -use \OCA\Files_External\Lib\Auth\Password\Password; -use OCP\IUser; - -class SMB extends Backend { - - use LegacyDependencyCheckPolyfill; - - public function __construct(IL10N $l, Password $legacyAuth) { - $this - ->setIdentifier('smb') - ->addIdentifierAlias('\OC\Files\Storage\SMB') // legacy compat - ->setStorageClass('\OC\Files\Storage\SMB') - ->setText($l->t('SMB / CIFS')) - ->addParameters([ - (new DefinitionParameter('host', $l->t('Host'))), - (new DefinitionParameter('share', $l->t('Share'))), - (new DefinitionParameter('root', $l->t('Remote subfolder'))) - ->setFlag(DefinitionParameter::FLAG_OPTIONAL), - (new DefinitionParameter('domain', $l->t('Domain'))) - ->setFlag(DefinitionParameter::FLAG_OPTIONAL), - ]) - ->addAuthScheme(AuthMechanism::SCHEME_PASSWORD) - ->setLegacyAuthMechanism($legacyAuth) - ; - } - - /** - * @param StorageConfig $storage - * @param IUser $user - */ - public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) { - $user = $storage->getBackendOption('user'); - if ($domain = $storage->getBackendOption('domain')) { - $storage->setBackendOption('user', $domain.'\\'.$user); - } - } - -} diff --git a/apps/files_external/lib/backend/smb_oc.php b/apps/files_external/lib/backend/smb_oc.php deleted file mode 100644 index ba38754ce5a..00000000000 --- a/apps/files_external/lib/backend/smb_oc.php +++ /dev/null @@ -1,72 +0,0 @@ -<?php -/** - * @author Robin McCorkell <robin@mccorkell.me.uk> - * - * @copyright Copyright (c) 2016, ownCloud, Inc. - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * - */ - -namespace OCA\Files_External\Lib\Backend; - -use \OCP\IL10N; -use \OCA\Files_External\Lib\Backend\Backend; -use \OCA\Files_External\Lib\DefinitionParameter; -use \OCA\Files_External\Lib\Auth\AuthMechanism; -use \OCA\Files_External\Service\BackendService; -use \OCA\Files_External\Lib\Auth\Password\SessionCredentials; -use \OCA\Files_External\Lib\StorageConfig; -use \OCA\Files_External\Lib\LegacyDependencyCheckPolyfill; -use \OCA\Files_External\Lib\Backend\SMB; -use OCP\IUser; - -/** - * Deprecated SMB_OC class - use SMB with the password::sessioncredentials auth mechanism - */ -class SMB_OC extends Backend { - - use LegacyDependencyCheckPolyfill; - - public function __construct(IL10N $l, SessionCredentials $legacyAuth, SMB $smbBackend) { - $this - ->setIdentifier('\OC\Files\Storage\SMB_OC') - ->setStorageClass('\OC\Files\Storage\SMB') - ->setText($l->t('SMB / CIFS using OC login')) - ->addParameters([ - (new DefinitionParameter('host', $l->t('Host'))), - (new DefinitionParameter('username_as_share', $l->t('Username as share'))) - ->setType(DefinitionParameter::VALUE_BOOLEAN), - (new DefinitionParameter('share', $l->t('Share'))) - ->setFlag(DefinitionParameter::FLAG_OPTIONAL), - (new DefinitionParameter('root', $l->t('Remote subfolder'))) - ->setFlag(DefinitionParameter::FLAG_OPTIONAL), - ]) - ->setPriority(BackendService::PRIORITY_DEFAULT - 10) - ->addAuthScheme(AuthMechanism::SCHEME_PASSWORD) - ->setLegacyAuthMechanism($legacyAuth) - ->deprecateTo($smbBackend) - ; - } - - public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) { - $username_as_share = ($storage->getBackendOption('username_as_share') === true); - - if ($username_as_share) { - $share = '/' . $storage->getBackendOption('user'); - $storage->setBackendOption('share', $share); - } - } - -} diff --git a/apps/files_external/lib/backend/swift.php b/apps/files_external/lib/backend/swift.php deleted file mode 100644 index d6e4ac12f9a..00000000000 --- a/apps/files_external/lib/backend/swift.php +++ /dev/null @@ -1,62 +0,0 @@ -<?php -/** - * @author Robin McCorkell <robin@mccorkell.me.uk> - * - * @copyright Copyright (c) 2016, ownCloud, Inc. - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * - */ - -namespace OCA\Files_External\Lib\Backend; - -use \OCP\IL10N; -use \OCA\Files_External\Lib\Backend\Backend; -use \OCA\Files_External\Lib\DefinitionParameter; -use \OCA\Files_External\Lib\Auth\AuthMechanism; -use \OCA\Files_External\Service\BackendService; -use \OCA\Files_External\Lib\Auth\OpenStack\OpenStack; -use \OCA\Files_External\Lib\Auth\OpenStack\Rackspace; -use \OCA\Files_External\Lib\LegacyDependencyCheckPolyfill; - -class Swift extends Backend { - - use LegacyDependencyCheckPolyfill; - - public function __construct(IL10N $l, OpenStack $openstackAuth, Rackspace $rackspaceAuth) { - $this - ->setIdentifier('swift') - ->addIdentifierAlias('\OC\Files\Storage\Swift') // legacy compat - ->setStorageClass('\OC\Files\Storage\Swift') - ->setText($l->t('OpenStack Object Storage')) - ->addParameters([ - (new DefinitionParameter('service_name', $l->t('Service name'))) - ->setFlag(DefinitionParameter::FLAG_OPTIONAL), - (new DefinitionParameter('region', $l->t('Region'))) - ->setFlag(DefinitionParameter::FLAG_OPTIONAL), - (new DefinitionParameter('bucket', $l->t('Bucket'))), - (new DefinitionParameter('timeout', $l->t('Request timeout (seconds)'))) - ->setFlag(DefinitionParameter::FLAG_OPTIONAL), - ]) - ->addAuthScheme(AuthMechanism::SCHEME_OPENSTACK) - ->setLegacyAuthMechanismCallback(function(array $params) use ($openstackAuth, $rackspaceAuth) { - if (isset($params['options']['key']) && $params['options']['key']) { - return $rackspaceAuth; - } - return $openstackAuth; - }) - ; - } - -} |