@@ -41,88 +41,88 @@ |
||
| 41 | 41 | */ |
| 42 | 42 | class Application extends App implements IBackendProvider, IAuthMechanismProvider { |
| 43 | 43 | |
| 44 | - public function __construct(array $urlParams = array()) { |
|
| 45 | - parent::__construct('files_external', $urlParams); |
|
| 46 | - |
|
| 47 | - $container = $this->getContainer(); |
|
| 48 | - |
|
| 49 | - $container->registerService('OCP\Files\Config\IUserMountCache', function (IAppContainer $c) { |
|
| 50 | - return $c->getServer()->query('UserMountCache'); |
|
| 51 | - }); |
|
| 52 | - |
|
| 53 | - $backendService = $container->query('OCA\\Files_External\\Service\\BackendService'); |
|
| 54 | - $backendService->registerBackendProvider($this); |
|
| 55 | - $backendService->registerAuthMechanismProvider($this); |
|
| 56 | - |
|
| 57 | - // force-load auth mechanisms since some will register hooks |
|
| 58 | - // TODO: obsolete these and use the TokenProvider to get the user's password from the session |
|
| 59 | - $this->getAuthMechanisms(); |
|
| 60 | - |
|
| 61 | - // app developers: do NOT depend on this! it will disappear with oC 9.0! |
|
| 62 | - \OC::$server->getEventDispatcher()->dispatch( |
|
| 63 | - 'OCA\\Files_External::loadAdditionalBackends' |
|
| 64 | - ); |
|
| 65 | - } |
|
| 66 | - |
|
| 67 | - /** |
|
| 68 | - * @{inheritdoc} |
|
| 69 | - */ |
|
| 70 | - public function getBackends() { |
|
| 71 | - $container = $this->getContainer(); |
|
| 72 | - |
|
| 73 | - $backends = [ |
|
| 74 | - $container->query('OCA\Files_External\Lib\Backend\Local'), |
|
| 75 | - $container->query('OCA\Files_External\Lib\Backend\FTP'), |
|
| 76 | - $container->query('OCA\Files_External\Lib\Backend\DAV'), |
|
| 77 | - $container->query('OCA\Files_External\Lib\Backend\OwnCloud'), |
|
| 78 | - $container->query('OCA\Files_External\Lib\Backend\SFTP'), |
|
| 79 | - $container->query('OCA\Files_External\Lib\Backend\AmazonS3'), |
|
| 80 | - $container->query('OCA\Files_External\Lib\Backend\Google'), |
|
| 81 | - $container->query('OCA\Files_External\Lib\Backend\Swift'), |
|
| 82 | - $container->query('OCA\Files_External\Lib\Backend\SFTP_Key'), |
|
| 83 | - $container->query('OCA\Files_External\Lib\Backend\SMB'), |
|
| 84 | - $container->query('OCA\Files_External\Lib\Backend\SMB_OC'), |
|
| 85 | - ]; |
|
| 86 | - |
|
| 87 | - return $backends; |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - /** |
|
| 91 | - * @{inheritdoc} |
|
| 92 | - */ |
|
| 93 | - public function getAuthMechanisms() { |
|
| 94 | - $container = $this->getContainer(); |
|
| 95 | - |
|
| 96 | - return [ |
|
| 97 | - // AuthMechanism::SCHEME_NULL mechanism |
|
| 98 | - $container->query('OCA\Files_External\Lib\Auth\NullMechanism'), |
|
| 99 | - |
|
| 100 | - // AuthMechanism::SCHEME_BUILTIN mechanism |
|
| 101 | - $container->query('OCA\Files_External\Lib\Auth\Builtin'), |
|
| 102 | - |
|
| 103 | - // AuthMechanism::SCHEME_PASSWORD mechanisms |
|
| 104 | - $container->query('OCA\Files_External\Lib\Auth\Password\Password'), |
|
| 105 | - $container->query('OCA\Files_External\Lib\Auth\Password\SessionCredentials'), |
|
| 106 | - $container->query('OCA\Files_External\Lib\Auth\Password\LoginCredentials'), |
|
| 107 | - $container->query('OCA\Files_External\Lib\Auth\Password\UserProvided'), |
|
| 108 | - $container->query('OCA\Files_External\Lib\Auth\Password\GlobalAuth'), |
|
| 109 | - |
|
| 110 | - // AuthMechanism::SCHEME_OAUTH1 mechanisms |
|
| 111 | - $container->query('OCA\Files_External\Lib\Auth\OAuth1\OAuth1'), |
|
| 112 | - |
|
| 113 | - // AuthMechanism::SCHEME_OAUTH2 mechanisms |
|
| 114 | - $container->query('OCA\Files_External\Lib\Auth\OAuth2\OAuth2'), |
|
| 115 | - |
|
| 116 | - // AuthMechanism::SCHEME_PUBLICKEY mechanisms |
|
| 117 | - $container->query('OCA\Files_External\Lib\Auth\PublicKey\RSA'), |
|
| 118 | - |
|
| 119 | - // AuthMechanism::SCHEME_OPENSTACK mechanisms |
|
| 120 | - $container->query('OCA\Files_External\Lib\Auth\OpenStack\OpenStack'), |
|
| 121 | - $container->query('OCA\Files_External\Lib\Auth\OpenStack\Rackspace'), |
|
| 122 | - |
|
| 123 | - // Specialized mechanisms |
|
| 124 | - $container->query('OCA\Files_External\Lib\Auth\AmazonS3\AccessKey'), |
|
| 125 | - ]; |
|
| 126 | - } |
|
| 44 | + public function __construct(array $urlParams = array()) { |
|
| 45 | + parent::__construct('files_external', $urlParams); |
|
| 46 | + |
|
| 47 | + $container = $this->getContainer(); |
|
| 48 | + |
|
| 49 | + $container->registerService('OCP\Files\Config\IUserMountCache', function (IAppContainer $c) { |
|
| 50 | + return $c->getServer()->query('UserMountCache'); |
|
| 51 | + }); |
|
| 52 | + |
|
| 53 | + $backendService = $container->query('OCA\\Files_External\\Service\\BackendService'); |
|
| 54 | + $backendService->registerBackendProvider($this); |
|
| 55 | + $backendService->registerAuthMechanismProvider($this); |
|
| 56 | + |
|
| 57 | + // force-load auth mechanisms since some will register hooks |
|
| 58 | + // TODO: obsolete these and use the TokenProvider to get the user's password from the session |
|
| 59 | + $this->getAuthMechanisms(); |
|
| 60 | + |
|
| 61 | + // app developers: do NOT depend on this! it will disappear with oC 9.0! |
|
| 62 | + \OC::$server->getEventDispatcher()->dispatch( |
|
| 63 | + 'OCA\\Files_External::loadAdditionalBackends' |
|
| 64 | + ); |
|
| 65 | + } |
|
| 66 | + |
|
| 67 | + /** |
|
| 68 | + * @{inheritdoc} |
|
| 69 | + */ |
|
| 70 | + public function getBackends() { |
|
| 71 | + $container = $this->getContainer(); |
|
| 72 | + |
|
| 73 | + $backends = [ |
|
| 74 | + $container->query('OCA\Files_External\Lib\Backend\Local'), |
|
| 75 | + $container->query('OCA\Files_External\Lib\Backend\FTP'), |
|
| 76 | + $container->query('OCA\Files_External\Lib\Backend\DAV'), |
|
| 77 | + $container->query('OCA\Files_External\Lib\Backend\OwnCloud'), |
|
| 78 | + $container->query('OCA\Files_External\Lib\Backend\SFTP'), |
|
| 79 | + $container->query('OCA\Files_External\Lib\Backend\AmazonS3'), |
|
| 80 | + $container->query('OCA\Files_External\Lib\Backend\Google'), |
|
| 81 | + $container->query('OCA\Files_External\Lib\Backend\Swift'), |
|
| 82 | + $container->query('OCA\Files_External\Lib\Backend\SFTP_Key'), |
|
| 83 | + $container->query('OCA\Files_External\Lib\Backend\SMB'), |
|
| 84 | + $container->query('OCA\Files_External\Lib\Backend\SMB_OC'), |
|
| 85 | + ]; |
|
| 86 | + |
|
| 87 | + return $backends; |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + /** |
|
| 91 | + * @{inheritdoc} |
|
| 92 | + */ |
|
| 93 | + public function getAuthMechanisms() { |
|
| 94 | + $container = $this->getContainer(); |
|
| 95 | + |
|
| 96 | + return [ |
|
| 97 | + // AuthMechanism::SCHEME_NULL mechanism |
|
| 98 | + $container->query('OCA\Files_External\Lib\Auth\NullMechanism'), |
|
| 99 | + |
|
| 100 | + // AuthMechanism::SCHEME_BUILTIN mechanism |
|
| 101 | + $container->query('OCA\Files_External\Lib\Auth\Builtin'), |
|
| 102 | + |
|
| 103 | + // AuthMechanism::SCHEME_PASSWORD mechanisms |
|
| 104 | + $container->query('OCA\Files_External\Lib\Auth\Password\Password'), |
|
| 105 | + $container->query('OCA\Files_External\Lib\Auth\Password\SessionCredentials'), |
|
| 106 | + $container->query('OCA\Files_External\Lib\Auth\Password\LoginCredentials'), |
|
| 107 | + $container->query('OCA\Files_External\Lib\Auth\Password\UserProvided'), |
|
| 108 | + $container->query('OCA\Files_External\Lib\Auth\Password\GlobalAuth'), |
|
| 109 | + |
|
| 110 | + // AuthMechanism::SCHEME_OAUTH1 mechanisms |
|
| 111 | + $container->query('OCA\Files_External\Lib\Auth\OAuth1\OAuth1'), |
|
| 112 | + |
|
| 113 | + // AuthMechanism::SCHEME_OAUTH2 mechanisms |
|
| 114 | + $container->query('OCA\Files_External\Lib\Auth\OAuth2\OAuth2'), |
|
| 115 | + |
|
| 116 | + // AuthMechanism::SCHEME_PUBLICKEY mechanisms |
|
| 117 | + $container->query('OCA\Files_External\Lib\Auth\PublicKey\RSA'), |
|
| 118 | + |
|
| 119 | + // AuthMechanism::SCHEME_OPENSTACK mechanisms |
|
| 120 | + $container->query('OCA\Files_External\Lib\Auth\OpenStack\OpenStack'), |
|
| 121 | + $container->query('OCA\Files_External\Lib\Auth\OpenStack\Rackspace'), |
|
| 122 | + |
|
| 123 | + // Specialized mechanisms |
|
| 124 | + $container->query('OCA\Files_External\Lib\Auth\AmazonS3\AccessKey'), |
|
| 125 | + ]; |
|
| 126 | + } |
|
| 127 | 127 | |
| 128 | 128 | } |