Completed
Push — master ( 2f1c74...56897b )
by Robin
28:53 queued 13s
created
lib/private/Authentication/WebAuthn/CredentialRepository.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
 		$uid = $publicKeyCredentialUserEntity->getId();
57 57
 		$entities = $this->credentialMapper->findAllForUid($uid);
58 58
 
59
-		return array_map(function (PublicKeyCredentialEntity $entity) {
59
+		return array_map(function(PublicKeyCredentialEntity $entity) {
60 60
 			return $entity->toPublicKeyCredentialSource();
61 61
 		}, $entities);
62 62
 	}
Please login to merge, or discard this patch.
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -16,66 +16,66 @@
 block discarded – undo
16 16
 use Webauthn\PublicKeyCredentialUserEntity;
17 17
 
18 18
 class CredentialRepository implements PublicKeyCredentialSourceRepository {
19
-	/** @var PublicKeyCredentialMapper */
20
-	private $credentialMapper;
21
-
22
-	public function __construct(PublicKeyCredentialMapper $credentialMapper) {
23
-		$this->credentialMapper = $credentialMapper;
24
-	}
25
-
26
-	public function findOneByCredentialId(string $publicKeyCredentialId): ?PublicKeyCredentialSource {
27
-		try {
28
-			$entity = $this->credentialMapper->findOneByCredentialId($publicKeyCredentialId);
29
-			return $entity->toPublicKeyCredentialSource();
30
-		} catch (IMapperException $e) {
31
-			return  null;
32
-		}
33
-	}
34
-
35
-	/**
36
-	 * @return PublicKeyCredentialSource[]
37
-	 */
38
-	public function findAllForUserEntity(PublicKeyCredentialUserEntity $publicKeyCredentialUserEntity): array {
39
-		$uid = $publicKeyCredentialUserEntity->getId();
40
-		$entities = $this->credentialMapper->findAllForUid($uid);
41
-
42
-		return array_map(function (PublicKeyCredentialEntity $entity) {
43
-			return $entity->toPublicKeyCredentialSource();
44
-		}, $entities);
45
-	}
46
-
47
-	public function saveAndReturnCredentialSource(PublicKeyCredentialSource $publicKeyCredentialSource, ?string $name = null, bool $userVerification = false): PublicKeyCredentialEntity {
48
-		$oldEntity = null;
49
-
50
-		try {
51
-			$oldEntity = $this->credentialMapper->findOneByCredentialId($publicKeyCredentialSource->getPublicKeyCredentialId());
52
-		} catch (IMapperException $e) {
53
-		}
54
-
55
-		$defaultName = false;
56
-		if ($name === null) {
57
-			$defaultName = true;
58
-			$name = 'default';
59
-		}
60
-
61
-		$entity = PublicKeyCredentialEntity::fromPublicKeyCrendentialSource($name, $publicKeyCredentialSource, $userVerification);
62
-
63
-		if ($oldEntity) {
64
-			$entity->setId($oldEntity->getId());
65
-			if ($defaultName) {
66
-				$entity->setName($oldEntity->getName());
67
-			}
68
-
69
-			// Don't downgrade UV just because it was skipped during a login due to another key
70
-			if ($oldEntity->getUserVerification()) {
71
-				$entity->setUserVerification(true);
72
-			}
73
-		}
74
-
75
-		return $this->credentialMapper->insertOrUpdate($entity);
76
-	}
77
-
78
-	public function saveCredentialSource(PublicKeyCredentialSource $publicKeyCredentialSource, ?string $name = null): void {
79
-		$this->saveAndReturnCredentialSource($publicKeyCredentialSource, $name);
80
-	}
19
+    /** @var PublicKeyCredentialMapper */
20
+    private $credentialMapper;
21
+
22
+    public function __construct(PublicKeyCredentialMapper $credentialMapper) {
23
+        $this->credentialMapper = $credentialMapper;
24
+    }
25
+
26
+    public function findOneByCredentialId(string $publicKeyCredentialId): ?PublicKeyCredentialSource {
27
+        try {
28
+            $entity = $this->credentialMapper->findOneByCredentialId($publicKeyCredentialId);
29
+            return $entity->toPublicKeyCredentialSource();
30
+        } catch (IMapperException $e) {
31
+            return  null;
32
+        }
33
+    }
34
+
35
+    /**
36
+     * @return PublicKeyCredentialSource[]
37
+     */
38
+    public function findAllForUserEntity(PublicKeyCredentialUserEntity $publicKeyCredentialUserEntity): array {
39
+        $uid = $publicKeyCredentialUserEntity->getId();
40
+        $entities = $this->credentialMapper->findAllForUid($uid);
41
+
42
+        return array_map(function (PublicKeyCredentialEntity $entity) {
43
+            return $entity->toPublicKeyCredentialSource();
44
+        }, $entities);
45
+    }
46
+
47
+    public function saveAndReturnCredentialSource(PublicKeyCredentialSource $publicKeyCredentialSource, ?string $name = null, bool $userVerification = false): PublicKeyCredentialEntity {
48
+        $oldEntity = null;
49
+
50
+        try {
51
+            $oldEntity = $this->credentialMapper->findOneByCredentialId($publicKeyCredentialSource->getPublicKeyCredentialId());
52
+        } catch (IMapperException $e) {
53
+        }
54
+
55
+        $defaultName = false;
56
+        if ($name === null) {
57
+            $defaultName = true;
58
+            $name = 'default';
59
+        }
60
+
61
+        $entity = PublicKeyCredentialEntity::fromPublicKeyCrendentialSource($name, $publicKeyCredentialSource, $userVerification);
62
+
63
+        if ($oldEntity) {
64
+            $entity->setId($oldEntity->getId());
65
+            if ($defaultName) {
66
+                $entity->setName($oldEntity->getName());
67
+            }
68
+
69
+            // Don't downgrade UV just because it was skipped during a login due to another key
70
+            if ($oldEntity->getUserVerification()) {
71
+                $entity->setUserVerification(true);
72
+            }
73
+        }
74
+
75
+        return $this->credentialMapper->insertOrUpdate($entity);
76
+    }
77
+
78
+    public function saveCredentialSource(PublicKeyCredentialSource $publicKeyCredentialSource, ?string $name = null): void {
79
+        $this->saveAndReturnCredentialSource($publicKeyCredentialSource, $name);
80
+    }
81 81
 }
Please login to merge, or discard this patch.
apps/dav/lib/CardDAV/Integration/IAddressBookProvider.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -31,43 +31,43 @@
 block discarded – undo
31 31
  */
32 32
 interface IAddressBookProvider {
33 33
 
34
-	/**
35
-	 * Provides the appId of the plugin
36
-	 *
37
-	 * @since 19.0.0
38
-	 * @return string AppId
39
-	 */
40
-	public function getAppId(): string;
34
+    /**
35
+     * Provides the appId of the plugin
36
+     *
37
+     * @since 19.0.0
38
+     * @return string AppId
39
+     */
40
+    public function getAppId(): string;
41 41
 
42
-	/**
43
-	 * Fetches all address books for a given principal uri
44
-	 *
45
-	 * @since 19.0.0
46
-	 * @param string $principalUri E.g. principals/users/user1
47
-	 * @return ExternalAddressBook[] Array of all address books
48
-	 */
49
-	public function fetchAllForAddressBookHome(string $principalUri): array;
42
+    /**
43
+     * Fetches all address books for a given principal uri
44
+     *
45
+     * @since 19.0.0
46
+     * @param string $principalUri E.g. principals/users/user1
47
+     * @return ExternalAddressBook[] Array of all address books
48
+     */
49
+    public function fetchAllForAddressBookHome(string $principalUri): array;
50 50
 
51
-	/**
52
-	 * Checks whether plugin has an address book for a given principalUri and URI
53
-	 *
54
-	 * @since 19.0.0
55
-	 * @param string $principalUri E.g. principals/users/user1
56
-	 * @param string $uri E.g. personal
57
-	 * @return bool True if address book for principalUri and URI exists, false otherwise
58
-	 */
59
-	public function hasAddressBookInAddressBookHome(string $principalUri, string $uri): bool;
51
+    /**
52
+     * Checks whether plugin has an address book for a given principalUri and URI
53
+     *
54
+     * @since 19.0.0
55
+     * @param string $principalUri E.g. principals/users/user1
56
+     * @param string $uri E.g. personal
57
+     * @return bool True if address book for principalUri and URI exists, false otherwise
58
+     */
59
+    public function hasAddressBookInAddressBookHome(string $principalUri, string $uri): bool;
60 60
 
61
-	/**
62
-	 * Fetches an address book for a given principalUri and URI
63
-	 * Returns null if address book does not exist
64
-	 *
65
-	 * @param string $principalUri E.g. principals/users/user1
66
-	 * @param string $uri E.g. personal
67
-	 *
68
-	 * @return ExternalAddressBook|null address book if it exists, null otherwise
69
-	 *@since 19.0.0
70
-	 */
71
-	public function getAddressBookInAddressBookHome(string $principalUri, string $uri): ?ExternalAddressBook;
61
+    /**
62
+     * Fetches an address book for a given principalUri and URI
63
+     * Returns null if address book does not exist
64
+     *
65
+     * @param string $principalUri E.g. principals/users/user1
66
+     * @param string $uri E.g. personal
67
+     *
68
+     * @return ExternalAddressBook|null address book if it exists, null otherwise
69
+     *@since 19.0.0
70
+     */
71
+    public function getAddressBookInAddressBookHome(string $principalUri, string $uri): ?ExternalAddressBook;
72 72
 
73 73
 }
Please login to merge, or discard this patch.
core/Controller/WebAuthnController.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@
 block discarded – undo
77 77
 			'preLoginNameUsedAsUserName',
78 78
 			['uid' => &$uid]
79 79
 		);
