diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2018-09-29 19:03:07 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2018-10-01 15:35:24 +0200 |
commit | a95154642dd6535ebddebef4e6562e777f2094a4 (patch) | |
tree | 7c530641b279eef97c6a28538867a5b8cf5379d9 /lib/public | |
parent | 66970f4c179c480b2f473dd0f17df1b51f4147a2 (diff) | |
download | nextcloud-server-a95154642dd6535ebddebef4e6562e777f2094a4.tar.gz nextcloud-server-a95154642dd6535ebddebef4e6562e777f2094a4.zip |
Emit event on enablign or disabling of 2FA provider
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/Authentication/TwoFactorAuth/IRegistry.php | 4 | ||||
-rw-r--r-- | lib/public/Authentication/TwoFactorAuth/RegistryEvent.php | 62 |
2 files changed, 66 insertions, 0 deletions
diff --git a/lib/public/Authentication/TwoFactorAuth/IRegistry.php b/lib/public/Authentication/TwoFactorAuth/IRegistry.php index 5d97c57bcf2..c033ad91245 100644 --- a/lib/public/Authentication/TwoFactorAuth/IRegistry.php +++ b/lib/public/Authentication/TwoFactorAuth/IRegistry.php @@ -39,6 +39,10 @@ use OCP\IUser; */ interface IRegistry { + + const EVENT_PROVIDER_ENABLED = self::class . '::enable'; + const EVENT_PROVIDER_DISABLED = self::class . '::disable'; + /** * Get a key-value map of providers and their enabled/disabled state for * the given user. diff --git a/lib/public/Authentication/TwoFactorAuth/RegistryEvent.php b/lib/public/Authentication/TwoFactorAuth/RegistryEvent.php new file mode 100644 index 00000000000..9a005c9cd5d --- /dev/null +++ b/lib/public/Authentication/TwoFactorAuth/RegistryEvent.php @@ -0,0 +1,62 @@ +<?php +declare(strict_types=1); +/** + * @copyright Copyright (c) 2018, Roeland Jago Douma <roeland@famdouma.nl> + * + * @author Roeland Jago Douma <roeland@famdouma.nl> + * + * @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 OCP\Authentication\TwoFactorAuth; + +use OCP\IUser; +use Symfony\Component\EventDispatcher\Event; + +/** + * @since 15.0.0 + */ +class RegistryEvent extends Event { + + /** @var IProvider */ + private $provider; + + /** @IUser */ + private $user; + + /** + * @since 15.0.0 + */ + public function __construct(IProvider $provider, IUser $user) { + $this->provider = $provider; + $this->user = $user; + } + + /** + * @since 15.0.0 + */ + public function getProvider(): IProvider { + return $this->provider; + } + + /** + * @since 15.0.0 + */ + public function getUser(): IUser { + return $this->user; + } +} |