diff options
author | Joas Schilling <coding@schilljs.com> | 2019-04-30 14:29:30 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2019-07-15 15:15:00 +0200 |
commit | 6d71e471e166c30c0b9abe05d36240b9f1556d8e (patch) | |
tree | 561fe5a415ddfc239f9b6e2549df55bfa6a7e51b /apps/user_ldap | |
parent | 64f67818bcc6cc61cc49b1a7c032f3db85b73c91 (diff) | |
download | nextcloud-server-6d71e471e166c30c0b9abe05d36240b9f1556d8e.tar.gz nextcloud-server-6d71e471e166c30c0b9abe05d36240b9f1556d8e.zip |
Update shipped implementations of the INotifier
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/user_ldap')
-rw-r--r-- | apps/user_ldap/appinfo/app.php | 12 | ||||
-rw-r--r-- | apps/user_ldap/lib/Notification/Notifier.php | 22 |
2 files changed, 22 insertions, 12 deletions
diff --git a/apps/user_ldap/appinfo/app.php b/apps/user_ldap/appinfo/app.php index 5afd928301a..34b850e655d 100644 --- a/apps/user_ldap/appinfo/app.php +++ b/apps/user_ldap/appinfo/app.php @@ -42,17 +42,7 @@ if(count($configPrefixes) > 0) { $ldapWrapper = new OCA\User_LDAP\LDAP(); $ocConfig = \OC::$server->getConfig(); $notificationManager = \OC::$server->getNotificationManager(); - $notificationManager->registerNotifier(function() { - return new \OCA\User_LDAP\Notification\Notifier( - \OC::$server->getL10NFactory() - ); - }, function() { - $l = \OC::$server->getL10N('user_ldap'); - return [ - 'id' => 'user_ldap', - 'name' => $l->t('LDAP user and group backend'), - ]; - }); + $notificationManager->registerNotifier(\OCA\User_LDAP\Notification\Notifier::class); $userSession = \OC::$server->getUserSession(); $userPluginManager = \OC::$server->query('LDAPUserPluginManager'); diff --git a/apps/user_ldap/lib/Notification/Notifier.php b/apps/user_ldap/lib/Notification/Notifier.php index 34625a3bef4..2c89743fa72 100644 --- a/apps/user_ldap/lib/Notification/Notifier.php +++ b/apps/user_ldap/lib/Notification/Notifier.php @@ -43,12 +43,32 @@ class Notifier implements INotifier { } /** + * Identifier of the notifier, only use [a-z0-9_] + * + * @return string + * @since 17.0.0 + */ + public function getID(): string { + return 'user_ldap'; + } + + /** + * Human readable name describing the notifier + * + * @return string + * @since 17.0.0 + */ + public function getName(): string { + return $this->l10nFactory->get('user_ldap')->t('LDAP User backend'); + } + + /** * @param INotification $notification * @param string $languageCode The code of the language that should be used to prepare the notification * @return INotification * @throws \InvalidArgumentException When the notification was not prepared by a notifier */ - public function prepare(INotification $notification, $languageCode) { + public function prepare(INotification $notification, string $languageCode): INotification { if ($notification->getApp() !== 'user_ldap') { // Not my app => throw throw new \InvalidArgumentException(); |