80
-		$this->logger->debug('Got UID: ' . $uid);
80
+		$this->logger->debug('Got UID: '.$uid);
81 81
 
82 82
 		$publicKeyCredentialRequestOptions = $this->webAuthnManger->startAuthentication($uid, $this->request->getServerHost());
83 83
 		$this->session->set(self::WEBAUTHN_LOGIN, json_encode($publicKeyCredentialRequestOptions));
Please login to merge, or discard this patch.
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -25,69 +25,69 @@
 block discarded – undo
25 25
 use Webauthn\PublicKeyCredentialRequestOptions;
26 26
 
27 27
 class WebAuthnController extends Controller {
28
-	private const WEBAUTHN_LOGIN = 'webauthn_login';
29
-	private const WEBAUTHN_LOGIN_UID = 'webauthn_login_uid';
28
+    private const WEBAUTHN_LOGIN = 'webauthn_login';
29
+    private const WEBAUTHN_LOGIN_UID = 'webauthn_login_uid';
30 30
 
31
-	public function __construct(
32
-		string $appName,
33
-		IRequest $request,
34
-		private Manager $webAuthnManger,
35
-		private ISession $session,
36
-		private LoggerInterface $logger,
37
-		private WebAuthnChain $webAuthnChain,
38
-		private URLGenerator $urlGenerator,
39
-	) {
40
-		parent::__construct($appName, $request);
41
-	}
31
+    public function __construct(
32
+        string $appName,
33
+        IRequest $request,
34
+        private Manager $webAuthnManger,
35
+        private ISession $session,
36
+        private LoggerInterface $logger,
37
+        private WebAuthnChain $webAuthnChain,
38
+        private URLGenerator $urlGenerator,
39
+    ) {
40
+        parent::__construct($appName, $request);
41
+    }
42 42
 
43
-	#[PublicPage]
44
-	#[UseSession]
45
-	#[FrontpageRoute(verb: 'POST', url: 'login/webauthn/start')]
46
-	public function startAuthentication(string $loginName): JSONResponse {
47
-		$this->logger->debug('Starting WebAuthn login');
43
+    #[PublicPage]
44
+    #[UseSession]
45
+    #[FrontpageRoute(verb: 'POST', url: 'login/webauthn/start')]
46
+    public function startAuthentication(string $loginName): JSONResponse {
47
+        $this->logger->debug('Starting WebAuthn login');
48 48
 
49
-		$this->logger->debug('Converting login name to UID');
50
-		$uid = $loginName;
51
-		Util::emitHook(
52
-			'\OCA\Files_Sharing\API\Server2Server',
53
-			'preLoginNameUsedAsUserName',
54
-			['uid' => &$uid]
55
-		);
56
-		$this->logger->debug('Got UID: ' . $uid);
49
+        $this->logger->debug('Converting login name to UID');
50
+        $uid = $loginName;
51
+        Util::emitHook(
52
+            '\OCA\Files_Sharing\API\Server2Server',
53
+            'preLoginNameUsedAsUserName',
54
+            ['uid' => &$uid]
55
+        );
56
+        $this->logger->debug('Got UID: ' . $uid);
57 57
 
58
-		$publicKeyCredentialRequestOptions = $this->webAuthnManger->startAuthentication($uid, $this->request->getServerHost());
59
-		$this->session->set(self::WEBAUTHN_LOGIN, json_encode($publicKeyCredentialRequestOptions));
60
-		$this->session->set(self::WEBAUTHN_LOGIN_UID, $uid);
58
+        $publicKeyCredentialRequestOptions = $this->webAuthnManger->startAuthentication($uid, $this->request->getServerHost());
59
+        $this->session->set(self::WEBAUTHN_LOGIN, json_encode($publicKeyCredentialRequestOptions));
60
+        $this->session->set(self::WEBAUTHN_LOGIN_UID, $uid);
61 61
 
62
-		return new JSONResponse($publicKeyCredentialRequestOptions);
63
-	}
62
+        return new JSONResponse($publicKeyCredentialRequestOptions);
63
+    }
64 64
 
65
-	#[PublicPage]
66
-	#[UseSession]
67
-	#[FrontpageRoute(verb: 'POST', url: 'login/webauthn/finish')]
68
-	public function finishAuthentication(string $data): JSONResponse {
69
-		$this->logger->debug('Validating WebAuthn login');
65
+    #[PublicPage]
66
+    #[UseSession]
67
+    #[FrontpageRoute(verb: 'POST', url: 'login/webauthn/finish')]
68
+    public function finishAuthentication(string $data): JSONResponse {
69
+        $this->logger->debug('Validating WebAuthn login');
70 70
 
71
-		if (!$this->session->exists(self::WEBAUTHN_LOGIN) || !$this->session->exists(self::WEBAUTHN_LOGIN_UID)) {
72
-			$this->logger->debug('Trying to finish WebAuthn login without session data');
73
-			return new JSONResponse([], Http::STATUS_BAD_REQUEST);
74
-		}
71
+        if (!$this->session->exists(self::WEBAUTHN_LOGIN) || !$this->session->exists(self::WEBAUTHN_LOGIN_UID)) {
72
+            $this->logger->debug('Trying to finish WebAuthn login without session data');
73
+            return new JSONResponse([], Http::STATUS_BAD_REQUEST);
74
+        }
75 75
 
76
-		// Obtain the publicKeyCredentialOptions from when we started the registration
77
-		$publicKeyCredentialRequestOptions = PublicKeyCredentialRequestOptions::createFromString($this->session->get(self::WEBAUTHN_LOGIN));
78
-		$uid = $this->session->get(self::WEBAUTHN_LOGIN_UID);
79
-		$this->webAuthnManger->finishAuthentication($publicKeyCredentialRequestOptions, $data, $uid);
76
+        // Obtain the publicKeyCredentialOptions from when we started the registration
77
+        $publicKeyCredentialRequestOptions = PublicKeyCredentialRequestOptions::createFromString($this->session->get(self::WEBAUTHN_LOGIN));
78
+        $uid = $this->session->get(self::WEBAUTHN_LOGIN_UID);
79
+        $this->webAuthnManger->finishAuthentication($publicKeyCredentialRequestOptions, $data, $uid);
80 80
 
81
-		//TODO: add other parameters
82
-		$loginData = new LoginData(
83
-			$this->request,
84
-			$uid,
85
-			''
86
-		);
87
-		$this->webAuthnChain->process($loginData);
81
+        //TODO: add other parameters
82
+        $loginData = new LoginData(
83
+            $this->request,
84
+            $uid,
85
+            ''
86
+        );
87
+        $this->webAuthnChain->process($loginData);
88 88
 
89
-		return new JSONResponse([
90
-			'defaultRedirectUrl' => $this->urlGenerator->linkToDefaultPageUrl(),
91
-		]);
92
-	}
89
+        return new JSONResponse([
90
+            'defaultRedirectUrl' => $this->urlGenerator->linkToDefaultPageUrl(),
91
+        ]);
92
+    }
93 93
 }
