@@ -27,12 +27,12 @@ |
||
27 | 27 | * Allow the backend to mark groups to be excluded from being shown in search dialogs |
28 | 28 | */ |
29 | 29 | interface IHideFromCollaborationBackend { |
30 | - /** |
|
31 | - * Check if a group should be hidden from search dialogs |
|
32 | - * |
|
33 | - * @param string $groupId |
|
34 | - * @return bool |
|
35 | - * @since 16.0.0 |
|
36 | - */ |
|
37 | - public function hideGroup(string $groupId): bool; |
|
30 | + /** |
|
31 | + * Check if a group should be hidden from search dialogs |
|
32 | + * |
|
33 | + * @param string $groupId |
|
34 | + * @return bool |
|
35 | + * @since 16.0.0 |
|
36 | + */ |
|
37 | + public function hideGroup(string $groupId): bool; |
|
38 | 38 | } |
@@ -34,20 +34,20 @@ |
||
34 | 34 | * @method void setHashedCode(string $token) |
35 | 35 | */ |
36 | 36 | class AccessToken extends Entity { |
37 | - /** @var int */ |
|
38 | - protected $tokenId; |
|
39 | - /** @var int */ |
|
40 | - protected $clientId; |
|
41 | - /** @var string */ |
|
42 | - protected $hashedCode; |
|
43 | - /** @var string */ |
|
44 | - protected $encryptedToken; |
|
37 | + /** @var int */ |
|
38 | + protected $tokenId; |
|
39 | + /** @var int */ |
|
40 | + protected $clientId; |
|
41 | + /** @var string */ |
|
42 | + protected $hashedCode; |
|
43 | + /** @var string */ |
|
44 | + protected $encryptedToken; |
|
45 | 45 | |
46 | - public function __construct() { |
|
47 | - $this->addType('id', 'int'); |
|
48 | - $this->addType('tokenId', 'int'); |
|
49 | - $this->addType('clientId', 'int'); |
|
50 | - $this->addType('hashedCode', 'string'); |
|
51 | - $this->addType('encryptedToken', 'string'); |
|
52 | - } |
|
46 | + public function __construct() { |
|
47 | + $this->addType('id', 'int'); |
|
48 | + $this->addType('tokenId', 'int'); |
|
49 | + $this->addType('clientId', 'int'); |
|
50 | + $this->addType('hashedCode', 'string'); |
|
51 | + $this->addType('encryptedToken', 'string'); |
|
52 | + } |
|
53 | 53 | } |
@@ -26,16 +26,16 @@ |
||
26 | 26 | use OC\Authentication\Token\IToken; |
27 | 27 | |
28 | 28 | class WipeTokenException extends InvalidTokenException { |
29 | - /** @var IToken */ |
|
30 | - private $token; |
|
29 | + /** @var IToken */ |
|
30 | + private $token; |
|
31 | 31 | |
32 | - public function __construct(IToken $token) { |
|
33 | - parent::__construct(); |
|
32 | + public function __construct(IToken $token) { |
|
33 | + parent::__construct(); |
|
34 | 34 | |
35 | - $this->token = $token; |
|
36 | - } |
|
35 | + $this->token = $token; |
|
36 | + } |
|
37 | 37 | |
38 | - public function getToken(): IToken { |
|
39 | - return $this->token; |
|
40 | - } |
|
38 | + public function getToken(): IToken { |
|
39 | + return $this->token; |
|
40 | + } |
|
41 | 41 | } |
@@ -30,43 +30,43 @@ |
||
30 | 30 | |
31 | 31 | class RegenerateBirthdayCalendars implements IRepairStep { |
32 | 32 | |
33 | - /** @var IJobList */ |
|
34 | - private $jobList; |
|
33 | + /** @var IJobList */ |
|
34 | + private $jobList; |
|
35 | 35 | |
36 | - /** @var IConfig */ |
|
37 | - private $config; |
|
36 | + /** @var IConfig */ |
|
37 | + private $config; |
|
38 | 38 | |
39 | - /** |
|
40 | - * @param IJobList $jobList |
|
41 | - * @param IConfig $config |
|
42 | - */ |
|
43 | - public function __construct(IJobList $jobList, |
|
44 | - IConfig $config) { |
|
45 | - $this->jobList = $jobList; |
|
46 | - $this->config = $config; |
|
47 | - } |
|
39 | + /** |
|
40 | + * @param IJobList $jobList |
|
41 | + * @param IConfig $config |
|
42 | + */ |
|
43 | + public function __construct(IJobList $jobList, |
|
44 | + IConfig $config) { |
|
45 | + $this->jobList = $jobList; |
|
46 | + $this->config = $config; |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * @return string |
|
51 | - */ |
|
52 | - public function getName() { |
|
53 | - return 'Regenerating birthday calendars to use new icons and fix old birthday events without year'; |
|
54 | - } |
|
49 | + /** |
|
50 | + * @return string |
|
51 | + */ |
|
52 | + public function getName() { |
|
53 | + return 'Regenerating birthday calendars to use new icons and fix old birthday events without year'; |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * @param IOutput $output |
|
58 | - */ |
|
59 | - public function run(IOutput $output) { |
|
60 | - // only run once |
|
61 | - if ($this->config->getAppValue('dav', 'regeneratedBirthdayCalendarsForYearFix') === 'yes') { |
|
62 | - $output->info('Repair step already executed'); |
|
63 | - return; |
|
64 | - } |
|
56 | + /** |
|
57 | + * @param IOutput $output |
|
58 | + */ |
|
59 | + public function run(IOutput $output) { |
|
60 | + // only run once |
|
61 | + if ($this->config->getAppValue('dav', 'regeneratedBirthdayCalendarsForYearFix') === 'yes') { |
|
62 | + $output->info('Repair step already executed'); |
|
63 | + return; |
|
64 | + } |
|
65 | 65 | |
66 | - $output->info('Adding background jobs to regenerate birthday calendar'); |
|
67 | - $this->jobList->add(RegisterRegenerateBirthdayCalendars::class); |
|
66 | + $output->info('Adding background jobs to regenerate birthday calendar'); |
|
67 | + $this->jobList->add(RegisterRegenerateBirthdayCalendars::class); |
|
68 | 68 | |
69 | - // if all were done, no need to redo the repair during next upgrade |
|
70 | - $this->config->setAppValue('dav', 'regeneratedBirthdayCalendarsForYearFix', 'yes'); |
|
71 | - } |
|
69 | + // if all were done, no need to redo the repair during next upgrade |
|
70 | + $this->config->setAppValue('dav', 'regeneratedBirthdayCalendarsForYearFix', 'yes'); |
|
71 | + } |
|
72 | 72 | } |
@@ -35,33 +35,33 @@ |
||
35 | 35 | |
36 | 36 | class ProviderDisabled implements IEventListener { |
37 | 37 | |
38 | - /** @var IRegistry */ |
|
39 | - private $registry; |
|
38 | + /** @var IRegistry */ |
|
39 | + private $registry; |
|
40 | 40 | |
41 | - /** @var IJobList */ |
|
42 | - private $jobList; |
|
41 | + /** @var IJobList */ |
|
42 | + private $jobList; |
|
43 | 43 | |
44 | - public function __construct(IRegistry $registry, |
|
45 | - IJobList $jobList) { |
|
46 | - $this->registry = $registry; |
|
47 | - $this->jobList = $jobList; |
|
48 | - } |
|
44 | + public function __construct(IRegistry $registry, |
|
45 | + IJobList $jobList) { |
|
46 | + $this->registry = $registry; |
|
47 | + $this->jobList = $jobList; |
|
48 | + } |
|
49 | 49 | |
50 | - public function handle(Event $event): void { |
|
51 | - if (!($event instanceof RegistryEvent)) { |
|
52 | - return; |
|
53 | - } |
|
50 | + public function handle(Event $event): void { |
|
51 | + if (!($event instanceof RegistryEvent)) { |
|
52 | + return; |
|
53 | + } |
|
54 | 54 | |
55 | - $providers = $this->registry->getProviderStates($event->getUser()); |
|
55 | + $providers = $this->registry->getProviderStates($event->getUser()); |
|
56 | 56 | |
57 | - // Loop over all providers. If all are disabled we remove the job |
|
58 | - $state = array_reduce($providers, function (bool $carry, bool $enabled) { |
|
59 | - return $carry || $enabled; |
|
60 | - }, false); |
|
57 | + // Loop over all providers. If all are disabled we remove the job |
|
58 | + $state = array_reduce($providers, function (bool $carry, bool $enabled) { |
|
59 | + return $carry || $enabled; |
|
60 | + }, false); |
|
61 | 61 | |
62 | - if ($state === false) { |
|
63 | - $this->jobList->remove(RememberBackupCodesJob::class, ['uid' => $event->getUser()->getUID()]); |
|
64 | - } |
|
65 | - } |
|
62 | + if ($state === false) { |
|
63 | + $this->jobList->remove(RememberBackupCodesJob::class, ['uid' => $event->getUser()->getUID()]); |
|
64 | + } |
|
65 | + } |
|
66 | 66 | |
67 | 67 | } |
@@ -33,30 +33,30 @@ |
||
33 | 33 | |
34 | 34 | class ProviderEnabled implements IEventListener { |
35 | 35 | |
36 | - /** @var IRegistry */ |
|
37 | - private $registry; |
|
38 | - |
|
39 | - /** @var IJobList */ |
|
40 | - private $jobList; |
|
41 | - |
|
42 | - public function __construct(IRegistry $registry, |
|
43 | - IJobList $jobList) { |
|
44 | - $this->registry = $registry; |
|
45 | - $this->jobList = $jobList; |
|
46 | - } |
|
47 | - |
|
48 | - public function handle(Event $event): void { |
|
49 | - if (!($event instanceof RegistryEvent)) { |
|
50 | - return; |
|
51 | - } |
|
52 | - |
|
53 | - $providers = $this->registry->getProviderStates($event->getUser()); |
|
54 | - if (isset($providers['backup_codes']) && $providers['backup_codes'] === true) { |
|
55 | - // Backup codes already generated nothing to do here |
|
56 | - return; |
|
57 | - } |
|
58 | - |
|
59 | - $this->jobList->add(RememberBackupCodesJob::class, ['uid' => $event->getUser()->getUID()]); |
|
60 | - } |
|
36 | + /** @var IRegistry */ |
|
37 | + private $registry; |
|
38 | + |
|
39 | + /** @var IJobList */ |
|
40 | + private $jobList; |
|
41 | + |
|
42 | + public function __construct(IRegistry $registry, |
|
43 | + IJobList $jobList) { |
|
44 | + $this->registry = $registry; |
|
45 | + $this->jobList = $jobList; |
|
46 | + } |
|
47 | + |
|
48 | + public function handle(Event $event): void { |
|
49 | + if (!($event instanceof RegistryEvent)) { |
|
50 | + return; |
|
51 | + } |
|
52 | + |
|
53 | + $providers = $this->registry->getProviderStates($event->getUser()); |
|
54 | + if (isset($providers['backup_codes']) && $providers['backup_codes'] === true) { |
|
55 | + // Backup codes already generated nothing to do here |
|
56 | + return; |
|
57 | + } |
|
58 | + |
|
59 | + $this->jobList->add(RememberBackupCodesJob::class, ['uid' => $event->getUser()->getUID()]); |
|
60 | + } |
|
61 | 61 | |
62 | 62 | } |
@@ -33,22 +33,22 @@ |
||
33 | 33 | |
34 | 34 | class ClearNotifications implements IEventListener { |
35 | 35 | |
36 | - /** @var IManager */ |
|
37 | - private $manager; |
|
38 | - |
|
39 | - public function __construct(IManager $manager) { |
|
40 | - $this->manager = $manager; |
|
41 | - } |
|
42 | - |
|
43 | - public function handle(Event $event): void { |
|
44 | - if (!($event instanceof CodesGenerated)) { |
|
45 | - return; |
|
46 | - } |
|
47 | - |
|
48 | - $notification = $this->manager->createNotification(); |
|
49 | - $notification->setApp('twofactor_backupcodes') |
|
50 | - ->setUser($event->getUser()->getUID()) |
|
51 | - ->setObject('create', 'codes'); |
|
52 | - $this->manager->markProcessed($notification); |
|
53 | - } |
|
36 | + /** @var IManager */ |
|
37 | + private $manager; |
|
38 | + |
|
39 | + public function __construct(IManager $manager) { |
|
40 | + $this->manager = $manager; |
|
41 | + } |
|
42 | + |
|
43 | + public function handle(Event $event): void { |
|
44 | + if (!($event instanceof CodesGenerated)) { |
|
45 | + return; |
|
46 | + } |
|
47 | + |
|
48 | + $notification = $this->manager->createNotification(); |
|
49 | + $notification->setApp('twofactor_backupcodes') |
|
50 | + ->setUser($event->getUser()->getUID()) |
|
51 | + ->setObject('create', 'codes'); |
|
52 | + $this->manager->markProcessed($notification); |
|
53 | + } |
|
54 | 54 | } |
@@ -33,36 +33,36 @@ |
||
33 | 33 | |
34 | 34 | class ActivityPublisher implements IEventListener { |
35 | 35 | |
36 | - /** @var IManager */ |
|
37 | - private $activityManager; |
|
36 | + /** @var IManager */ |
|
37 | + private $activityManager; |
|
38 | 38 | |
39 | - /** @var ILogger */ |
|
40 | - private $logger; |
|
39 | + /** @var ILogger */ |
|
40 | + private $logger; |
|
41 | 41 | |
42 | - public function __construct(IManager $activityManager, |
|
43 | - ILogger $logger) { |
|
44 | - $this->activityManager = $activityManager; |
|
45 | - $this->logger = $logger; |
|
46 | - } |
|
42 | + public function __construct(IManager $activityManager, |
|
43 | + ILogger $logger) { |
|
44 | + $this->activityManager = $activityManager; |
|
45 | + $this->logger = $logger; |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * Push an event to the user's activity stream |
|
50 | - */ |
|
51 | - public function handle(Event $event): void { |
|
52 | - if ($event instanceof CodesGenerated) { |
|
53 | - $activity = $this->activityManager->generateEvent(); |
|
54 | - $activity->setApp('twofactor_backupcodes') |
|
55 | - ->setType('security') |
|
56 | - ->setAuthor($event->getUser()->getUID()) |
|
57 | - ->setAffectedUser($event->getUser()->getUID()) |
|
58 | - ->setSubject('codes_generated'); |
|
59 | - try { |
|
60 | - $this->activityManager->publish($activity); |
|
61 | - } catch (BadMethodCallException $e) { |
|
62 | - $this->logger->warning('could not publish backup code creation activity', ['app' => 'twofactor_backupcodes']); |
|
63 | - $this->logger->logException($e, ['app' => 'twofactor_backupcodes']); |
|
64 | - } |
|
65 | - } |
|
66 | - } |
|
48 | + /** |
|
49 | + * Push an event to the user's activity stream |
|
50 | + */ |
|
51 | + public function handle(Event $event): void { |
|
52 | + if ($event instanceof CodesGenerated) { |
|
53 | + $activity = $this->activityManager->generateEvent(); |
|
54 | + $activity->setApp('twofactor_backupcodes') |
|
55 | + ->setType('security') |
|
56 | + ->setAuthor($event->getUser()->getUID()) |
|
57 | + ->setAffectedUser($event->getUser()->getUID()) |
|
58 | + ->setSubject('codes_generated'); |
|
59 | + try { |
|
60 | + $this->activityManager->publish($activity); |
|
61 | + } catch (BadMethodCallException $e) { |
|
62 | + $this->logger->warning('could not publish backup code creation activity', ['app' => 'twofactor_backupcodes']); |
|
63 | + $this->logger->logException($e, ['app' => 'twofactor_backupcodes']); |
|
64 | + } |
|
65 | + } |
|
66 | + } |
|
67 | 67 | |
68 | 68 | } |
@@ -32,21 +32,21 @@ |
||
32 | 32 | |
33 | 33 | class RegistryUpdater implements IEventListener { |
34 | 34 | |
35 | - /** @var IRegistry */ |
|
36 | - private $registry; |
|
37 | - |
|
38 | - /** @var BackupCodesProvider */ |
|
39 | - private $provider; |
|
40 | - |
|
41 | - public function __construct(IRegistry $registry, BackupCodesProvider $provider) { |
|
42 | - $this->registry = $registry; |
|
43 | - $this->provider = $provider; |
|
44 | - } |
|
45 | - |
|
46 | - public function handle(Event $event): void { |
|
47 | - if ($event instanceof CodesGenerated) { |
|
48 | - $this->registry->enableProviderFor($this->provider, $event->getUser()); |
|
49 | - } |
|
50 | - } |
|
35 | + /** @var IRegistry */ |
|
36 | + private $registry; |
|
37 | + |
|
38 | + /** @var BackupCodesProvider */ |
|
39 | + private $provider; |
|
40 | + |
|
41 | + public function __construct(IRegistry $registry, BackupCodesProvider $provider) { |
|
42 | + $this->registry = $registry; |
|
43 | + $this->provider = $provider; |
|
44 | + } |
|
45 | + |
|
46 | + public function handle(Event $event): void { |
|
47 | + if ($event instanceof CodesGenerated) { |
|
48 | + $this->registry->enableProviderFor($this->provider, $event->getUser()); |
|
49 | + } |
|
50 | + } |
|
51 | 51 | |
52 | 52 | } |