Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2020-08-12 16:07:55 +0300
committerArthur Schiwon <blizzz@arthur-schiwon.de>2020-08-12 16:38:47 +0300
commit44cad1756c08d0ba522825769611e6a506b85a67 (patch)
treeb5bf1c326e2b473cd780769e1d80f8434cbfc845 /apps/user_ldap
parent4c1f13c5695b117ff58a8b763bea1f10fa8628c2 (diff)
provide event class to LDAP loaded event to fix deprecation message
* and also dispatch the typed event as current approach to it Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/user_ldap')
-rw-r--r--apps/user_ldap/composer/composer/autoload_classmap.php2
-rw-r--r--apps/user_ldap/composer/composer/autoload_static.php2
-rw-r--r--apps/user_ldap/lib/AppInfo/Application.php16
-rw-r--r--apps/user_ldap/lib/Events/GroupBackendRegistered.php51
-rw-r--r--apps/user_ldap/lib/Events/UserBackendRegistered.php51
5 files changed, 117 insertions, 5 deletions
diff --git a/apps/user_ldap/composer/composer/autoload_classmap.php b/apps/user_ldap/composer/composer/autoload_classmap.php
index 2190b24688e..f6d9777ab00 100644
--- a/apps/user_ldap/composer/composer/autoload_classmap.php
+++ b/apps/user_ldap/composer/composer/autoload_classmap.php
@@ -23,6 +23,8 @@ return array(
'OCA\\User_LDAP\\ConnectionFactory' => $baseDir . '/../lib/ConnectionFactory.php',
'OCA\\User_LDAP\\Controller\\ConfigAPIController' => $baseDir . '/../lib/Controller/ConfigAPIController.php',
'OCA\\User_LDAP\\Controller\\RenewPasswordController' => $baseDir . '/../lib/Controller/RenewPasswordController.php',
+ 'OCA\\User_LDAP\\Events\\GroupBackendRegistered' => $baseDir . '/../lib/Events/GroupBackendRegistered.php',
+ 'OCA\\User_LDAP\\Events\\UserBackendRegistered' => $baseDir . '/../lib/Events/UserBackendRegistered.php',
'OCA\\User_LDAP\\Exceptions\\AttributeNotSet' => $baseDir . '/../lib/Exceptions/AttributeNotSet.php',
'OCA\\User_LDAP\\Exceptions\\ConstraintViolationException' => $baseDir . '/../lib/Exceptions/ConstraintViolationException.php',
'OCA\\User_LDAP\\Exceptions\\NotOnLDAP' => $baseDir . '/../lib/Exceptions/NotOnLDAP.php',
diff --git a/apps/user_ldap/composer/composer/autoload_static.php b/apps/user_ldap/composer/composer/autoload_static.php
index 2f77aebad31..c3d17e86881 100644
--- a/apps/user_ldap/composer/composer/autoload_static.php
+++ b/apps/user_ldap/composer/composer/autoload_static.php
@@ -38,6 +38,8 @@ class ComposerStaticInitUser_LDAP
'OCA\\User_LDAP\\ConnectionFactory' => __DIR__ . '/..' . '/../lib/ConnectionFactory.php',
'OCA\\User_LDAP\\Controller\\ConfigAPIController' => __DIR__ . '/..' . '/../lib/Controller/ConfigAPIController.php',
'OCA\\User_LDAP\\Controller\\RenewPasswordController' => __DIR__ . '/..' . '/../lib/Controller/RenewPasswordController.php',
+ 'OCA\\User_LDAP\\Events\\GroupBackendRegistered' => __DIR__ . '/..' . '/../lib/Events/GroupBackendRegistered.php',
+ 'OCA\\User_LDAP\\Events\\UserBackendRegistered' => __DIR__ . '/..' . '/../lib/Events/UserBackendRegistered.php',
'OCA\\User_LDAP\\Exceptions\\AttributeNotSet' => __DIR__ . '/..' . '/../lib/Exceptions/AttributeNotSet.php',
'OCA\\User_LDAP\\Exceptions\\ConstraintViolationException' => __DIR__ . '/..' . '/../lib/Exceptions/ConstraintViolationException.php',
'OCA\\User_LDAP\\Exceptions\\NotOnLDAP' => __DIR__ . '/..' . '/../lib/Exceptions/NotOnLDAP.php',
diff --git a/apps/user_ldap/lib/AppInfo/Application.php b/apps/user_ldap/lib/AppInfo/Application.php
index 7086bb08ee5..cb0fec69600 100644
--- a/apps/user_ldap/lib/AppInfo/Application.php
+++ b/apps/user_ldap/lib/AppInfo/Application.php
@@ -29,6 +29,8 @@ namespace OCA\User_LDAP\AppInfo;
use Closure;
use OCA\Files_External\Service\BackendService;
use OCA\User_LDAP\Controller\RenewPasswordController;
+use OCA\User_LDAP\Events\GroupBackendRegistered;
+use OCA\User_LDAP\Events\UserBackendRegistered;
use OCA\User_LDAP\Group_Proxy;
use OCA\User_LDAP\GroupPluginManager;
use OCA\User_LDAP\Handler\ExtStorageConfigHandler;
@@ -43,6 +45,7 @@ use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\AppFramework\IAppContainer;
+use OCP\EventDispatcher\IEventDispatcher;
use OCP\IConfig;
use OCP\IGroupManager;
use OCP\IL10N;
@@ -87,7 +90,8 @@ class Application extends App implements IBootstrap {
INotificationManager $notificationManager,
IUserSession $userSession,
IAppContainer $appContainer,
- EventDispatcherInterface $dispatcher,
+ EventDispatcherInterface $legacyDispatcher,
+ IEventDispatcher $dispatcher,
IGroupManager $groupManager) {
$helper = new Helper($config);
$configPrefixes = $helper->getServerConfigurationPrefixes(true);
@@ -103,13 +107,15 @@ class Application extends App implements IBootstrap {
$configPrefixes, $ldapWrapper, $config, $notificationManager, $userSession, $userPluginManager
);
$groupBackend = new Group_Proxy($configPrefixes, $ldapWrapper, $groupPluginManager);
- // register user backend
- \OC_User::useBackend($userBackend);
- // Hook to allow plugins to work on registered backends
- $dispatcher->dispatch('OCA\\User_LDAP\\User\\User::postLDAPBackendAdded');
+ \OC_User::useBackend($userBackend);
+ $userBackendRegisteredEvent = new UserBackendRegistered($userBackend, $userPluginManager);
+ $dispatcher->dispatchTyped($userBackendRegisteredEvent);
+ $legacyDispatcher->dispatch('OCA\\User_LDAP\\User\\User::postLDAPBackendAdded', $userBackendRegisteredEvent);
$groupManager->addBackend($groupBackend);
+ $groupBackendRegisteredEvent = new GroupBackendRegistered($groupBackend, $groupPluginManager);
+ $dispatcher->dispatchTyped($groupBackendRegisteredEvent);
}
});
diff --git a/apps/user_ldap/lib/Events/GroupBackendRegistered.php b/apps/user_ldap/lib/Events/GroupBackendRegistered.php
new file mode 100644
index 00000000000..f6c9959df98
--- /dev/null
+++ b/apps/user_ldap/lib/Events/GroupBackendRegistered.php
@@ -0,0 +1,51 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2020 Arthur Schiwon <blizzz@arthur-schiwon.de>
+ *
+ * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCA\User_LDAP\Events;
+
+use OCA\User_LDAP\GroupPluginManager;
+use OCA\User_LDAP\IGroupLDAP;
+use OCP\EventDispatcher\Event;
+
+class GroupBackendRegistered extends Event {
+
+ /** @var GroupPluginManager */
+ private $pluginManager;
+ /** @var IGroupLDAP */
+ private $backend;
+
+ public function __construct(IGroupLDAP $backend, GroupPluginManager $pluginManager) {
+ $this->pluginManager = $pluginManager;
+ $this->backend = $backend;
+ }
+
+ public function getBackend(): IGroupLDAP {
+ return $this->backend;
+ }
+
+ public function getPluginManager(): GroupPluginManager {
+ return $this->pluginManager;
+ }
+}
diff --git a/apps/user_ldap/lib/Events/UserBackendRegistered.php b/apps/user_ldap/lib/Events/UserBackendRegistered.php
new file mode 100644
index 00000000000..a80d2a323e9
--- /dev/null
+++ b/apps/user_ldap/lib/Events/UserBackendRegistered.php
@@ -0,0 +1,51 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2020 Arthur Schiwon <blizzz@arthur-schiwon.de>
+ *
+ * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCA\User_LDAP\Events;
+
+use OCA\User_LDAP\IUserLDAP;
+use OCA\User_LDAP\UserPluginManager;
+use OCP\EventDispatcher\Event;
+
+class UserBackendRegistered extends Event {
+
+ /** @var IUserLDAP */
+ private $backend;
+ /** @var UserPluginManager */
+ private $pluginManager;
+
+ public function __construct(IUserLDAP $backend, UserPluginManager $pluginManager) {
+ $this->backend = $backend;
+ $this->pluginManager = $pluginManager;
+ }
+
+ public function getBackend(): IUserLDAP {
+ return $this->backend;
+ }
+
+ public function getPluginManager(): UserPluginManager {
+ return $this->pluginManager;
+ }
+}