Please login to merge, or discard this patch.
core/templates/loginflowv2/authpicker.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
 	<h2><?php p($l->t('Connect to your account')) ?></h2>
31 31
 	<p class="info">
32 32
 		<?php print_unescaped($l->t('Please log in before granting %1$s access to your %2$s account.', [
33
-			'<strong>' . \OCP\Util::sanitizeHTML($_['client']) . '</strong>',
33
+			'<strong>'.\OCP\Util::sanitizeHTML($_['client']).'</strong>',
34 34
 			\OCP\Util::sanitizeHTML($_['instanceName'])
35 35
 		])) ?>
36 36
 	</p>
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,9 +31,9 @@
 block discarded – undo
31 31
 	<h2><?php p($l->t('Connect to your account')) ?></h2>
32 32
 	<p class="info">
33 33
 		<?php print_unescaped($l->t('Please log in before granting %1$s access to your %2$s account.', [
34
-			'<strong>' . \OCP\Util::sanitizeHTML($_['client']) . '</strong>',
35
-			\OCP\Util::sanitizeHTML($_['instanceName'])
36
-		])) ?>
34
+            '<strong>' . \OCP\Util::sanitizeHTML($_['client']) . '</strong>',
35
+            \OCP\Util::sanitizeHTML($_['instanceName'])
36
+        ])) ?>
37 37
 	</p>
