@@ -30,35 +30,35 @@ |
||
30 | 30 | */ |
31 | 31 | interface IRegistry { |
32 | 32 | |
33 | - /** |
|
34 | - * Register a subscription instance. In case it is called multiple times the |
|
35 | - * first one is used. |
|
36 | - * |
|
37 | - * @param ISubscription $subscription |
|
38 | - * @throws AlreadyRegisteredException |
|
39 | - * |
|
40 | - * @since 17.0.0 |
|
41 | - */ |
|
42 | - public function register(ISubscription $subscription): void; |
|
33 | + /** |
|
34 | + * Register a subscription instance. In case it is called multiple times the |
|
35 | + * first one is used. |
|
36 | + * |
|
37 | + * @param ISubscription $subscription |
|
38 | + * @throws AlreadyRegisteredException |
|
39 | + * |
|
40 | + * @since 17.0.0 |
|
41 | + */ |
|
42 | + public function register(ISubscription $subscription): void; |
|
43 | 43 | |
44 | - /** |
|
45 | - * Fetches the list of app IDs that are supported by the subscription |
|
46 | - * |
|
47 | - * @since 17.0.0 |
|
48 | - */ |
|
49 | - public function delegateGetSupportedApps(): array; |
|
44 | + /** |
|
45 | + * Fetches the list of app IDs that are supported by the subscription |
|
46 | + * |
|
47 | + * @since 17.0.0 |
|
48 | + */ |
|
49 | + public function delegateGetSupportedApps(): array; |
|
50 | 50 | |
51 | - /** |
|
52 | - * Indicates if a valid subscription is available |
|
53 | - * |
|
54 | - * @since 17.0.0 |
|
55 | - */ |
|
56 | - public function delegateHasValidSubscription(): bool; |
|
51 | + /** |
|
52 | + * Indicates if a valid subscription is available |
|
53 | + * |
|
54 | + * @since 17.0.0 |
|
55 | + */ |
|
56 | + public function delegateHasValidSubscription(): bool; |
|
57 | 57 | |
58 | - /** |
|
59 | - * Indicates if the subscription has extended support |
|
60 | - * |
|
61 | - * @since 17.0.0 |
|
62 | - */ |
|
63 | - public function delegateHasExtendedSupport(): bool; |
|
58 | + /** |
|
59 | + * Indicates if the subscription has extended support |
|
60 | + * |
|
61 | + * @since 17.0.0 |
|
62 | + */ |
|
63 | + public function delegateHasExtendedSupport(): bool; |
|
64 | 64 | } |
@@ -29,11 +29,11 @@ |
||
29 | 29 | * |
30 | 30 | */ |
31 | 31 | |
32 | -require_once __DIR__ . '/lib/versioncheck.php'; |
|
32 | +require_once __DIR__.'/lib/versioncheck.php'; |
|
33 | 33 | |
34 | 34 | try { |
35 | 35 | |
36 | - require_once __DIR__ . '/lib/base.php'; |
|
36 | + require_once __DIR__.'/lib/base.php'; |
|
37 | 37 | |
38 | 38 | $systemConfig = \OC::$server->getSystemConfig(); |
39 | 39 |
@@ -34,33 +34,33 @@ |
||
34 | 34 | require_once __DIR__ . '/lib/versioncheck.php'; |
35 | 35 | |
36 | 36 | try { |
37 | - require_once __DIR__ . '/lib/base.php'; |
|
37 | + require_once __DIR__ . '/lib/base.php'; |
|
38 | 38 | |
39 | - $systemConfig = \OC::$server->getSystemConfig(); |
|
39 | + $systemConfig = \OC::$server->getSystemConfig(); |
|
40 | 40 | |
41 | - $installed = (bool) $systemConfig->getValue('installed', false); |
|
42 | - $maintenance = (bool) $systemConfig->getValue('maintenance', false); |
|
43 | - # see core/lib/private/legacy/defaults.php and core/themes/example/defaults.php |
|
44 | - # for description and defaults |
|
45 | - $defaults = new \OCP\Defaults(); |
|
46 | - $values = [ |
|
47 | - 'installed'=>$installed, |
|
48 | - 'maintenance' => $maintenance, |
|
49 | - 'needsDbUpgrade' => \OCP\Util::needUpgrade(), |
|
50 | - 'version'=>implode('.', \OCP\Util::getVersion()), |
|
51 | - 'versionstring'=>OC_Util::getVersionString(), |
|
52 | - 'edition'=> '', |
|
53 | - 'productname'=>$defaults->getName(), |
|
54 | - 'extendedSupport' => \OCP\Util::hasExtendedSupport() |
|
55 | - ]; |
|
56 | - if (OC::$CLI) { |
|
57 | - print_r($values); |
|
58 | - } else { |
|
59 | - header('Access-Control-Allow-Origin: *'); |
|
60 | - header('Content-Type: application/json'); |
|
61 | - echo json_encode($values); |
|
62 | - } |
|
41 | + $installed = (bool) $systemConfig->getValue('installed', false); |
|
42 | + $maintenance = (bool) $systemConfig->getValue('maintenance', false); |
|
43 | + # see core/lib/private/legacy/defaults.php and core/themes/example/defaults.php |
|
44 | + # for description and defaults |
|
45 | + $defaults = new \OCP\Defaults(); |
|
46 | + $values = [ |
|
47 | + 'installed'=>$installed, |
|
48 | + 'maintenance' => $maintenance, |
|
49 | + 'needsDbUpgrade' => \OCP\Util::needUpgrade(), |
|
50 | + 'version'=>implode('.', \OCP\Util::getVersion()), |
|
51 | + 'versionstring'=>OC_Util::getVersionString(), |
|
52 | + 'edition'=> '', |
|
53 | + 'productname'=>$defaults->getName(), |
|
54 | + 'extendedSupport' => \OCP\Util::hasExtendedSupport() |
|
55 | + ]; |
|
56 | + if (OC::$CLI) { |
|
57 | + print_r($values); |
|
58 | + } else { |
|
59 | + header('Access-Control-Allow-Origin: *'); |
|
60 | + header('Content-Type: application/json'); |
|
61 | + echo json_encode($values); |
|
62 | + } |
|
63 | 63 | } catch (Exception $ex) { |
64 | - http_response_code(500); |
|
65 | - \OC::$server->getLogger()->logException($ex, ['app' => 'remote']); |
|
64 | + http_response_code(500); |
|
65 | + \OC::$server->getLogger()->logException($ex, ['app' => 'remote']); |
|
66 | 66 | } |
@@ -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 | } |
@@ -30,11 +30,11 @@ |
||
30 | 30 | */ |
31 | 31 | interface IEventListener { |
32 | 32 | |
33 | - /** |
|
34 | - * @param Event $event |
|
35 | - * |
|
36 | - * @since 17.0.0 |
|
37 | - */ |
|
38 | - public function handle(Event $event): void; |
|
33 | + /** |
|
34 | + * @param Event $event |
|
35 | + * |
|
36 | + * @since 17.0.0 |
|
37 | + */ |
|
38 | + public function handle(Event $event): void; |
|
39 | 39 | |
40 | 40 | } |
@@ -39,40 +39,40 @@ |
||
39 | 39 | */ |
40 | 40 | final class ServiceEventListener { |
41 | 41 | |
42 | - /** @var IContainer */ |
|
43 | - private $container; |
|
42 | + /** @var IContainer */ |
|
43 | + private $container; |
|
44 | 44 | |
45 | - /** @var string */ |
|
46 | - private $class; |
|
45 | + /** @var string */ |
|
46 | + private $class; |
|
47 | 47 | |
48 | - /** @var ILogger */ |
|
49 | - private $logger; |
|
48 | + /** @var ILogger */ |
|
49 | + private $logger; |
|
50 | 50 | |
51 | - /** @var null|IEventListener */ |
|
52 | - private $service; |
|
51 | + /** @var null|IEventListener */ |
|
52 | + private $service; |
|
53 | 53 | |
54 | - public function __construct(IContainer $container, |
|
55 | - string $class, |
|
56 | - ILogger $logger) { |
|
57 | - $this->container = $container; |
|
58 | - $this->class = $class; |
|
59 | - $this->logger = $logger; |
|
60 | - } |
|
54 | + public function __construct(IContainer $container, |
|
55 | + string $class, |
|
56 | + ILogger $logger) { |
|
57 | + $this->container = $container; |
|
58 | + $this->class = $class; |
|
59 | + $this->logger = $logger; |
|
60 | + } |
|
61 | 61 | |
62 | - public function __invoke(Event $event) { |
|
63 | - if ($this->service === null) { |
|
64 | - try { |
|
65 | - $this->service = $this->container->query($this->class); |
|
66 | - } catch (QueryException $e) { |
|
67 | - $this->logger->logException($e, [ |
|
68 | - 'level' => ILogger::ERROR, |
|
69 | - 'message' => "Could not load event listener service " . $this->class, |
|
70 | - ]); |
|
71 | - return; |
|
72 | - } |
|
73 | - } |
|
62 | + public function __invoke(Event $event) { |
|
63 | + if ($this->service === null) { |
|
64 | + try { |
|
65 | + $this->service = $this->container->query($this->class); |
|
66 | + } catch (QueryException $e) { |
|
67 | + $this->logger->logException($e, [ |
|
68 | + 'level' => ILogger::ERROR, |
|
69 | + 'message' => "Could not load event listener service " . $this->class, |
|
70 | + ]); |
|
71 | + return; |
|
72 | + } |
|
73 | + } |
|
74 | 74 | |
75 | - $this->service->handle($event); |
|
76 | - } |
|
75 | + $this->service->handle($event); |
|
76 | + } |
|
77 | 77 | |
78 | 78 | } |
@@ -66,7 +66,7 @@ |
||
66 | 66 | } catch (QueryException $e) { |
67 | 67 | $this->logger->logException($e, [ |
68 | 68 | 'level' => ILogger::ERROR, |
69 | - 'message' => "Could not load event listener service " . $this->class, |
|
69 | + 'message' => "Could not load event listener service ".$this->class, |
|
70 | 70 | ]); |
71 | 71 | return; |
72 | 72 | } |
@@ -29,19 +29,19 @@ |
||
29 | 29 | |
30 | 30 | class CodesGenerated extends Event { |
31 | 31 | |
32 | - /** @var IUser */ |
|
33 | - private $user; |
|
34 | - |
|
35 | - public function __construct(IUser $user) { |
|
36 | - parent::__construct(); |
|
37 | - $this->user = $user; |
|
38 | - } |
|
39 | - |
|
40 | - /** |
|
41 | - * @return IUser |
|
42 | - */ |
|
43 | - public function getUser(): IUser { |
|
44 | - return $this->user; |
|
45 | - } |
|
32 | + /** @var IUser */ |
|
33 | + private $user; |
|
34 | + |
|
35 | + public function __construct(IUser $user) { |
|
36 | + parent::__construct(); |
|
37 | + $this->user = $user; |
|
38 | + } |
|
39 | + |
|
40 | + /** |
|
41 | + * @return IUser |
|
42 | + */ |
|
43 | + public function getUser(): IUser { |
|
44 | + return $this->user; |
|
45 | + } |
|
46 | 46 | |
47 | 47 | } |
@@ -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 | } |