Passed
Push — master ( 078203...c81798 )
by Joas
14:40 queued 14s
created
apps/files_sharing/lib/Listener/UserShareAcceptanceListener.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -38,47 +38,47 @@
 block discarded – undo
38 38
 
39 39
 class UserShareAcceptanceListener implements IEventListener {
40 40
 
41
-	/** @var IConfig */
42
-	private $config;
43
-	/** @var IManager */
44
-	private $shareManager;
45
-	/** @var IGroupManager */
46
-	private $groupManager;
41
+    /** @var IConfig */
42
+    private $config;
43
+    /** @var IManager */
44
+    private $shareManager;
45
+    /** @var IGroupManager */
46
+    private $groupManager;
47 47
 
48
-	public function __construct(IConfig $config, IManager $shareManager, IGroupManager $groupManager) {
49
-		$this->config = $config;
50
-		$this->shareManager = $shareManager;
51
-		$this->groupManager = $groupManager;
52
-	}
48
+    public function __construct(IConfig $config, IManager $shareManager, IGroupManager $groupManager) {
49
+        $this->config = $config;
50
+        $this->shareManager = $shareManager;
51
+        $this->groupManager = $groupManager;
52
+    }
53 53
 
54
-	public function handle(Event $event): void {
55
-		if (!($event instanceof ShareCreatedEvent)) {
56
-			return;
57
-		}
54
+    public function handle(Event $event): void {
55
+        if (!($event instanceof ShareCreatedEvent)) {
56
+            return;
57
+        }
58 58
 
59
-		$share = $event->getShare();
59
+        $share = $event->getShare();
60 60
 
61
-		if ($share->getShareType() === IShare::TYPE_USER) {
62
-			$this->handleAutoAccept($share, $share->getSharedWith());
63
-		} elseif ($share->getShareType() === IShare::TYPE_GROUP) {
64
-			$group = $this->groupManager->get($share->getSharedWith());
61
+        if ($share->getShareType() === IShare::TYPE_USER) {
62
+            $this->handleAutoAccept($share, $share->getSharedWith());
63
+        } elseif ($share->getShareType() === IShare::TYPE_GROUP) {
64
+            $group = $this->groupManager->get($share->getSharedWith());
65 65
 
66
-			if ($group === null) {
67
-				return;
68
-			}
66
+            if ($group === null) {
67
+                return;
68
+            }
69 69
 
70
-			$users = $group->getUsers();
71
-			foreach ($users as $user) {
72
-				$this->handleAutoAccept($share, $user->getUID());
73
-			}
74
-		}
75
-	}
70
+            $users = $group->getUsers();
71
+            foreach ($users as $user) {
72
+                $this->handleAutoAccept($share, $user->getUID());
73
+            }
74
+        }
75
+    }
76 76
 
77
-	private function handleAutoAccept(IShare $share, string $userId) {
78
-		$defaultAcceptSystemConfig = $this->config->getSystemValueBool('sharing.enable_share_accept', false) ? 'no' : 'yes';
79
-		$acceptDefault = $this->config->getUserValue($userId, Application::APP_ID, 'default_accept', $defaultAcceptSystemConfig) === 'yes';
80
-		if (!$this->config->getSystemValueBool('sharing.force_share_accept', false) && $acceptDefault) {
81
-			$this->shareManager->acceptShare($share, $userId);
82
-		}
83
-	}
77
+    private function handleAutoAccept(IShare $share, string $userId) {
78
+        $defaultAcceptSystemConfig = $this->config->getSystemValueBool('sharing.enable_share_accept', false) ? 'no' : 'yes';
79
+        $acceptDefault = $this->config->getUserValue($userId, Application::APP_ID, 'default_accept', $defaultAcceptSystemConfig) === 'yes';
80
+        if (!$this->config->getSystemValueBool('sharing.force_share_accept', false) && $acceptDefault) {
81
+            $this->shareManager->acceptShare($share, $userId);
82
+        }
83
+    }
84 84
 }
Please login to merge, or discard this patch.
apps/files_external/lib/Lib/Auth/OAuth1/OAuth1.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -32,23 +32,23 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
apps/files_external/lib/Lib/Auth/OpenStack/OpenStackV2.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -33,18 +33,18 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
apps/files_external/lib/Lib/Auth/OpenStack/Rackspace.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -32,16 +32,16 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
apps/files_external/lib/Lib/Auth/Password/Password.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -32,15 +32,15 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
apps/files_external/lib/Lib/Auth/Password/UserGlobalAuth.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -40,46 +40,46 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
apps/files_external/lib/Lib/Auth/OAuth2/OAuth2.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -32,21 +32,21 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
apps/files_external/lib/Lib/Backend/SFTP_Key.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -30,19 +30,19 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
apps/files_external/lib/Lib/Backend/Local.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -31,19 +31,19 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.