38 38
 
39 39
 	<div class="notecard warning">
Please login to merge, or discard this patch.
apps/files_trashbin/lib/Sabre/TrashFolderFile.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 namespace OCA\Files_Trashbin\Sabre;
29 29
 
30 30
 class TrashFolderFile extends AbstractTrashFile {
31
-	public function get() {
32
-		return $this->data->getStorage()->fopen($this->data->getInternalPath(), 'rb');
33
-	}
31
+    public function get() {
32
+        return $this->data->getStorage()->fopen($this->data->getInternalPath(), 'rb');
33
+    }
34 34
 }
Please login to merge, or discard this patch.
lib/private/Authentication/Token/INamedToken.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -28,11 +28,11 @@
 block discarded – undo
28 28
 namespace OC\Authentication\Token;
29 29
 
30 30
 interface INamedToken extends IToken {
31
-	/**
32
-	 * Set token name
33
-	 *
34
-	 * @param string $name
35
-	 * @return void
36
-	 */
37
-	public function setName(string $name): void;
31
+    /**
32
+     * Set token name
33
+     *
34
+     * @param string $name
35
+     * @return void
36
+     */
37
+    public function setName(string $name): void;
38 38
 }
Please login to merge, or discard this patch.
apps/twofactor_backupcodes/lib/Provider/BackupCodesProvider.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -143,7 +143,7 @@
 block discarded – undo
143 143
 	 * @return boolean
144 144
 	 */
