@@ -26,68 +26,68 @@ |
||
26 | 26 | |
27 | 27 | interface ILDAPUserPlugin { |
28 | 28 | |
29 | - /** |
|
30 | - * Check if plugin implements actions |
|
31 | - * @return int |
|
32 | - * |
|
33 | - * Returns the supported actions as int to be |
|
34 | - * compared with OC_USER_BACKEND_CREATE_USER etc. |
|
35 | - */ |
|
36 | - public function respondToActions(); |
|
29 | + /** |
|
30 | + * Check if plugin implements actions |
|
31 | + * @return int |
|
32 | + * |
|
33 | + * Returns the supported actions as int to be |
|
34 | + * compared with OC_USER_BACKEND_CREATE_USER etc. |
|
35 | + */ |
|
36 | + public function respondToActions(); |
|
37 | 37 | |
38 | - /** |
|
39 | - * Create a new user in LDAP Backend |
|
40 | - * |
|
41 | - * @param string $uid The UID of the user to create |
|
42 | - * @param string $password The password of the new user |
|
43 | - * @return bool|string |
|
44 | - */ |
|
45 | - public function createUser($uid, $password); |
|
38 | + /** |
|
39 | + * Create a new user in LDAP Backend |
|
40 | + * |
|
41 | + * @param string $uid The UID of the user to create |
|
42 | + * @param string $password The password of the new user |
|
43 | + * @return bool|string |
|
44 | + */ |
|
45 | + public function createUser($uid, $password); |
|
46 | 46 | |
47 | - /** |
|
48 | - * Set password |
|
49 | - * |
|
50 | - * @param string $uid The username |
|
51 | - * @param string $password The new password |
|
52 | - * @return bool |
|
53 | - * |
|
54 | - * Change the password of a user |
|
55 | - */ |
|
56 | - public function setPassword($uid, $password); |
|
47 | + /** |
|
48 | + * Set password |
|
49 | + * |
|
50 | + * @param string $uid The username |
|
51 | + * @param string $password The new password |
|
52 | + * @return bool |
|
53 | + * |
|
54 | + * Change the password of a user |
|
55 | + */ |
|
56 | + public function setPassword($uid, $password); |
|
57 | 57 | |
58 | - /** |
|
59 | - * get the user's home directory |
|
60 | - * @param string $uid the username |
|
61 | - * @return boolean |
|
62 | - */ |
|
63 | - public function getHome($uid); |
|
58 | + /** |
|
59 | + * get the user's home directory |
|
60 | + * @param string $uid the username |
|
61 | + * @return boolean |
|
62 | + */ |
|
63 | + public function getHome($uid); |
|
64 | 64 | |
65 | - /** |
|
66 | - * get display name of the user |
|
67 | - * @param string $uid user ID of the user |
|
68 | - * @return string display name |
|
69 | - */ |
|
70 | - public function getDisplayName($uid); |
|
65 | + /** |
|
66 | + * get display name of the user |
|
67 | + * @param string $uid user ID of the user |
|
68 | + * @return string display name |
|
69 | + */ |
|
70 | + public function getDisplayName($uid); |
|
71 | 71 | |
72 | - /** |
|
73 | - * set display name of the user |
|
74 | - * @param string $uid user ID of the user |
|
75 | - * @param string $displayName new user's display name |
|
76 | - * @return string display name |
|
77 | - */ |
|
78 | - public function setDisplayName($uid, $displayName); |
|
72 | + /** |
|
73 | + * set display name of the user |
|
74 | + * @param string $uid user ID of the user |
|
75 | + * @param string $displayName new user's display name |
|
76 | + * @return string display name |
|
77 | + */ |
|
78 | + public function setDisplayName($uid, $displayName); |
|
79 | 79 | |
80 | - /** |
|
81 | - * checks whether the user is allowed to change his avatar in Nextcloud |
|
82 | - * @param string $uid the Nextcloud user name |
|
83 | - * @return boolean either the user can or cannot |
|
84 | - */ |
|
85 | - public function canChangeAvatar($uid); |
|
80 | + /** |
|
81 | + * checks whether the user is allowed to change his avatar in Nextcloud |
|
82 | + * @param string $uid the Nextcloud user name |
|
83 | + * @return boolean either the user can or cannot |
|
84 | + */ |
|
85 | + public function canChangeAvatar($uid); |
|
86 | 86 | |
87 | - /** |
|
88 | - * Count the number of users |
|
89 | - * @return int|bool |
|
90 | - */ |
|
91 | - public function countUsers(); |
|
87 | + /** |
|
88 | + * Count the number of users |
|
89 | + * @return int|bool |
|
90 | + */ |
|
91 | + public function countUsers(); |
|
92 | 92 | |
93 | 93 | } |
@@ -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 | } |
@@ -30,31 +30,31 @@ |
||
30 | 30 | * @deprecated 17.0.0 use IProviderV2 instead |
31 | 31 | */ |
32 | 32 | interface IProvider { |
33 | - /** |
|
34 | - * @return string Regex with the mimetypes that are supported by this provider |
|
35 | - * @since 8.1.0 |
|
36 | - */ |
|
37 | - public function getMimeType(); |
|
33 | + /** |
|
34 | + * @return string Regex with the mimetypes that are supported by this provider |
|
35 | + * @since 8.1.0 |
|
36 | + */ |
|
37 | + public function getMimeType(); |
|
38 | 38 | |
39 | - /** |
|
40 | - * Check if a preview can be generated for $path |
|
41 | - * |
|
42 | - * @param \OCP\Files\FileInfo $file |
|
43 | - * @return bool |
|
44 | - * @since 8.1.0 |
|
45 | - */ |
|
46 | - public function isAvailable(\OCP\Files\FileInfo $file); |
|
39 | + /** |
|
40 | + * Check if a preview can be generated for $path |
|
41 | + * |
|
42 | + * @param \OCP\Files\FileInfo $file |
|
43 | + * @return bool |
|
44 | + * @since 8.1.0 |
|
45 | + */ |
|
46 | + public function isAvailable(\OCP\Files\FileInfo $file); |
|
47 | 47 | |
48 | - /** |
|
49 | - * get thumbnail for file at path $path |
|
50 | - * |
|
51 | - * @param string $path Path of file |
|
52 | - * @param int $maxX The maximum X size of the thumbnail. It can be smaller depending on the shape of the image |
|
53 | - * @param int $maxY The maximum Y size of the thumbnail. It can be smaller depending on the shape of the image |
|
54 | - * @param bool $scalingup Disable/Enable upscaling of previews |
|
55 | - * @param \OC\Files\View $fileview fileview object of user folder |
|
56 | - * @return bool|\OCP\IImage false if no preview was generated |
|
57 | - * @since 8.1.0 |
|
58 | - */ |
|
59 | - public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview); |
|
48 | + /** |
|
49 | + * get thumbnail for file at path $path |
|
50 | + * |
|
51 | + * @param string $path Path of file |
|
52 | + * @param int $maxX The maximum X size of the thumbnail. It can be smaller depending on the shape of the image |
|
53 | + * @param int $maxY The maximum Y size of the thumbnail. It can be smaller depending on the shape of the image |
|
54 | + * @param bool $scalingup Disable/Enable upscaling of previews |
|
55 | + * @param \OC\Files\View $fileview fileview object of user folder |
|
56 | + * @return bool|\OCP\IImage false if no preview was generated |
|
57 | + * @since 8.1.0 |
|
58 | + */ |
|
59 | + public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview); |
|
60 | 60 | } |
@@ -29,29 +29,29 @@ |
||
29 | 29 | * @since 17.0.0 |
30 | 30 | */ |
31 | 31 | interface IProviderV2 { |
32 | - /** |
|
33 | - * @return string Regex with the mimetypes that are supported by this provider |
|
34 | - * @since 17.0.0 |
|
35 | - */ |
|
36 | - public function getMimeType(): string; |
|
32 | + /** |
|
33 | + * @return string Regex with the mimetypes that are supported by this provider |
|
34 | + * @since 17.0.0 |
|
35 | + */ |
|
36 | + public function getMimeType(): string; |
|
37 | 37 | |
38 | - /** |
|
39 | - * Check if a preview can be generated for $path |
|
40 | - * |
|
41 | - * @param FileInfo $file |
|
42 | - * @return bool |
|
43 | - * @since 17.0.0 |
|
44 | - */ |
|
45 | - public function isAvailable(FileInfo $file): bool; |
|
38 | + /** |
|
39 | + * Check if a preview can be generated for $path |
|
40 | + * |
|
41 | + * @param FileInfo $file |
|
42 | + * @return bool |
|
43 | + * @since 17.0.0 |
|
44 | + */ |
|
45 | + public function isAvailable(FileInfo $file): bool; |
|
46 | 46 | |
47 | - /** |
|
48 | - * get thumbnail for file at path $path |
|
49 | - * |
|
50 | - * @param File $file |
|
51 | - * @param int $maxX The maximum X size of the thumbnail. It can be smaller depending on the shape of the image |
|
52 | - * @param int $maxY The maximum Y size of the thumbnail. It can be smaller depending on the shape of the image |
|
53 | - * @return null|\OCP\IImage null if no preview was generated |
|
54 | - * @since 17.0.0 |
|
55 | - */ |
|
56 | - public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage; |
|
47 | + /** |
|
48 | + * get thumbnail for file at path $path |
|
49 | + * |
|
50 | + * @param File $file |
|
51 | + * @param int $maxX The maximum X size of the thumbnail. It can be smaller depending on the shape of the image |
|
52 | + * @param int $maxY The maximum Y size of the thumbnail. It can be smaller depending on the shape of the image |
|
53 | + * @return null|\OCP\IImage null if no preview was generated |
|
54 | + * @since 17.0.0 |
|
55 | + */ |
|
56 | + public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage; |
|
57 | 57 | } |
@@ -23,10 +23,10 @@ |
||
23 | 23 | |
24 | 24 | //.doc, .dot |
25 | 25 | class MSOfficeDoc extends Office { |
26 | - /** |
|
27 | - * {@inheritDoc} |
|
28 | - */ |
|
29 | - public function getMimeType(): string { |
|
30 | - return '/application\/msword/'; |
|
31 | - } |
|
26 | + /** |
|
27 | + * {@inheritDoc} |
|
28 | + */ |
|
29 | + public function getMimeType(): string { |
|
30 | + return '/application\/msword/'; |
|
31 | + } |
|
32 | 32 | } |