@@ -20,12 +20,12 @@ |
||
20 | 20 | <ul id="listOfTrustedServers"> |
21 | 21 | <?php foreach ($_['trustedServers'] as $trustedServer) { ?> |
22 | 22 | <li id="<?php p($trustedServer['id']); ?>"> |
23 | - <?php if ((int)$trustedServer['status'] === TrustedServers::STATUS_OK) { ?> |
|
23 | + <?php if ((int) $trustedServer['status'] === TrustedServers::STATUS_OK) { ?> |
|
24 | 24 | <span class="status success"></span> |
25 | 25 | <?php |
26 | 26 | } elseif ( |
27 | - (int)$trustedServer['status'] === TrustedServers::STATUS_PENDING || |
|
28 | - (int)$trustedServer['status'] === TrustedServers::STATUS_ACCESS_REVOKED |
|
27 | + (int) $trustedServer['status'] === TrustedServers::STATUS_PENDING || |
|
28 | + (int) $trustedServer['status'] === TrustedServers::STATUS_ACCESS_REVOKED |
|
29 | 29 | ) { ?> |
30 | 30 | <span class="status indeterminate"></span> |
31 | 31 | <?php } else {?> |
@@ -16,10 +16,10 @@ |
||
16 | 16 | <?php if ((int)$trustedServer['status'] === TrustedServers::STATUS_OK) { ?> |
17 | 17 | <span class="status success"></span> |
18 | 18 | <?php |
19 | - } elseif ( |
|
20 | - (int)$trustedServer['status'] === TrustedServers::STATUS_PENDING || |
|
21 | - (int)$trustedServer['status'] === TrustedServers::STATUS_ACCESS_REVOKED |
|
22 | - ) { ?> |
|
19 | + } elseif ( |
|
20 | + (int)$trustedServer['status'] === TrustedServers::STATUS_PENDING || |
|
21 | + (int)$trustedServer['status'] === TrustedServers::STATUS_ACCESS_REVOKED |
|
22 | + ) { ?> |
|
23 | 23 | <span class="status indeterminate"></span> |
24 | 24 | <?php } else {?> |
25 | 25 | <span class="status error"></span> |
@@ -32,23 +32,23 @@ |
||
32 | 32 | * OAuth1 authentication |
33 | 33 | */ |
34 | 34 | class OAuth1 extends AuthMechanism { |
35 | - public function __construct(IL10N $l) { |
|
36 | - $this |
|
37 | - ->setIdentifier('oauth1::oauth1') |
|
38 | - ->setScheme(self::SCHEME_OAUTH1) |
|
39 | - ->setText($l->t('OAuth1')) |
|
40 | - ->addParameters([ |
|
41 | - (new DefinitionParameter('configured', 'configured')) |
|
42 | - ->setType(DefinitionParameter::VALUE_HIDDEN), |
|
43 | - new DefinitionParameter('app_key', $l->t('App key')), |
|
44 | - (new DefinitionParameter('app_secret', $l->t('App secret'))) |
|
45 | - ->setType(DefinitionParameter::VALUE_PASSWORD), |
|
46 | - (new DefinitionParameter('token', 'token')) |
|
47 | - ->setType(DefinitionParameter::VALUE_HIDDEN), |
|
48 | - (new DefinitionParameter('token_secret', 'token_secret')) |
|
49 | - ->setType(DefinitionParameter::VALUE_HIDDEN), |
|
50 | - ]) |
|
51 | - ->addCustomJs('oauth1') |
|
52 | - ; |
|
53 | - } |
|
35 | + public function __construct(IL10N $l) { |
|
36 | + $this |
|
37 | + ->setIdentifier('oauth1::oauth1') |
|
38 | + ->setScheme(self::SCHEME_OAUTH1) |
|
39 | + ->setText($l->t('OAuth1')) |
|
40 | + ->addParameters([ |
|
41 | + (new DefinitionParameter('configured', 'configured')) |
|
42 | + ->setType(DefinitionParameter::VALUE_HIDDEN), |
|
43 | + new DefinitionParameter('app_key', $l->t('App key')), |
|
44 | + (new DefinitionParameter('app_secret', $l->t('App secret'))) |
|
45 | + ->setType(DefinitionParameter::VALUE_PASSWORD), |
|
46 | + (new DefinitionParameter('token', 'token')) |
|
47 | + ->setType(DefinitionParameter::VALUE_HIDDEN), |
|
48 | + (new DefinitionParameter('token_secret', 'token_secret')) |
|
49 | + ->setType(DefinitionParameter::VALUE_HIDDEN), |
|
50 | + ]) |
|
51 | + ->addCustomJs('oauth1') |
|
52 | + ; |
|
53 | + } |
|
54 | 54 | } |
@@ -33,18 +33,18 @@ |
||
33 | 33 | * OpenStack Keystone authentication |
34 | 34 | */ |
35 | 35 | class OpenStackV2 extends AuthMechanism { |
36 | - public function __construct(IL10N $l) { |
|
37 | - $this |
|
38 | - ->setIdentifier('openstack::openstack') |
|
39 | - ->setScheme(self::SCHEME_OPENSTACK) |
|
40 | - ->setText($l->t('OpenStack v2')) |
|
41 | - ->addParameters([ |
|
42 | - new DefinitionParameter('user', $l->t('Username')), |
|
43 | - (new DefinitionParameter('password', $l->t('Password'))) |
|
44 | - ->setType(DefinitionParameter::VALUE_PASSWORD), |
|
45 | - new DefinitionParameter('tenant', $l->t('Tenant name')), |
|
46 | - new DefinitionParameter('url', $l->t('Identity endpoint URL')), |
|
47 | - ]) |
|
48 | - ; |
|
49 | - } |
|
36 | + public function __construct(IL10N $l) { |
|
37 | + $this |
|
38 | + ->setIdentifier('openstack::openstack') |
|
39 | + ->setScheme(self::SCHEME_OPENSTACK) |
|
40 | + ->setText($l->t('OpenStack v2')) |
|
41 | + ->addParameters([ |
|
42 | + new DefinitionParameter('user', $l->t('Username')), |
|
43 | + (new DefinitionParameter('password', $l->t('Password'))) |
|
44 | + ->setType(DefinitionParameter::VALUE_PASSWORD), |
|
45 | + new DefinitionParameter('tenant', $l->t('Tenant name')), |
|
46 | + new DefinitionParameter('url', $l->t('Identity endpoint URL')), |
|
47 | + ]) |
|
48 | + ; |
|
49 | + } |
|
50 | 50 | } |
@@ -32,16 +32,16 @@ |
||
32 | 32 | * Rackspace authentication |
33 | 33 | */ |
34 | 34 | class Rackspace extends AuthMechanism { |
35 | - public function __construct(IL10N $l) { |
|
36 | - $this |
|
37 | - ->setIdentifier('openstack::rackspace') |
|
38 | - ->setScheme(self::SCHEME_OPENSTACK) |
|
39 | - ->setText($l->t('Rackspace')) |
|
40 | - ->addParameters([ |
|
41 | - new DefinitionParameter('user', $l->t('Username')), |
|
42 | - (new DefinitionParameter('key', $l->t('API key'))) |
|
43 | - ->setType(DefinitionParameter::VALUE_PASSWORD), |
|
44 | - ]) |
|
45 | - ; |
|
46 | - } |
|
35 | + public function __construct(IL10N $l) { |
|
36 | + $this |
|
37 | + ->setIdentifier('openstack::rackspace') |
|
38 | + ->setScheme(self::SCHEME_OPENSTACK) |
|
39 | + ->setText($l->t('Rackspace')) |
|
40 | + ->addParameters([ |
|
41 | + new DefinitionParameter('user', $l->t('Username')), |
|
42 | + (new DefinitionParameter('key', $l->t('API key'))) |
|
43 | + ->setType(DefinitionParameter::VALUE_PASSWORD), |
|
44 | + ]) |
|
45 | + ; |
|
46 | + } |
|
47 | 47 | } |
@@ -32,15 +32,15 @@ |
||
32 | 32 | * Basic password authentication mechanism |
33 | 33 | */ |
34 | 34 | class Password extends AuthMechanism { |
35 | - public function __construct(IL10N $l) { |
|
36 | - $this |
|
37 | - ->setIdentifier('password::password') |
|
38 | - ->setScheme(self::SCHEME_PASSWORD) |
|
39 | - ->setText($l->t('Username and password')) |
|
40 | - ->addParameters([ |
|
41 | - new DefinitionParameter('user', $l->t('Username')), |
|
42 | - (new DefinitionParameter('password', $l->t('Password'))) |
|
43 | - ->setType(DefinitionParameter::VALUE_PASSWORD), |
|
44 | - ]); |
|
45 | - } |
|
35 | + public function __construct(IL10N $l) { |
|
36 | + $this |
|
37 | + ->setIdentifier('password::password') |
|
38 | + ->setScheme(self::SCHEME_PASSWORD) |
|
39 | + ->setText($l->t('Username and password')) |
|
40 | + ->addParameters([ |
|
41 | + new DefinitionParameter('user', $l->t('Username')), |
|
42 | + (new DefinitionParameter('password', $l->t('Password'))) |
|
43 | + ->setType(DefinitionParameter::VALUE_PASSWORD), |
|
44 | + ]); |
|
45 | + } |
|
46 | 46 | } |
@@ -40,46 +40,46 @@ |
||
40 | 40 | * User provided Global Username and Password |
41 | 41 | */ |
42 | 42 | class UserGlobalAuth extends AuthMechanism { |
43 | - private const CREDENTIALS_IDENTIFIER = 'password::global'; |
|
43 | + private const CREDENTIALS_IDENTIFIER = 'password::global'; |
|
44 | 44 | |
45 | - /** @var ICredentialsManager */ |
|
46 | - protected $credentialsManager; |
|
45 | + /** @var ICredentialsManager */ |
|
46 | + protected $credentialsManager; |
|
47 | 47 | |
48 | - public function __construct(IL10N $l, ICredentialsManager $credentialsManager) { |
|
49 | - $this->credentialsManager = $credentialsManager; |
|
48 | + public function __construct(IL10N $l, ICredentialsManager $credentialsManager) { |
|
49 | + $this->credentialsManager = $credentialsManager; |
|
50 | 50 | |
51 | - $this |
|
52 | - ->setIdentifier('password::global::user') |
|
53 | - ->setVisibility(BackendService::VISIBILITY_DEFAULT) |
|
54 | - ->setScheme(self::SCHEME_PASSWORD) |
|
55 | - ->setText($l->t('Global credentials, user entered')); |
|
56 | - } |
|
51 | + $this |
|
52 | + ->setIdentifier('password::global::user') |
|
53 | + ->setVisibility(BackendService::VISIBILITY_DEFAULT) |
|
54 | + ->setScheme(self::SCHEME_PASSWORD) |
|
55 | + ->setText($l->t('Global credentials, user entered')); |
|
56 | + } |
|
57 | 57 | |
58 | - public function saveBackendOptions(IUser $user, $id, $backendOptions) { |
|
59 | - // backendOptions are set when invoked via Files app |
|
60 | - // but they are not set when invoked via ext storage settings |
|
61 | - if (!isset($backendOptions['user']) && !isset($backendOptions['password'])) { |
|
62 | - return; |
|
63 | - } |
|
64 | - // make sure we're not setting any unexpected keys |
|
65 | - $credentials = [ |
|
66 | - 'user' => $backendOptions['user'], |
|
67 | - 'password' => $backendOptions['password'], |
|
68 | - ]; |
|
69 | - $this->credentialsManager->store($user->getUID(), self::CREDENTIALS_IDENTIFIER, $credentials); |
|
70 | - } |
|
58 | + public function saveBackendOptions(IUser $user, $id, $backendOptions) { |
|
59 | + // backendOptions are set when invoked via Files app |
|
60 | + // but they are not set when invoked via ext storage settings |
|
61 | + if (!isset($backendOptions['user']) && !isset($backendOptions['password'])) { |
|
62 | + return; |
|
63 | + } |
|
64 | + // make sure we're not setting any unexpected keys |
|
65 | + $credentials = [ |
|
66 | + 'user' => $backendOptions['user'], |
|
67 | + 'password' => $backendOptions['password'], |
|
68 | + ]; |
|
69 | + $this->credentialsManager->store($user->getUID(), self::CREDENTIALS_IDENTIFIER, $credentials); |
|
70 | + } |
|
71 | 71 | |
72 | - public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) { |
|
73 | - if ($user === null) { |
|
74 | - throw new InsufficientDataForMeaningfulAnswerException('No credentials saved'); |
|
75 | - } |
|
72 | + public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) { |
|
73 | + if ($user === null) { |
|
74 | + throw new InsufficientDataForMeaningfulAnswerException('No credentials saved'); |
|
75 | + } |
|
76 | 76 | |
77 | - $uid = $user->getUID(); |
|
78 | - $credentials = $this->credentialsManager->retrieve($uid, self::CREDENTIALS_IDENTIFIER); |
|
77 | + $uid = $user->getUID(); |
|
78 | + $credentials = $this->credentialsManager->retrieve($uid, self::CREDENTIALS_IDENTIFIER); |
|
79 | 79 | |
80 | - if (is_array($credentials)) { |
|
81 | - $storage->setBackendOption('user', $credentials['user']); |
|
82 | - $storage->setBackendOption('password', $credentials['password']); |
|
83 | - } |
|
84 | - } |
|
80 | + if (is_array($credentials)) { |
|
81 | + $storage->setBackendOption('user', $credentials['user']); |
|
82 | + $storage->setBackendOption('password', $credentials['password']); |
|
83 | + } |
|
84 | + } |
|
85 | 85 | } |
@@ -69,7 +69,7 @@ |
||
69 | 69 | $this->credentialsManager->store($user->getUID(), self::CREDENTIALS_IDENTIFIER, $credentials); |
70 | 70 | } |
71 | 71 | |
72 | - public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) { |
|
72 | + public function manipulateStorageConfig(StorageConfig & $storage, IUser $user = null) { |
|
73 | 73 | if ($user === null) { |
74 | 74 | throw new InsufficientDataForMeaningfulAnswerException('No credentials saved'); |
75 | 75 | } |
@@ -32,21 +32,21 @@ |
||
32 | 32 | * OAuth2 authentication |
33 | 33 | */ |
34 | 34 | class OAuth2 extends AuthMechanism { |
35 | - public function __construct(IL10N $l) { |
|
36 | - $this |
|
37 | - ->setIdentifier('oauth2::oauth2') |
|
38 | - ->setScheme(self::SCHEME_OAUTH2) |
|
39 | - ->setText($l->t('OAuth2')) |
|
40 | - ->addParameters([ |
|
41 | - (new DefinitionParameter('configured', 'configured')) |
|
42 | - ->setType(DefinitionParameter::VALUE_HIDDEN), |
|
43 | - new DefinitionParameter('client_id', $l->t('Client ID')), |
|
44 | - (new DefinitionParameter('client_secret', $l->t('Client secret'))) |
|
45 | - ->setType(DefinitionParameter::VALUE_PASSWORD), |
|
46 | - (new DefinitionParameter('token', 'token')) |
|
47 | - ->setType(DefinitionParameter::VALUE_HIDDEN), |
|
48 | - ]) |
|
49 | - ->addCustomJs('oauth2') |
|
50 | - ; |
|
51 | - } |
|
35 | + public function __construct(IL10N $l) { |
|
36 | + $this |
|
37 | + ->setIdentifier('oauth2::oauth2') |
|
38 | + ->setScheme(self::SCHEME_OAUTH2) |
|
39 | + ->setText($l->t('OAuth2')) |
|
40 | + ->addParameters([ |
|
41 | + (new DefinitionParameter('configured', 'configured')) |
|
42 | + ->setType(DefinitionParameter::VALUE_HIDDEN), |
|
43 | + new DefinitionParameter('client_id', $l->t('Client ID')), |
|
44 | + (new DefinitionParameter('client_secret', $l->t('Client secret'))) |
|
45 | + ->setType(DefinitionParameter::VALUE_PASSWORD), |
|
46 | + (new DefinitionParameter('token', 'token')) |
|
47 | + ->setType(DefinitionParameter::VALUE_HIDDEN), |
|
48 | + ]) |
|
49 | + ->addCustomJs('oauth2') |
|
50 | + ; |
|
51 | + } |
|
52 | 52 | } |
@@ -30,19 +30,19 @@ |
||
30 | 30 | use OCP\IL10N; |
31 | 31 | |
32 | 32 | class SFTP_Key extends Backend { |
33 | - public function __construct(IL10N $l, RSA $legacyAuth, SFTP $sftpBackend) { |
|
34 | - $this |
|
35 | - ->setIdentifier('\OC\Files\Storage\SFTP_Key') |
|
36 | - ->setStorageClass('\OCA\Files_External\Lib\Storage\SFTP') |
|
37 | - ->setText($l->t('SFTP with secret key login')) |
|
38 | - ->addParameters([ |
|
39 | - new DefinitionParameter('host', $l->t('Host')), |
|
40 | - (new DefinitionParameter('root', $l->t('Remote subfolder'))) |
|
41 | - ->setFlag(DefinitionParameter::FLAG_OPTIONAL), |
|
42 | - ]) |
|
43 | - ->addAuthScheme(AuthMechanism::SCHEME_PUBLICKEY) |
|
44 | - ->setLegacyAuthMechanism($legacyAuth) |
|
45 | - ->deprecateTo($sftpBackend) |
|
46 | - ; |
|
47 | - } |
|
33 | + public function __construct(IL10N $l, RSA $legacyAuth, SFTP $sftpBackend) { |
|
34 | + $this |
|
35 | + ->setIdentifier('\OC\Files\Storage\SFTP_Key') |
|
36 | + ->setStorageClass('\OCA\Files_External\Lib\Storage\SFTP') |
|
37 | + ->setText($l->t('SFTP with secret key login')) |
|
38 | + ->addParameters([ |
|
39 | + new DefinitionParameter('host', $l->t('Host')), |
|
40 | + (new DefinitionParameter('root', $l->t('Remote subfolder'))) |
|
41 | + ->setFlag(DefinitionParameter::FLAG_OPTIONAL), |
|
42 | + ]) |
|
43 | + ->addAuthScheme(AuthMechanism::SCHEME_PUBLICKEY) |
|
44 | + ->setLegacyAuthMechanism($legacyAuth) |
|
45 | + ->deprecateTo($sftpBackend) |
|
46 | + ; |
|
47 | + } |
|
48 | 48 | } |
@@ -31,19 +31,19 @@ |
||
31 | 31 | use OCP\IL10N; |
32 | 32 | |
33 | 33 | class Local extends Backend { |
34 | - public function __construct(IL10N $l, NullMechanism $legacyAuth) { |
|
35 | - $this |
|
36 | - ->setIdentifier('local') |
|
37 | - ->addIdentifierAlias('\OC\Files\Storage\Local') // legacy compat |
|
38 | - ->setStorageClass('\OC\Files\Storage\Local') |
|
39 | - ->setText($l->t('Local')) |
|
40 | - ->addParameters([ |
|
41 | - new DefinitionParameter('datadir', $l->t('Location')), |
|
42 | - ]) |
|
43 | - ->setAllowedVisibility(BackendService::VISIBILITY_ADMIN) |
|
44 | - ->setPriority(BackendService::PRIORITY_DEFAULT + 50) |
|
45 | - ->addAuthScheme(AuthMechanism::SCHEME_NULL) |
|
46 | - ->setLegacyAuthMechanism($legacyAuth) |
|
47 | - ; |
|
48 | - } |
|
34 | + public function __construct(IL10N $l, NullMechanism $legacyAuth) { |
|
35 | + $this |
|
36 | + ->setIdentifier('local') |
|
37 | + ->addIdentifierAlias('\OC\Files\Storage\Local') // legacy compat |
|
38 | + ->setStorageClass('\OC\Files\Storage\Local') |
|
39 | + ->setText($l->t('Local')) |
|
40 | + ->addParameters([ |
|
41 | + new DefinitionParameter('datadir', $l->t('Location')), |
|
42 | + ]) |
|
43 | + ->setAllowedVisibility(BackendService::VISIBILITY_ADMIN) |
|
44 | + ->setPriority(BackendService::PRIORITY_DEFAULT + 50) |
|
45 | + ->addAuthScheme(AuthMechanism::SCHEME_NULL) |
|
46 | + ->setLegacyAuthMechanism($legacyAuth) |
|
47 | + ; |
|
48 | + } |
|
49 | 49 | } |