145 145
 	public function isActive(IUser $user): bool {
146
-		$appIds = array_filter($this->appManager->getEnabledAppsForUser($user), function ($appId) {
146
+		$appIds = array_filter($this->appManager->getEnabledAppsForUser($user), function($appId) {
147 147
 			return $appId !== $this->appName;
148 148
 		});
149 149
 		foreach ($appIds as $appId) {
Please login to merge, or discard this patch.
Indentation   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -22,120 +22,120 @@
 block discarded – undo
22 22
 
23 23
 class BackupCodesProvider implements IDeactivatableByAdmin, IProvidesPersonalSettings {
24 24
 
25
-	/** @var AppManager */
26
-	private $appManager;
25
+    /** @var AppManager */
26
+    private $appManager;
27 27
 
28
-	/**
29
-	 * @param string $appName
30
-	 * @param BackupCodeStorage $storage
31
-	 * @param IL10N $l10n
32
-	 * @param AppManager $appManager
33
-	 */
34
-	public function __construct(
35
-		private string $appName,
36
-		private BackupCodeStorage $storage,
37
-		private IL10N $l10n,
38
-		AppManager $appManager,
39
-		private IInitialStateService $initialStateService,
40
-		private ITemplateManager $templateManager,
41
-	) {
42
-		$this->appManager = $appManager;
43
-	}
28
+    /**
29
+     * @param string $appName
30
+     * @param BackupCodeStorage $storage
31
+     * @param IL10N $l10n
32
+     * @param AppManager $appManager
33
+     */
34
+    public function __construct(
35
+        private string $appName,
36
+        private BackupCodeStorage $storage,
37
+        private IL10N $l10n,
38
+        AppManager $appManager,
39
+        private IInitialStateService $initialStateService,
40
+        private ITemplateManager $templateManager,
41
+    ) {
42
+        $this->appManager = $appManager;
43
+    }
44 44
 
45
-	/**
46
-	 * Get unique identifier of this 2FA provider
47
-	 *
48
-	 * @return string
49
-	 */
50
-	public function getId(): string {
51
-		return 'backup_codes';
52
-	}
45
+    /**
46
+     * Get unique identifier of this 2FA provider
47
+     *
48
+     * @return string
49
+     */
50
+    public function getId(): string {
51
+        return 'backup_codes';
52
+    }
53 53
 
54
-	/**
55
-	 * Get the display name for selecting the 2FA provider
56
-	 *
57
-	 * @return string
58
-	 */
59
-	public function getDisplayName(): string {
60
-		return $this->l10n->t('Backup code');
61
-	}
54
+    /**
55
+     * Get the display name for selecting the 2FA provider
56
+     *
57
+     * @return string
58
+     */
59
+    public function getDisplayName(): string {
60
+        return $this->l10n->t('Backup code');
61
+    }
62 62
 
63
-	/**
64
-	 * Get the description for selecting the 2FA provider
65
-	 *
66
-	 * @return string
67
-	 */
68
-	public function getDescription(): string {
69
-		return $this->l10n->t('Use backup code');
70
-	}
63
+    /**
64
+     * Get the description for selecting the 2FA provider
65
+     *
66
+     * @return string
67
+     */
68
+    public function getDescription(): string {
69
+        return $this->l10n->t('Use backup code');
70
+    }
71 71
 
72
-	/**
73
-	 * Get the template for rending the 2FA provider view
74
-	 *
75
-	 * @param IUser $user
76
-	 * @return ITemplate
77
-	 */
78
-	public function getTemplate(IUser $user): ITemplate {
79
-		return $this->templateManager->getTemplate('twofactor_backupcodes', 'challenge');
80
-	}
72
+    /**
73
+     * Get the template for rending the 2FA provider view
74
+     *
75
+     * @param IUser $user
76
+     * @return ITemplate
77
+     */
78
+    public function getTemplate(IUser $user): ITemplate {
79
+        return $this->templateManager->getTemplate('twofactor_backupcodes', 'challenge');
80
+    }
81 81
 
82
-	/**
83
-	 * Verify the given challenge
84
-	 *
85
-	 * @param IUser $user
86
-	 * @param string $challenge
87
-	 * @return bool
88
-	 */
89
-	public function verifyChallenge(IUser $user, string $challenge): bool {
90
-		return $this->storage->validateCode($user, $challenge);
91
-	}
82
+    /**
83
+     * Verify the given challenge
84
+     *
85
+     * @param IUser $user
86
+     * @param string $challenge
87
+     * @return bool
88
+     */
89
+    public function verifyChallenge(IUser $user, string $challenge): bool {
90
+        return $this->storage->validateCode($user, $challenge);
91
+    }
92 92
 
93
-	/**
94
-	 * Decides whether 2FA is enabled for the given user
95
-	 *
96
-	 * @param IUser $user
97
-	 * @return boolean
98
-	 */
99
-	public function isTwoFactorAuthEnabledForUser(IUser $user): bool {
100
-		return $this->storage->hasBackupCodes($user);
101
-	}
93
+    /**
94
+     * Decides whether 2FA is enabled for the given user
95
+     *
96
+     * @param IUser $user
97
+     * @return boolean
98
+     */
99
+    public function isTwoFactorAuthEnabledForUser(IUser $user): bool {
100
+        return $this->storage->hasBackupCodes($user);
101
+    }
102 102
 
103
-	/**
104
-	 * Determine whether backup codes should be active or not
105
-	 *
106
-	 * Backup codes only make sense if at least one 2FA provider is active,
107
-	 * hence this method checks all enabled apps on whether they provide 2FA
108
-	 * functionality or not. If there's at least one app, backup codes are
109
-	 * enabled on the personal settings page.
110
-	 *
111
-	 * @param IUser $user
112
-	 * @return boolean
113
-	 */
114
-	public function isActive(IUser $user): bool {
115
-		$appIds = array_filter($this->appManager->getEnabledAppsForUser($user), function ($appId) {
116
-			return $appId !== $this->appName;
117
-		});
118
-		foreach ($appIds as $appId) {
119
-			$info = $this->appManager->getAppInfo($appId);
120
-			if (isset($info['two-factor-providers']) && count($info['two-factor-providers']) > 0) {
121
-				return true;
122
-			}
123
-		}
124
-		return false;
125
-	}
103
+    /**
104
+     * Determine whether backup codes should be active or not
105
+     *
106
+     * Backup codes only make sense if at least one 2FA provider is active,
107
+     * hence this method checks all enabled apps on whether they provide 2FA
108
+     * functionality or not. If there's at least one app, backup codes are
109
+     * enabled on the personal settings page.
110
+     *
111
+     * @param IUser $user
112
+     * @return boolean
113
+     */
114
+    public function isActive(IUser $user): bool {
115
+        $appIds = array_filter($this->appManager->getEnabledAppsForUser($user), function ($appId) {
116
+            return $appId !== $this->appName;
117
+        });
118
+        foreach ($appIds as $appId) {
119
+            $info = $this->appManager->getAppInfo($appId);
120
+            if (isset($info['two-factor-providers']) && count($info['two-factor-providers']) > 0) {
121
+                return true;
122
+            }
123
+        }
124
+        return false;
125
+    }
126 126
 
127
-	/**
128
-	 * @param IUser $user
129
-	 *
130
-	 * @return IPersonalProviderSettings
131
-	 */
132
-	public function getPersonalSettings(IUser $user): IPersonalProviderSettings {
133
-		$state = $this->storage->getBackupCodesState($user);
134
-		$this->initialStateService->provideInitialState($this->appName, 'state', $state);
135
-		return new Personal();
136
-	}
127
+    /**
128
+     * @param IUser $user
129
+     *
130
+     * @return IPersonalProviderSettings
131
+     */
132
+    public function getPersonalSettings(IUser $user): IPersonalProviderSettings {
133
+        $state = $this->storage->getBackupCodesState($user);
134
+        $this->initialStateService->provideInitialState($this->appName, 'state', $state);
135
+        return new Personal();
136
+    }
137 137
 
138
-	public function disableFor(IUser $user) {
139
-		$this->storage->deleteCodes($user);
140
-	}
138
+    public function disableFor(IUser $user) {
139
+        $this->storage->deleteCodes($user);
140
+    }
141 141
 }
Please login to merge, or discard this patch.
apps/workflowengine/lib/Settings/ASettings.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -146,8 +146,8 @@  discard block
 block discarded – undo
146 146
 	}
147 147
 
148 148
 	private function entitiesToArray(array $entities) {
149
-		return array_map(function (IEntity $entity) {
150
-			$events = array_map(function (IEntityEvent $entityEvent) {
149
+		return array_map(function(IEntity $entity) {
150
+			$events = array_map(function(IEntityEvent $entityEvent) {
151 151
 				return [
152 152
 					'eventName' => $entityEvent->getEventName(),
153 153
 					'displayName' => $entityEvent->getDisplayName()
@@ -164,11 +164,11 @@  discard block
 block discarded – undo
164 164
 	}
165 165
 
166 166
 	private function operatorsToArray(array $operators) {
167
-		$operators = array_filter($operators, function (IOperation $operator) {
167
+		$operators = array_filter($operators, function(IOperation $operator) {
168 168
 			return $operator->isAvailableForScope($this->getScope());
169 169
 		});
170 170
 
171
-		return array_map(function (IOperation $operator) {
171
+		return array_map(function(IOperation $operator) {
172 172
 			return [
173 173
 				'id' => get_class($operator),
174 174
 				'icon' => $operator->getIcon(),
@@ -182,11 +182,11 @@  discard block
 block discarded – undo
182 182
 	}
183 183
 
184 184
 	private function checksToArray(array $checks) {
185
-		$checks = array_filter($checks, function (ICheck $check) {
185
+		$checks = array_filter($checks, function(ICheck $check) {
186 186
 			return $check->isAvailableForScope($this->getScope());
187 187
 		});
188 188
 
189
-		return array_map(function (ICheck $check) {
189
+		return array_map(function(ICheck $check) {
190 190
 			return [
191 191
 				'id' => get_class($check),
192 192
 				'supportedEntities' => $check->supportedEntities(),
Please login to merge, or discard this patch.
Indentation   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -26,130 +26,130 @@
 block discarded – undo
26 26
 use OCP\WorkflowEngine\ISpecificOperation;
27 27
 
28 28
 abstract class ASettings implements ISettings {
29
-	public function __construct(
30
-		private string $appName,
31
-		private IL10N $l10n,
32
-		private IEventDispatcher $eventDispatcher,
33
-		protected Manager $manager,
34
-		private IInitialState $initialStateService,
35
-		private IConfig $config,
36
-		private IURLGenerator $urlGenerator,
37
-	) {
38
-	}
39
-
40
-	abstract public function getScope(): int;
41
-
42
-	/**
43
-	 * @return TemplateResponse
44
-	 */
45
-	public function getForm(): TemplateResponse {
46
-		// @deprecated in 20.0.0: retire this one in favor of the typed event
47
-		$this->eventDispatcher->dispatch(
48
-			'OCP\WorkflowEngine::loadAdditionalSettingScripts',
49
-			new LoadSettingsScriptsEvent()
50
-		);
51
-		$this->eventDispatcher->dispatchTyped(new LoadSettingsScriptsEvent());
52
-
53
-		$entities = $this->manager->getEntitiesList();
54
-		$this->initialStateService->provideInitialState(
55
-			'entities',
56
-			$this->entitiesToArray($entities)
57
-		);
58
-
59
-		$operators = $this->manager->getOperatorList();
60
-		$this->initialStateService->provideInitialState(
61
-			'operators',
62
-			$this->operatorsToArray($operators)
63
-		);
64
-
65
-		$checks = $this->manager->getCheckList();
66
-		$this->initialStateService->provideInitialState(
67
-			'checks',
68
-			$this->checksToArray($checks)
69
-		);
70
-
71
-		$this->initialStateService->provideInitialState(
72
-			'scope',
73
-			$this->getScope()
74
-		);
75
-
76
-		$this->initialStateService->provideInitialState(
77
-			'appstoreenabled',
78
-			$this->config->getSystemValueBool('appstoreenabled', true)
79
-		);
80
-
81
-		$this->initialStateService->provideInitialState(
82
-			'doc-url',
83
-			$this->urlGenerator->linkToDocs('admin-workflowengine')
84
-		);
85
-
86
-		return new TemplateResponse(Application::APP_ID, 'settings', [], 'blank');
87
-	}
88
-
89
-	/**
90
-	 * @return string the section ID, e.g. 'sharing'
91
-	 */
92
-	public function getSection(): ?string {
93
-		return 'workflow';
94
-	}
95
-
96
-	/**
97
-	 * @return int whether the form should be rather on the top or bottom of
98
-	 *             the admin section. The forms are arranged in ascending order of the
99
-	 *             priority values. It is required to return a value between 0 and 100.
100
-	 *
101
-	 * E.g.: 70
102
-	 */
103
-	public function getPriority(): int {
104
-		return 0;
105
-	}
106
-
107
-	private function entitiesToArray(array $entities) {
108
-		return array_map(function (IEntity $entity) {
109
-			$events = array_map(function (IEntityEvent $entityEvent) {
110
-				return [
111
-					'eventName' => $entityEvent->getEventName(),
112
-					'displayName' => $entityEvent->getDisplayName()
113
-				];
114
-			}, $entity->getEvents());
115
-
116
-			return [
117
-				'id' => get_class($entity),
118
-				'icon' => $entity->getIcon(),
119
-				'name' => $entity->getName(),
120
-				'events' => $events,
121
-			];
122
-		}, $entities);
123
-	}
124
-
125
-	private function operatorsToArray(array $operators) {
126
-		$operators = array_filter($operators, function (IOperation $operator) {
127
-			return $operator->isAvailableForScope($this->getScope());
128
-		});
129
-
130
-		return array_map(function (IOperation $operator) {
131
-			return [
132
-				'id' => get_class($operator),
133
-				'icon' => $operator->getIcon(),
134
-				'name' => $operator->getDisplayName(),
135
-				'description' => $operator->getDescription(),
136
-				'fixedEntity' => $operator instanceof ISpecificOperation ? $operator->getEntityId() : '',
137
-				'isComplex' => $operator instanceof IComplexOperation,
138
-				'triggerHint' => $operator instanceof IComplexOperation ? $operator->getTriggerHint() : '',
139
-			];
140
-		}, $operators);
141
-	}
142
-
143
-	private function checksToArray(array $checks) {
144
-		$checks = array_filter($checks, function (ICheck $check) {
145
-			return $check->isAvailableForScope($this->getScope());
146
-		});
147
-
148
-		return array_map(function (ICheck $check) {
149
-			return [
150
-				'id' => get_class($check),
151
-				'supportedEntities' => $check->supportedEntities(),
152
-			];
153
-		}, $checks);
154
-	}
29
+    public function __construct(
30
+        private string $appName,
31
+        private IL10N $l10n,
32
+        private IEventDispatcher $eventDispatcher,
33
+        protected Manager $manager,
34
+        private IInitialState $initialStateService,
35
+        private IConfig $config,
36
+        private IURLGenerator $urlGenerator,
37
+    ) {
38
+    }
39
+
40
+    abstract public function getScope(): int;
41
+
42
+    /**
43
+     * @return TemplateResponse
44
+     */
45
+    public function getForm(): TemplateResponse {
46
+        // @deprecated in 20.0.0: retire this one in favor of the typed event
47
+        $this->eventDispatcher->dispatch(
48
+            'OCP\WorkflowEngine::loadAdditionalSettingScripts',
49
+            new LoadSettingsScriptsEvent()
50
+        );
51
+        $this->eventDispatcher->dispatchTyped(new LoadSettingsScriptsEvent());
52
+
53
+        $entities = $this->manager->getEntitiesList();
54
+        $this->initialStateService->provideInitialState(
55
+            'entities',
56
+            $this->entitiesToArray($entities)
57
+        );
58
+
59
+        $operators = $this->manager->getOperatorList();
60
+        $this->initialStateService->provideInitialState(
61
+            'operators',
62
+            $this->operatorsToArray($operators)
63
+        );
64
+
65
+        $checks = $this->manager->getCheckList();
66
+        $this->initialStateService->provideInitialState(
67
+            'checks',
68
+            $this->checksToArray($checks)
69
+        );
70
+
71
+        $this->initialStateService->provideInitialState(
72
+            'scope',
73
+            $this->getScope()
74
+        );
75
+
76
+        $this->initialStateService->provideInitialState(
77
+            'appstoreenabled',
78
+            $this->config->getSystemValueBool('appstoreenabled', true)
79
+        );
80
+
81
+        $this->initialStateService->provideInitialState(
82
+            'doc-url',
83
+            $this->urlGenerator->linkToDocs('admin-workflowengine')
84
+        );
85
+
86
+        return new TemplateResponse(Application::APP_ID, 'settings', [], 'blank');
87
+    }
88
+
89
+    /**
90
+     * @return string the section ID, e.g. 'sharing'
91
+     */
92
+    public function getSection(): ?string {
93
+        return 'workflow';
94
+    }
95
+
96
+    /**
97
+     * @return int whether the form should be rather on the top or bottom of
98
+     *             the admin section. The forms are arranged in ascending order of the
99
+     *             priority values. It is required to return a value between 0 and 100.
100
+     *
101
+     * E.g.: 70
102
+     */
103
+    public function getPriority(): int {
104
+        return 0;
105
+    }
106
+
107
+    private function entitiesToArray(array $entities) {
108
+        return array_map(function (IEntity $entity) {
109
+            $events = array_map(function (IEntityEvent $entityEvent) {
110
+                return [
111
+                    'eventName' => $entityEvent->getEventName(),
112
+                    'displayName' => $entityEvent->getDisplayName()
113
+                ];
114
+            }, $entity->getEvents());
115
+
116
+            return [
117
+                'id' => get_class($entity),
118
+                'icon' => $entity->getIcon(),
119
+                'name' => $entity->getName(),
120
+                'events' => $events,
121
+            ];
122
+        }, $entities);
123
+    }
124
+
125
+    private function operatorsToArray(array $operators) {
126
+        $operators = array_filter($operators, function (IOperation $operator) {
127
+            return $operator->isAvailableForScope($this->getScope());
128
+        });
129
+
130
+        return array_map(function (IOperation $operator) {
131
+            return [
132
+                'id' => get_class($operator),
133
+                'icon' => $operator->getIcon(),
134
+                'name' => $operator->getDisplayName(),
135
+                'description' => $operator->getDescription(),
136
+                'fixedEntity' => $operator instanceof ISpecificOperation ? $operator->getEntityId() : '',
137
+                'isComplex' => $operator instanceof IComplexOperation,
138
+                'triggerHint' => $operator instanceof IComplexOperation ? $operator->getTriggerHint() : '',
139
+            ];
140
+        }, $operators);
141
+    }
142
+
143
+    private function checksToArray(array $checks) {
144
+        $checks = array_filter($checks, function (ICheck $check) {
145
+            return $check->isAvailableForScope($this->getScope());
146
+        });
147
+
148
+        return array_map(function (ICheck $check) {
149
+            return [
150
+                'id' => get_class($check),
151
+                'supportedEntities' => $check->supportedEntities(),
152
+            ];
153
+        }, $checks);
154
+    }
155 155
 }
Please login to merge, or discard this patch.
lib/private/Authentication/TwoFactorAuth/ProviderSet.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@
 block discarded – undo
72 72
 	 * @return IProvider[]
73 73
 	 */
74 74
 	public function getPrimaryProviders(): array {
75
-		return array_filter($this->providers, function (IProvider $provider) {
75
+		return array_filter($this->providers, function(IProvider $provider) {
76 76
 			return !($provider instanceof BackupCodesProvider);
77 77
 		});
78 78
 	}
Please login to merge, or discard this patch.
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -33,49 +33,49 @@
 block discarded – undo
33 33
  * Contains all two-factor provider information for the two-factor login challenge
34 34
  */
35 35
 class ProviderSet {
36
-	/** @var IProvider */
37
-	private $providers;
36
+    /** @var IProvider */
37
+    private $providers;
38 38
 
39
-	/** @var bool */
40
-	private $providerMissing;
39
+    /** @var bool */
40
+    private $providerMissing;
41 41
 
42
-	/**
43
-	 * @param IProvider[] $providers
44
-	 * @param bool $providerMissing
45
-	 */
46
-	public function __construct(array $providers, bool $providerMissing) {
47
-		$this->providers = [];
48
-		foreach ($providers as $provider) {
49
-			$this->providers[$provider->getId()] = $provider;
50
-		}
51
-		$this->providerMissing = $providerMissing;
52
-	}
42
+    /**
43
+     * @param IProvider[] $providers
44
+     * @param bool $providerMissing
45
+     */
46
+    public function __construct(array $providers, bool $providerMissing) {
47
+        $this->providers = [];
48
+        foreach ($providers as $provider) {
49
+            $this->providers[$provider->getId()] = $provider;
50
+        }
51
+        $this->providerMissing = $providerMissing;
52
+    }
53 53
 
54
-	/**
55
-	 * @param string $providerId
56
-	 * @return IProvider|null
57
-	 */
58
-	public function getProvider(string $providerId) {
59
-		return $this->providers[$providerId] ?? null;
60
-	}
54
+    /**
55
+     * @param string $providerId
56
+     * @return IProvider|null
57
+     */
58
+    public function getProvider(string $providerId) {
59
+        return $this->providers[$providerId] ?? null;
60
+    }
61 61
 
62
-	/**
63
-	 * @return IProvider[]
64
-	 */
65
-	public function getProviders(): array {
66
-		return $this->providers;
67
-	}
62
+    /**
63
+     * @return IProvider[]
64
+     */
65
+    public function getProviders(): array {
66
+        return $this->providers;
67
+    }
68 68
 
69
-	/**
70
-	 * @return IProvider[]
71
-	 */
72
-	public function getPrimaryProviders(): array {
73
-		return array_filter($this->providers, function (IProvider $provider) {
74
-			return !($provider instanceof BackupCodesProvider);
75
-		});
76
-	}
69
+    /**
70
+     * @return IProvider[]
71
+     */
72
+    public function getPrimaryProviders(): array {
73
+        return array_filter($this->providers, function (IProvider $provider) {
74
+            return !($provider instanceof BackupCodesProvider);
75
+        });
76
+    }
77 77
 
78
-	public function isProviderMissing(): bool {
79
-		return $this->providerMissing;
80
-	}
78
+    public function isProviderMissing(): bool {
79
+        return $this->providerMissing;
80
+    }
81 81
 }
Please login to merge, or discard this patch.