@@ -35,76 +35,76 @@ |
||
35 | 35 | |
36 | 36 | class RemoveOrphanEventsAndContacts implements IRepairStep { |
37 | 37 | |
38 | - /** @var IDBConnection */ |
|
39 | - private $connection; |
|
40 | - |
|
41 | - public function __construct(IDBConnection $connection) { |
|
42 | - $this->connection = $connection; |
|
43 | - } |
|
44 | - |
|
45 | - /** |
|
46 | - * @inheritdoc |
|
47 | - */ |
|
48 | - public function getName(): string { |
|
49 | - return 'Clean up orphan event and contact data'; |
|
50 | - } |
|
51 | - |
|
52 | - /** |
|
53 | - * @inheritdoc |
|
54 | - */ |
|
55 | - public function run(IOutput $output) { |
|
56 | - $orphanItems = $this->removeOrphanChildren('calendarobjects', 'calendars', 'calendarid'); |
|
57 | - $output->info(sprintf('%d events without a calendar have been cleaned up', $orphanItems)); |
|
58 | - $orphanItems = $this->removeOrphanChildren('calendarobjects_props', 'calendarobjects', 'objectid'); |
|
59 | - $output->info(sprintf('%d properties without an events have been cleaned up', $orphanItems)); |
|
60 | - $orphanItems = $this->removeOrphanChildren('calendarchanges', 'calendars', 'calendarid'); |
|
61 | - $output->info(sprintf('%d changes without a calendar have been cleaned up', $orphanItems)); |
|
62 | - |
|
63 | - $orphanItems = $this->removeOrphanChildren('calendarobjects', 'calendarsubscriptions', 'calendarid'); |
|
64 | - $output->info(sprintf('%d cached events without a calendar subscription have been cleaned up', $orphanItems)); |
|
65 | - $orphanItems = $this->removeOrphanChildren('calendarchanges', 'calendarsubscriptions', 'calendarid'); |
|
66 | - $output->info(sprintf('%d changes without a calendar subscription have been cleaned up', $orphanItems)); |
|
67 | - |
|
68 | - $orphanItems = $this->removeOrphanChildren('cards', 'addressbooks', 'addressbookid'); |
|
69 | - $output->info(sprintf('%d contacts without an addressbook have been cleaned up', $orphanItems)); |
|
70 | - $orphanItems = $this->removeOrphanChildren('cards_properties', 'cards', 'cardid'); |
|
71 | - $output->info(sprintf('%d properties without a contact have been cleaned up', $orphanItems)); |
|
72 | - $orphanItems = $this->removeOrphanChildren('addressbookchanges', 'addressbooks', 'addressbookid'); |
|
73 | - $output->info(sprintf('%d changes without an addressbook have been cleaned up', $orphanItems)); |
|
74 | - } |
|
75 | - |
|
76 | - protected function removeOrphanChildren($childTable, $parentTable, $parentId): int { |
|
77 | - $qb = $this->connection->getQueryBuilder(); |
|
78 | - |
|
79 | - $qb->select('c.id') |
|
80 | - ->from($childTable, 'c') |
|
81 | - ->leftJoin('c', $parentTable, 'p', $qb->expr()->eq('c.' . $parentId, 'p.id')) |
|
82 | - ->where($qb->expr()->isNull('p.id')); |
|
83 | - |
|
84 | - if (\in_array($parentTable, ['calendars', 'calendarsubscriptions'], true)) { |
|
85 | - $calendarType = $parentTable === 'calendarsubscriptions' ? CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION : CalDavBackend::CALENDAR_TYPE_CALENDAR; |
|
86 | - $qb->andWhere($qb->expr()->eq('c.calendartype', $qb->createNamedParameter($calendarType, IQueryBuilder::PARAM_INT), IQueryBuilder::PARAM_INT)); |
|
87 | - } |
|
88 | - |
|
89 | - $result = $qb->execute(); |
|
90 | - |
|
91 | - $orphanItems = []; |
|
92 | - while ($row = $result->fetch()) { |
|
93 | - $orphanItems[] = (int) $row['id']; |
|
94 | - } |
|
95 | - $result->closeCursor(); |
|
96 | - |
|
97 | - if (!empty($orphanItems)) { |
|
98 | - $qb->delete($childTable) |
|
99 | - ->where($qb->expr()->in('id', $qb->createParameter('ids'))); |
|
100 | - |
|
101 | - $orphanItemsBatch = array_chunk($orphanItems, 200); |
|
102 | - foreach ($orphanItemsBatch as $items) { |
|
103 | - $qb->setParameter('ids', $items, IQueryBuilder::PARAM_INT_ARRAY); |
|
104 | - $qb->execute(); |
|
105 | - } |
|
106 | - } |
|
107 | - |
|
108 | - return count($orphanItems); |
|
109 | - } |
|
38 | + /** @var IDBConnection */ |
|
39 | + private $connection; |
|
40 | + |
|
41 | + public function __construct(IDBConnection $connection) { |
|
42 | + $this->connection = $connection; |
|
43 | + } |
|
44 | + |
|
45 | + /** |
|
46 | + * @inheritdoc |
|
47 | + */ |
|
48 | + public function getName(): string { |
|
49 | + return 'Clean up orphan event and contact data'; |
|
50 | + } |
|
51 | + |
|
52 | + /** |
|
53 | + * @inheritdoc |
|
54 | + */ |
|
55 | + public function run(IOutput $output) { |
|
56 | + $orphanItems = $this->removeOrphanChildren('calendarobjects', 'calendars', 'calendarid'); |
|
57 | + $output->info(sprintf('%d events without a calendar have been cleaned up', $orphanItems)); |
|
58 | + $orphanItems = $this->removeOrphanChildren('calendarobjects_props', 'calendarobjects', 'objectid'); |
|
59 | + $output->info(sprintf('%d properties without an events have been cleaned up', $orphanItems)); |
|
60 | + $orphanItems = $this->removeOrphanChildren('calendarchanges', 'calendars', 'calendarid'); |
|
61 | + $output->info(sprintf('%d changes without a calendar have been cleaned up', $orphanItems)); |
|
62 | + |
|
63 | + $orphanItems = $this->removeOrphanChildren('calendarobjects', 'calendarsubscriptions', 'calendarid'); |
|
64 | + $output->info(sprintf('%d cached events without a calendar subscription have been cleaned up', $orphanItems)); |
|
65 | + $orphanItems = $this->removeOrphanChildren('calendarchanges', 'calendarsubscriptions', 'calendarid'); |
|
66 | + $output->info(sprintf('%d changes without a calendar subscription have been cleaned up', $orphanItems)); |
|
67 | + |
|
68 | + $orphanItems = $this->removeOrphanChildren('cards', 'addressbooks', 'addressbookid'); |
|
69 | + $output->info(sprintf('%d contacts without an addressbook have been cleaned up', $orphanItems)); |
|
70 | + $orphanItems = $this->removeOrphanChildren('cards_properties', 'cards', 'cardid'); |
|
71 | + $output->info(sprintf('%d properties without a contact have been cleaned up', $orphanItems)); |
|
72 | + $orphanItems = $this->removeOrphanChildren('addressbookchanges', 'addressbooks', 'addressbookid'); |
|
73 | + $output->info(sprintf('%d changes without an addressbook have been cleaned up', $orphanItems)); |
|
74 | + } |
|
75 | + |
|
76 | + protected function removeOrphanChildren($childTable, $parentTable, $parentId): int { |
|
77 | + $qb = $this->connection->getQueryBuilder(); |
|
78 | + |
|
79 | + $qb->select('c.id') |
|
80 | + ->from($childTable, 'c') |
|
81 | + ->leftJoin('c', $parentTable, 'p', $qb->expr()->eq('c.' . $parentId, 'p.id')) |
|
82 | + ->where($qb->expr()->isNull('p.id')); |
|
83 | + |
|
84 | + if (\in_array($parentTable, ['calendars', 'calendarsubscriptions'], true)) { |
|
85 | + $calendarType = $parentTable === 'calendarsubscriptions' ? CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION : CalDavBackend::CALENDAR_TYPE_CALENDAR; |
|
86 | + $qb->andWhere($qb->expr()->eq('c.calendartype', $qb->createNamedParameter($calendarType, IQueryBuilder::PARAM_INT), IQueryBuilder::PARAM_INT)); |
|
87 | + } |
|
88 | + |
|
89 | + $result = $qb->execute(); |
|
90 | + |
|
91 | + $orphanItems = []; |
|
92 | + while ($row = $result->fetch()) { |
|
93 | + $orphanItems[] = (int) $row['id']; |
|
94 | + } |
|
95 | + $result->closeCursor(); |
|
96 | + |
|
97 | + if (!empty($orphanItems)) { |
|
98 | + $qb->delete($childTable) |
|
99 | + ->where($qb->expr()->in('id', $qb->createParameter('ids'))); |
|
100 | + |
|
101 | + $orphanItemsBatch = array_chunk($orphanItems, 200); |
|
102 | + foreach ($orphanItemsBatch as $items) { |
|
103 | + $qb->setParameter('ids', $items, IQueryBuilder::PARAM_INT_ARRAY); |
|
104 | + $qb->execute(); |
|
105 | + } |
|
106 | + } |
|
107 | + |
|
108 | + return count($orphanItems); |
|
109 | + } |
|
110 | 110 | } |
@@ -28,15 +28,15 @@ |
||
28 | 28 | $route = isset($_GET['download']) ? 'files_sharing.sharecontroller.downloadShare' : 'files_sharing.sharecontroller.showShare'; |
29 | 29 | |
30 | 30 | if ($token !== '') { |
31 | - $protocol = \OC::$server->getRequest()->getHttpProtocol(); |
|
32 | - if ($protocol == 'HTTP/1.0') { |
|
33 | - http_response_code(302); |
|
34 | - } else { |
|
35 | - http_response_code(307); |
|
36 | - } |
|
37 | - header('Location: ' . $urlGenerator->linkToRoute($route, ['token' => $token])); |
|
31 | + $protocol = \OC::$server->getRequest()->getHttpProtocol(); |
|
32 | + if ($protocol == 'HTTP/1.0') { |
|
33 | + http_response_code(302); |
|
34 | + } else { |
|
35 | + http_response_code(307); |
|
36 | + } |
|
37 | + header('Location: ' . $urlGenerator->linkToRoute($route, ['token' => $token])); |
|
38 | 38 | } else { |
39 | - http_response_code(404); |
|
40 | - $tmpl = new OCP\Template('', '404', 'guest'); |
|
41 | - print_unescaped($tmpl->fetchPage()); |
|
39 | + http_response_code(404); |
|
40 | + $tmpl = new OCP\Template('', '404', 'guest'); |
|
41 | + print_unescaped($tmpl->fetchPage()); |
|
42 | 42 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | $connection = new \OCA\User_LDAP\Connection($ldapWrapper, $prefix); |
36 | 36 | $configuration = $connection->getConfiguration(); |
37 | 37 | if (isset($configuration['ldap_agent_password']) && $configuration['ldap_agent_password'] !== '') { |
38 | - // hide password |
|
39 | - $configuration['ldap_agent_password'] = '**PASSWORD SET**'; |
|
38 | + // hide password |
|
39 | + $configuration['ldap_agent_password'] = '**PASSWORD SET**'; |
|
40 | 40 | } |
41 | 41 | \OC_JSON::success(['configuration' => $configuration]); |
@@ -29,40 +29,40 @@ |
||
29 | 29 | * @deprecated 18.0.0 |
30 | 30 | */ |
31 | 31 | class TemplateManager { |
32 | - protected $templates = []; |
|
32 | + protected $templates = []; |
|
33 | 33 | |
34 | - public function registerTemplate($mimetype, $path) { |
|
35 | - $this->templates[$mimetype] = $path; |
|
36 | - } |
|
34 | + public function registerTemplate($mimetype, $path) { |
|
35 | + $this->templates[$mimetype] = $path; |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * get the path of the template for a mimetype |
|
40 | - * |
|
41 | - * @deprecated 18.0.0 |
|
42 | - * @param string $mimetype |
|
43 | - * @return string|null |
|
44 | - */ |
|
45 | - public function getTemplatePath($mimetype) { |
|
46 | - if (isset($this->templates[$mimetype])) { |
|
47 | - return $this->templates[$mimetype]; |
|
48 | - } else { |
|
49 | - return null; |
|
50 | - } |
|
51 | - } |
|
38 | + /** |
|
39 | + * get the path of the template for a mimetype |
|
40 | + * |
|
41 | + * @deprecated 18.0.0 |
|
42 | + * @param string $mimetype |
|
43 | + * @return string|null |
|
44 | + */ |
|
45 | + public function getTemplatePath($mimetype) { |
|
46 | + if (isset($this->templates[$mimetype])) { |
|
47 | + return $this->templates[$mimetype]; |
|
48 | + } else { |
|
49 | + return null; |
|
50 | + } |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * get the template content for a mimetype |
|
55 | - * |
|
56 | - * @deprecated 18.0.0 |
|
57 | - * @param string $mimetype |
|
58 | - * @return string |
|
59 | - */ |
|
60 | - public function getTemplate($mimetype) { |
|
61 | - $path = $this->getTemplatePath($mimetype); |
|
62 | - if ($path) { |
|
63 | - return file_get_contents($path); |
|
64 | - } else { |
|
65 | - return ''; |
|
66 | - } |
|
67 | - } |
|
53 | + /** |
|
54 | + * get the template content for a mimetype |
|
55 | + * |
|
56 | + * @deprecated 18.0.0 |
|
57 | + * @param string $mimetype |
|
58 | + * @return string |
|
59 | + */ |
|
60 | + public function getTemplate($mimetype) { |
|
61 | + $path = $this->getTemplatePath($mimetype); |
|
62 | + if ($path) { |
|
63 | + return file_get_contents($path); |
|
64 | + } else { |
|
65 | + return ''; |
|
66 | + } |
|
67 | + } |
|
68 | 68 | } |
@@ -26,14 +26,14 @@ discard block |
||
26 | 26 | use OC\DB\ConnectionFactory; |
27 | 27 | |
28 | 28 | class Sqlite extends AbstractDatabase { |
29 | - public $dbprettyname = 'Sqlite'; |
|
29 | + public $dbprettyname = 'Sqlite'; |
|
30 | 30 | |
31 | - public function validate($config) { |
|
32 | - return []; |
|
33 | - } |
|
31 | + public function validate($config) { |
|
32 | + return []; |
|
33 | + } |
|
34 | 34 | |
35 | - public function initialize($config) { |
|
36 | - /* |
|
35 | + public function initialize($config) { |
|
36 | + /* |
|
37 | 37 | * Web: When using web based installer its not possible to set dbname |
38 | 38 | * or dbtableprefix. Defaults used from ConnectionFactory and dbtype = 'sqlite' |
39 | 39 | * is written to config.php. |
@@ -44,32 +44,32 @@ discard block |
||
44 | 44 | * in connection factory configuration is obtained from config.php. |
45 | 45 | */ |
46 | 46 | |
47 | - $this->dbName = empty($config['dbname']) |
|
48 | - ? ConnectionFactory::DEFAULT_DBNAME |
|
49 | - : $config['dbname']; |
|
47 | + $this->dbName = empty($config['dbname']) |
|
48 | + ? ConnectionFactory::DEFAULT_DBNAME |
|
49 | + : $config['dbname']; |
|
50 | 50 | |
51 | - $this->tablePrefix = empty($config['dbtableprefix']) |
|
52 | - ? ConnectionFactory::DEFAULT_DBTABLEPREFIX |
|
53 | - : $config['dbtableprefix']; |
|
51 | + $this->tablePrefix = empty($config['dbtableprefix']) |
|
52 | + ? ConnectionFactory::DEFAULT_DBTABLEPREFIX |
|
53 | + : $config['dbtableprefix']; |
|
54 | 54 | |
55 | - if ($this->dbName !== ConnectionFactory::DEFAULT_DBNAME) { |
|
56 | - $this->config->setValue('dbname', $this->dbName); |
|
57 | - } |
|
55 | + if ($this->dbName !== ConnectionFactory::DEFAULT_DBNAME) { |
|
56 | + $this->config->setValue('dbname', $this->dbName); |
|
57 | + } |
|
58 | 58 | |
59 | - if ($this->tablePrefix !== ConnectionFactory::DEFAULT_DBTABLEPREFIX) { |
|
60 | - $this->config->setValue('dbtableprefix', $this->tablePrefix); |
|
61 | - } |
|
62 | - } |
|
59 | + if ($this->tablePrefix !== ConnectionFactory::DEFAULT_DBTABLEPREFIX) { |
|
60 | + $this->config->setValue('dbtableprefix', $this->tablePrefix); |
|
61 | + } |
|
62 | + } |
|
63 | 63 | |
64 | - public function setupDatabase($username) { |
|
65 | - $datadir = $this->config->getValue( |
|
66 | - 'datadirectory', |
|
67 | - \OC::$SERVERROOT . '/data' |
|
68 | - ); |
|
64 | + public function setupDatabase($username) { |
|
65 | + $datadir = $this->config->getValue( |
|
66 | + 'datadirectory', |
|
67 | + \OC::$SERVERROOT . '/data' |
|
68 | + ); |
|
69 | 69 | |
70 | - $sqliteFile = $datadir . '/' . $this->dbName . 'db'; |
|
71 | - if (file_exists($sqliteFile)) { |
|
72 | - unlink($sqliteFile); |
|
73 | - } |
|
74 | - } |
|
70 | + $sqliteFile = $datadir . '/' . $this->dbName . 'db'; |
|
71 | + if (file_exists($sqliteFile)) { |
|
72 | + unlink($sqliteFile); |
|
73 | + } |
|
74 | + } |
|
75 | 75 | } |
@@ -33,48 +33,48 @@ |
||
33 | 33 | |
34 | 34 | class WebAuthn implements ISettings { |
35 | 35 | |
36 | - /** @var PublicKeyCredentialMapper */ |
|
37 | - private $mapper; |
|
36 | + /** @var PublicKeyCredentialMapper */ |
|
37 | + private $mapper; |
|
38 | 38 | |
39 | - /** @var string */ |
|
40 | - private $uid; |
|
39 | + /** @var string */ |
|
40 | + private $uid; |
|
41 | 41 | |
42 | - /** @var IInitialStateService */ |
|
43 | - private $initialStateService; |
|
42 | + /** @var IInitialStateService */ |
|
43 | + private $initialStateService; |
|
44 | 44 | |
45 | - /** @var Manager */ |
|
46 | - private $manager; |
|
45 | + /** @var Manager */ |
|
46 | + private $manager; |
|
47 | 47 | |
48 | - public function __construct(PublicKeyCredentialMapper $mapper, |
|
49 | - string $UserId, |
|
50 | - IInitialStateService $initialStateService, |
|
51 | - Manager $manager) { |
|
52 | - $this->mapper = $mapper; |
|
53 | - $this->uid = $UserId; |
|
54 | - $this->initialStateService = $initialStateService; |
|
55 | - $this->manager = $manager; |
|
56 | - } |
|
48 | + public function __construct(PublicKeyCredentialMapper $mapper, |
|
49 | + string $UserId, |
|
50 | + IInitialStateService $initialStateService, |
|
51 | + Manager $manager) { |
|
52 | + $this->mapper = $mapper; |
|
53 | + $this->uid = $UserId; |
|
54 | + $this->initialStateService = $initialStateService; |
|
55 | + $this->manager = $manager; |
|
56 | + } |
|
57 | 57 | |
58 | - public function getForm() { |
|
59 | - $this->initialStateService->provideInitialState( |
|
60 | - Application::APP_ID, |
|
61 | - 'webauthn-devices', |
|
62 | - $this->mapper->findAllForUid($this->uid) |
|
63 | - ); |
|
58 | + public function getForm() { |
|
59 | + $this->initialStateService->provideInitialState( |
|
60 | + Application::APP_ID, |
|
61 | + 'webauthn-devices', |
|
62 | + $this->mapper->findAllForUid($this->uid) |
|
63 | + ); |
|
64 | 64 | |
65 | - return new TemplateResponse('settings', 'settings/personal/security/webauthn', [ |
|
66 | - ]); |
|
67 | - } |
|
65 | + return new TemplateResponse('settings', 'settings/personal/security/webauthn', [ |
|
66 | + ]); |
|
67 | + } |
|
68 | 68 | |
69 | - public function getSection(): ?string { |
|
70 | - if (!$this->manager->isWebAuthnAvailable()) { |
|
71 | - return null; |
|
72 | - } |
|
69 | + public function getSection(): ?string { |
|
70 | + if (!$this->manager->isWebAuthnAvailable()) { |
|
71 | + return null; |
|
72 | + } |
|
73 | 73 | |
74 | - return 'security'; |
|
75 | - } |
|
74 | + return 'security'; |
|
75 | + } |
|
76 | 76 | |
77 | - public function getPriority(): int { |
|
78 | - return 20; |
|
79 | - } |
|
77 | + public function getPriority(): int { |
|
78 | + return 20; |
|
79 | + } |
|
80 | 80 | } |
@@ -25,72 +25,72 @@ |
||
25 | 25 | namespace OC\Authentication\Login; |
26 | 26 | |
27 | 27 | class WebAuthnChain { |
28 | - /** @var UserDisabledCheckCommand */ |
|
29 | - private $userDisabledCheckCommand; |
|
28 | + /** @var UserDisabledCheckCommand */ |
|
29 | + private $userDisabledCheckCommand; |
|
30 | 30 | |
31 | - /** @var LoggedInCheckCommand */ |
|
32 | - private $loggedInCheckCommand; |
|
31 | + /** @var LoggedInCheckCommand */ |
|
32 | + private $loggedInCheckCommand; |
|
33 | 33 | |
34 | - /** @var CompleteLoginCommand */ |
|
35 | - private $completeLoginCommand; |
|
34 | + /** @var CompleteLoginCommand */ |
|
35 | + private $completeLoginCommand; |
|
36 | 36 | |
37 | - /** @var CreateSessionTokenCommand */ |
|
38 | - private $createSessionTokenCommand; |
|
37 | + /** @var CreateSessionTokenCommand */ |
|
38 | + private $createSessionTokenCommand; |
|
39 | 39 | |
40 | - /** @var ClearLostPasswordTokensCommand */ |
|
41 | - private $clearLostPasswordTokensCommand; |
|
40 | + /** @var ClearLostPasswordTokensCommand */ |
|
41 | + private $clearLostPasswordTokensCommand; |
|
42 | 42 | |
43 | - /** @var UpdateLastPasswordConfirmCommand */ |
|
44 | - private $updateLastPasswordConfirmCommand; |
|
43 | + /** @var UpdateLastPasswordConfirmCommand */ |
|
44 | + private $updateLastPasswordConfirmCommand; |
|
45 | 45 | |
46 | - /** @var SetUserTimezoneCommand */ |
|
47 | - private $setUserTimezoneCommand; |
|
46 | + /** @var SetUserTimezoneCommand */ |
|
47 | + private $setUserTimezoneCommand; |
|
48 | 48 | |
49 | - /** @var TwoFactorCommand */ |
|
50 | - private $twoFactorCommand; |
|
49 | + /** @var TwoFactorCommand */ |
|
50 | + private $twoFactorCommand; |
|
51 | 51 | |
52 | - /** @var FinishRememberedLoginCommand */ |
|
53 | - private $finishRememberedLoginCommand; |
|
52 | + /** @var FinishRememberedLoginCommand */ |
|
53 | + private $finishRememberedLoginCommand; |
|
54 | 54 | |
55 | - /** @var WebAuthnLoginCommand */ |
|
56 | - private $webAuthnLoginCommand; |
|
55 | + /** @var WebAuthnLoginCommand */ |
|
56 | + private $webAuthnLoginCommand; |
|
57 | 57 | |
58 | - public function __construct(UserDisabledCheckCommand $userDisabledCheckCommand, |
|
59 | - WebAuthnLoginCommand $webAuthnLoginCommand, |
|
60 | - LoggedInCheckCommand $loggedInCheckCommand, |
|
61 | - CompleteLoginCommand $completeLoginCommand, |
|
62 | - CreateSessionTokenCommand $createSessionTokenCommand, |
|
63 | - ClearLostPasswordTokensCommand $clearLostPasswordTokensCommand, |
|
64 | - UpdateLastPasswordConfirmCommand $updateLastPasswordConfirmCommand, |
|
65 | - SetUserTimezoneCommand $setUserTimezoneCommand, |
|
66 | - TwoFactorCommand $twoFactorCommand, |
|
67 | - FinishRememberedLoginCommand $finishRememberedLoginCommand |
|
68 | - ) { |
|
69 | - $this->userDisabledCheckCommand = $userDisabledCheckCommand; |
|
70 | - $this->webAuthnLoginCommand = $webAuthnLoginCommand; |
|
71 | - $this->loggedInCheckCommand = $loggedInCheckCommand; |
|
72 | - $this->completeLoginCommand = $completeLoginCommand; |
|
73 | - $this->createSessionTokenCommand = $createSessionTokenCommand; |
|
74 | - $this->clearLostPasswordTokensCommand = $clearLostPasswordTokensCommand; |
|
75 | - $this->updateLastPasswordConfirmCommand = $updateLastPasswordConfirmCommand; |
|
76 | - $this->setUserTimezoneCommand = $setUserTimezoneCommand; |
|
77 | - $this->twoFactorCommand = $twoFactorCommand; |
|
78 | - $this->finishRememberedLoginCommand = $finishRememberedLoginCommand; |
|
79 | - } |
|
58 | + public function __construct(UserDisabledCheckCommand $userDisabledCheckCommand, |
|
59 | + WebAuthnLoginCommand $webAuthnLoginCommand, |
|
60 | + LoggedInCheckCommand $loggedInCheckCommand, |
|
61 | + CompleteLoginCommand $completeLoginCommand, |
|
62 | + CreateSessionTokenCommand $createSessionTokenCommand, |
|
63 | + ClearLostPasswordTokensCommand $clearLostPasswordTokensCommand, |
|
64 | + UpdateLastPasswordConfirmCommand $updateLastPasswordConfirmCommand, |
|
65 | + SetUserTimezoneCommand $setUserTimezoneCommand, |
|
66 | + TwoFactorCommand $twoFactorCommand, |
|
67 | + FinishRememberedLoginCommand $finishRememberedLoginCommand |
|
68 | + ) { |
|
69 | + $this->userDisabledCheckCommand = $userDisabledCheckCommand; |
|
70 | + $this->webAuthnLoginCommand = $webAuthnLoginCommand; |
|
71 | + $this->loggedInCheckCommand = $loggedInCheckCommand; |
|
72 | + $this->completeLoginCommand = $completeLoginCommand; |
|
73 | + $this->createSessionTokenCommand = $createSessionTokenCommand; |
|
74 | + $this->clearLostPasswordTokensCommand = $clearLostPasswordTokensCommand; |
|
75 | + $this->updateLastPasswordConfirmCommand = $updateLastPasswordConfirmCommand; |
|
76 | + $this->setUserTimezoneCommand = $setUserTimezoneCommand; |
|
77 | + $this->twoFactorCommand = $twoFactorCommand; |
|
78 | + $this->finishRememberedLoginCommand = $finishRememberedLoginCommand; |
|
79 | + } |
|
80 | 80 | |
81 | - public function process(LoginData $loginData): LoginResult { |
|
82 | - $chain = $this->userDisabledCheckCommand; |
|
83 | - $chain |
|
84 | - ->setNext($this->webAuthnLoginCommand) |
|
85 | - ->setNext($this->loggedInCheckCommand) |
|
86 | - ->setNext($this->completeLoginCommand) |
|
87 | - ->setNext($this->createSessionTokenCommand) |
|
88 | - ->setNext($this->clearLostPasswordTokensCommand) |
|
89 | - ->setNext($this->updateLastPasswordConfirmCommand) |
|
90 | - ->setNext($this->setUserTimezoneCommand) |
|
91 | - ->setNext($this->twoFactorCommand) |
|
92 | - ->setNext($this->finishRememberedLoginCommand); |
|
81 | + public function process(LoginData $loginData): LoginResult { |
|
82 | + $chain = $this->userDisabledCheckCommand; |
|
83 | + $chain |
|
84 | + ->setNext($this->webAuthnLoginCommand) |
|
85 | + ->setNext($this->loggedInCheckCommand) |
|
86 | + ->setNext($this->completeLoginCommand) |
|
87 | + ->setNext($this->createSessionTokenCommand) |
|
88 | + ->setNext($this->clearLostPasswordTokensCommand) |
|
89 | + ->setNext($this->updateLastPasswordConfirmCommand) |
|
90 | + ->setNext($this->setUserTimezoneCommand) |
|
91 | + ->setNext($this->twoFactorCommand) |
|
92 | + ->setNext($this->finishRememberedLoginCommand); |
|
93 | 93 | |
94 | - return $chain->process($loginData); |
|
95 | - } |
|
94 | + return $chain->process($loginData); |
|
95 | + } |
|
96 | 96 | } |
@@ -31,43 +31,43 @@ |
||
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 | } |
@@ -37,77 +37,77 @@ |
||
37 | 37 | |
38 | 38 | class SecurityProvider implements IProvider { |
39 | 39 | |
40 | - /** @var L10nFactory */ |
|
41 | - private $l10n; |
|
40 | + /** @var L10nFactory */ |
|
41 | + private $l10n; |
|
42 | 42 | |
43 | - /** @var IURLGenerator */ |
|
44 | - private $urlGenerator; |
|
43 | + /** @var IURLGenerator */ |
|
44 | + private $urlGenerator; |
|
45 | 45 | |
46 | - /** @var IManager */ |
|
47 | - private $activityManager; |
|
46 | + /** @var IManager */ |
|
47 | + private $activityManager; |
|
48 | 48 | |
49 | - public function __construct(L10nFactory $l10n, IURLGenerator $urlGenerator, IManager $activityManager) { |
|
50 | - $this->urlGenerator = $urlGenerator; |
|
51 | - $this->l10n = $l10n; |
|
52 | - $this->activityManager = $activityManager; |
|
53 | - } |
|
49 | + public function __construct(L10nFactory $l10n, IURLGenerator $urlGenerator, IManager $activityManager) { |
|
50 | + $this->urlGenerator = $urlGenerator; |
|
51 | + $this->l10n = $l10n; |
|
52 | + $this->activityManager = $activityManager; |
|
53 | + } |
|
54 | 54 | |
55 | - public function parse($language, IEvent $event, IEvent $previousEvent = null) { |
|
56 | - if ($event->getType() !== 'security') { |
|
57 | - throw new InvalidArgumentException(); |
|
58 | - } |
|
55 | + public function parse($language, IEvent $event, IEvent $previousEvent = null) { |
|
56 | + if ($event->getType() !== 'security') { |
|
57 | + throw new InvalidArgumentException(); |
|
58 | + } |
|
59 | 59 | |
60 | - $l = $this->l10n->get('settings', $language); |
|
60 | + $l = $this->l10n->get('settings', $language); |
|
61 | 61 | |
62 | - switch ($event->getSubject()) { |
|
63 | - case 'twofactor_success': |
|
64 | - $params = $event->getSubjectParameters(); |
|
65 | - $event->setParsedSubject($l->t('You successfully logged in using two-factor authentication (%1$s)', [ |
|
66 | - $params['provider'], |
|
67 | - ])); |
|
68 | - if ($this->activityManager->getRequirePNG()) { |
|
69 | - $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.png'))); |
|
70 | - } else { |
|
71 | - $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.svg'))); |
|
72 | - } |
|
73 | - break; |
|
74 | - case 'twofactor_failed': |
|
75 | - $params = $event->getSubjectParameters(); |
|
76 | - $event->setParsedSubject($l->t('A login attempt using two-factor authentication failed (%1$s)', [ |
|
77 | - $params['provider'], |
|
78 | - ])); |
|
79 | - if ($this->activityManager->getRequirePNG()) { |
|
80 | - $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.png'))); |
|
81 | - } else { |
|
82 | - $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.svg'))); |
|
83 | - } |
|
84 | - break; |
|
85 | - case 'remote_wipe_start': |
|
86 | - $params = $event->getSubjectParameters(); |
|
87 | - $event->setParsedSubject($l->t('Remote wipe was started on %1$s', [ |
|
88 | - $params['name'], |
|
89 | - ])); |
|
90 | - if ($this->activityManager->getRequirePNG()) { |
|
91 | - $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/delete.png'))); |
|
92 | - } else { |
|
93 | - $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/delete.svg'))); |
|
94 | - } |
|
95 | - break; |
|
96 | - case 'remote_wipe_finish': |
|
97 | - $params = $event->getSubjectParameters(); |
|
98 | - $event->setParsedSubject($l->t('Remote wipe has finished on %1$s', [ |
|
99 | - $params['name'], |
|
100 | - ])); |
|
101 | - if ($this->activityManager->getRequirePNG()) { |
|
102 | - $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/delete.png'))); |
|
103 | - } else { |
|
104 | - $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/delete.svg'))); |
|
105 | - } |
|
106 | - break; |
|
107 | - default: |
|
108 | - throw new InvalidArgumentException(); |
|
109 | - } |
|
110 | - return $event; |
|
111 | - } |
|
62 | + switch ($event->getSubject()) { |
|
63 | + case 'twofactor_success': |
|
64 | + $params = $event->getSubjectParameters(); |
|
65 | + $event->setParsedSubject($l->t('You successfully logged in using two-factor authentication (%1$s)', [ |
|
66 | + $params['provider'], |
|
67 | + ])); |
|
68 | + if ($this->activityManager->getRequirePNG()) { |
|
69 | + $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.png'))); |
|
70 | + } else { |
|
71 | + $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.svg'))); |
|
72 | + } |
|
73 | + break; |
|
74 | + case 'twofactor_failed': |
|
75 | + $params = $event->getSubjectParameters(); |
|
76 | + $event->setParsedSubject($l->t('A login attempt using two-factor authentication failed (%1$s)', [ |
|
77 | + $params['provider'], |
|
78 | + ])); |
|
79 | + if ($this->activityManager->getRequirePNG()) { |
|
80 | + $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.png'))); |
|
81 | + } else { |
|
82 | + $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.svg'))); |
|
83 | + } |
|
84 | + break; |
|
85 | + case 'remote_wipe_start': |
|
86 | + $params = $event->getSubjectParameters(); |
|
87 | + $event->setParsedSubject($l->t('Remote wipe was started on %1$s', [ |
|
88 | + $params['name'], |
|
89 | + ])); |
|
90 | + if ($this->activityManager->getRequirePNG()) { |
|
91 | + $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/delete.png'))); |
|
92 | + } else { |
|
93 | + $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/delete.svg'))); |
|
94 | + } |
|
95 | + break; |
|
96 | + case 'remote_wipe_finish': |
|
97 | + $params = $event->getSubjectParameters(); |
|
98 | + $event->setParsedSubject($l->t('Remote wipe has finished on %1$s', [ |
|
99 | + $params['name'], |
|
100 | + ])); |
|
101 | + if ($this->activityManager->getRequirePNG()) { |
|
102 | + $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/delete.png'))); |
|
103 | + } else { |
|
104 | + $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/delete.svg'))); |
|
105 | + } |
|
106 | + break; |
|
107 | + default: |
|
108 | + throw new InvalidArgumentException(); |
|
109 | + } |
|
110 | + return $event; |
|
111 | + } |
|
112 | 112 | |
113 | 113 | } |