aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
authorChristoph Wurst <ChristophWurst@users.noreply.github.com>2019-12-11 12:02:32 +0100
committerGitHub <noreply@github.com>2019-12-11 12:02:32 +0100
commit917f1807fd29c07cb9450bff35ffea7002e1e580 (patch)
tree78618f602a642cec19cfcb97ed5ce556d77f7e69 /lib/public
parent7f71e67765183bc340c2d9308c662932404512a9 (diff)
parentd808f9c053fb80b0ec042f12e39f7387ca7821ca (diff)
downloadnextcloud-server-917f1807fd29c07cb9450bff35ffea7002e1e580.tar.gz
nextcloud-server-917f1807fd29c07cb9450bff35ffea7002e1e580.zip
Merge pull request #18348 from nextcloud/enhancement/typed-user-events-II
Add typed events for all user hooks and legacy events
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/User/Events/BeforePasswordUpdatedEvent.php82
-rw-r--r--lib/public/User/Events/BeforeUserCreatedEvent.php66
-rw-r--r--lib/public/User/Events/BeforeUserDeletedEvent.php54
-rw-r--r--lib/public/User/Events/BeforeUserLoggedInEvent.php66
-rw-r--r--lib/public/User/Events/BeforeUserLoggedInWithCookieEvent.php55
-rw-r--r--lib/public/User/Events/BeforeUserLoggedOutEvent.php55
-rw-r--r--lib/public/User/Events/PasswordUpdatedEvent.php82
-rw-r--r--lib/public/User/Events/UserChangedEvent.php93
-rw-r--r--lib/public/User/Events/UserDeletedEvent.php54
-rw-r--r--lib/public/User/Events/UserLoggedInEvent.php77
-rw-r--r--lib/public/User/Events/UserLoggedInWithCookieEvent.php66
-rw-r--r--lib/public/User/Events/UserLoggedOutEvent.php55
12 files changed, 805 insertions, 0 deletions
diff --git a/lib/public/User/Events/BeforePasswordUpdatedEvent.php b/lib/public/User/Events/BeforePasswordUpdatedEvent.php
new file mode 100644
index 00000000000..c40bd92b619
--- /dev/null
+++ b/lib/public/User/Events/BeforePasswordUpdatedEvent.php
@@ -0,0 +1,82 @@
+<?php declare(strict_types=1);
+
+/**
+ * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @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\User\Events;
+
+use OCP\EventDispatcher\Event;
+use OCP\IUser;
+
+/**
+ * @since 18.0.0
+ */
+class BeforePasswordUpdatedEvent extends Event {
+
+ /** @var IUser */
+ private $user;
+
+ /** @var string */
+ private $password;
+
+ /** @var string|null */
+ private $recoveryPassword;
+
+ /**
+ * @param IUser $user
+ * @param string $password
+ * @param string|null $recoveryPassword
+ * @since 18.0.0
+ */
+ public function __construct(IUser $user,
+ string $password,
+ string $recoveryPassword = null) {
+ parent::__construct();
+ $this->user = $user;
+ $this->password = $password;
+ $this->recoveryPassword = $recoveryPassword;
+ }
+
+ /**
+ * @return IUser
+ * @since 18.0.0
+ */
+ public function getUser(): IUser {
+ return $this->user;
+ }
+
+ /**
+ * @return string
+ * @since 18.0.0
+ */
+ public function getPassword(): string {
+ return $this->password;
+ }
+
+ /**
+ * @return string|null
+ * @since 18.0.0
+ */
+ public function getRecoveryPassword(): ?string {
+ return $this->recoveryPassword;
+ }
+
+}
diff --git a/lib/public/User/Events/BeforeUserCreatedEvent.php b/lib/public/User/Events/BeforeUserCreatedEvent.php
new file mode 100644
index 00000000000..1a00a167dbb
--- /dev/null
+++ b/lib/public/User/Events/BeforeUserCreatedEvent.php
@@ -0,0 +1,66 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @author Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @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\User\Events;
+
+use OCP\EventDispatcher\Event;
+
+/**
+ * @since 18.0.0
+ */
+class BeforeUserCreatedEvent extends Event {
+
+ /** @var string */
+ private $uid;
+
+ /** @var string */
+ private $password;
+
+ /**
+ * @since 18.0.0
+ */
+ public function __construct(string $uid,
+ string $password) {
+ parent::__construct();
+ $this->uid = $uid;
+ $this->password = $password;
+ }
+
+ /**
+ * @since 18.0.0
+ */
+ public function getUid(): string {
+ return $this->uid;
+ }
+
+ /**
+ * @since 18.0.0
+ */
+ public function getPassword(): string {
+ return $this->password;
+ }
+
+}
diff --git a/lib/public/User/Events/BeforeUserDeletedEvent.php b/lib/public/User/Events/BeforeUserDeletedEvent.php
new file mode 100644
index 00000000000..b40c498350f
--- /dev/null
+++ b/lib/public/User/Events/BeforeUserDeletedEvent.php
@@ -0,0 +1,54 @@
+<?php declare(strict_types=1);
+
+/**
+ * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @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\User\Events;
+
+use OCP\EventDispatcher\Event;
+use OCP\IUser;
+
+/**
+ * @since 18.0.0
+ */
+class BeforeUserDeletedEvent extends Event {
+
+ /** @var IUser */
+ private $user;
+
+ /**
+ * @param IUser $user
+ * @since 18.0.0
+ */
+ public function __construct(IUser $user) {
+ parent::__construct();
+ $this->user = $user;
+ }
+
+ /**
+ * @return IUser
+ * @since 18.0.0
+ */
+ public function getUser(): IUser {
+ return $this->user;
+ }
+
+}
diff --git a/lib/public/User/Events/BeforeUserLoggedInEvent.php b/lib/public/User/Events/BeforeUserLoggedInEvent.php
new file mode 100644
index 00000000000..8b819478737
--- /dev/null
+++ b/lib/public/User/Events/BeforeUserLoggedInEvent.php
@@ -0,0 +1,66 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * @copyright Copyright (c) 2019, 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\User\Events;
+
+use OCP\EventDispatcher\Event;
+use OCP\IUser;
+
+/**
+ * @since 18.0.0
+ */
+class BeforeUserLoggedInEvent extends Event {
+
+ /** @var IUser */
+ private $username;
+
+ /** @var string */
+ private $password;
+
+ /**
+ * @since 18.0.0
+ */
+ public function __construct(string $username, string $password) {
+ parent::__construct();
+ $this->username = $username;
+ $this->password = $password;
+ }
+
+ /**
+ * @since 18.0.0
+ */
+ public function getUsername(): IUser {
+ return $this->username;
+ }
+
+ /**
+ * @since 18.0.0
+ */
+ public function getPassword(): string {
+ return $this->password;
+ }
+
+}
diff --git a/lib/public/User/Events/BeforeUserLoggedInWithCookieEvent.php b/lib/public/User/Events/BeforeUserLoggedInWithCookieEvent.php
new file mode 100644
index 00000000000..35f9715516b
--- /dev/null
+++ b/lib/public/User/Events/BeforeUserLoggedInWithCookieEvent.php
@@ -0,0 +1,55 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * @copyright Copyright (c) 2019, 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\User\Events;
+
+use OCP\EventDispatcher\Event;
+use OCP\IUser;
+
+/**
+ * @since 18.0.0
+ */
+class BeforeUserLoggedInWithCookieEvent extends Event {
+
+ /** @var string */
+ private $username;
+
+ /**
+ * @since 18.0.0
+ */
+ public function __construct(string $username) {
+ parent::__construct();
+ $this->username = $username;
+ }
+
+ /**
+ * @since 18.0.0
+ */
+ public function getUsername(): string {
+ return $this->username;
+ }
+
+}
diff --git a/lib/public/User/Events/BeforeUserLoggedOutEvent.php b/lib/public/User/Events/BeforeUserLoggedOutEvent.php
new file mode 100644
index 00000000000..a5d617089f7
--- /dev/null
+++ b/lib/public/User/Events/BeforeUserLoggedOutEvent.php
@@ -0,0 +1,55 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * @copyright Copyright (c) 2019, 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\User\Events;
+
+use OCP\EventDispatcher\Event;
+use OCP\IUser;
+
+/**
+ * @since 18.0.0
+ */
+class BeforeUserLoggedOutEvent extends Event {
+
+ /** @var IUser|null */
+ private $user;
+
+ /**
+ * @since 18.0.0
+ */
+ public function __construct(IUser $user = null) {
+ parent::__construct();
+ $this->user = $user;
+ }
+
+ /**
+ * @since 18.0.0
+ */
+ public function getUser(): ?IUser {
+ return $this->user;
+ }
+
+}
diff --git a/lib/public/User/Events/PasswordUpdatedEvent.php b/lib/public/User/Events/PasswordUpdatedEvent.php
new file mode 100644
index 00000000000..83b5b0a7bfd
--- /dev/null
+++ b/lib/public/User/Events/PasswordUpdatedEvent.php
@@ -0,0 +1,82 @@
+<?php declare(strict_types=1);
+
+/**
+ * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @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\User\Events;
+
+use OCP\EventDispatcher\Event;
+use OCP\IUser;
+
+/**
+ * @since 18.0.0
+ */
+class PasswordUpdatedEvent extends Event {
+
+ /** @var IUser */
+ private $user;
+
+ /** @var string */
+ private $password;
+
+ /** @var string|null */
+ private $recoveryPassword;
+
+ /**
+ * @param IUser $user
+ * @param string $password
+ * @param string|null $recoveryPassword
+ * @since 18.0.0
+ */
+ public function __construct(IUser $user,
+ string $password,
+ string $recoveryPassword = null) {
+ parent::__construct();
+ $this->user = $user;
+ $this->password = $password;
+ $this->recoveryPassword = $recoveryPassword;
+ }
+
+ /**
+ * @return IUser
+ * @since 18.0.0
+ */
+ public function getUser(): IUser {
+ return $this->user;
+ }
+
+ /**
+ * @return string
+ * @since 18.0.0
+ */
+ public function getPassword(): string {
+ return $this->password;
+ }
+
+ /**
+ * @return string|null
+ * @since 18.0.0
+ */
+ public function getRecoveryPassword(): ?string {
+ return $this->recoveryPassword;
+ }
+
+}
diff --git a/lib/public/User/Events/UserChangedEvent.php b/lib/public/User/Events/UserChangedEvent.php
new file mode 100644
index 00000000000..86b2f439bfb
--- /dev/null
+++ b/lib/public/User/Events/UserChangedEvent.php
@@ -0,0 +1,93 @@
+<?php declare(strict_types=1);
+
+/**
+ * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @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\User\Events;
+
+use OCP\EventDispatcher\Event;
+use OCP\IUser;
+
+/**
+ * @since 18.0.0
+ */
+class UserChangedEvent extends Event {
+
+ /** @var IUser */
+ private $user;
+
+ /** @var string */
+ private $feature;
+
+ /** @var mixed */
+ private $value;
+
+ /** @var mixed */
+ private $oldValue;
+
+ /**
+ * @since 18.0.0
+ */
+ public function __construct(IUser $user,
+ string $feature,
+ $value,
+ $oldValue = null) {
+ parent::__construct();
+ $this->user = $user;
+ $this->feature = $feature;
+ $this->value = $value;
+ $this->oldValue = $oldValue;
+ }
+
+ /**
+ * @return IUser
+ * @since 18.0.0
+ */
+ public function getUser(): IUser {
+ return $this->user;
+ }
+
+ /**
+ * @return string
+ * @since 18.0.0
+ */
+ public function getFeature(): string {
+ return $this->feature;
+ }
+
+ /**
+ * @return mixed
+ * @since 18.0.0
+ */
+ public function getValue() {
+ return $this->value;
+ }
+
+ /**
+ * @return mixed
+ * @since 18.0.0
+ */
+ public function getOldValue() {
+ return $this->oldValue;
+ }
+
+
+}
diff --git a/lib/public/User/Events/UserDeletedEvent.php b/lib/public/User/Events/UserDeletedEvent.php
new file mode 100644
index 00000000000..284ee35a242
--- /dev/null
+++ b/lib/public/User/Events/UserDeletedEvent.php
@@ -0,0 +1,54 @@
+<?php declare(strict_types=1);
+
+/**
+ * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @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\User\Events;
+
+use OCP\EventDispatcher\Event;
+use OCP\IUser;
+
+/**
+ * @since 18.0.0
+ */
+class UserDeletedEvent extends Event {
+
+ /** @var IUser */
+ private $user;
+
+ /**
+ * @param IUser $user
+ * @since 18.0.0
+ */
+ public function __construct(IUser $user) {
+ parent::__construct();
+ $this->user = $user;
+ }
+
+ /**
+ * @return IUser
+ * @since 18.0.0
+ */
+ public function getUser(): IUser {
+ return $this->user;
+ }
+
+}
diff --git a/lib/public/User/Events/UserLoggedInEvent.php b/lib/public/User/Events/UserLoggedInEvent.php
new file mode 100644
index 00000000000..8ce83f42308
--- /dev/null
+++ b/lib/public/User/Events/UserLoggedInEvent.php
@@ -0,0 +1,77 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * @copyright Copyright (c) 2019, Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @author Christoph Wurst <christoph@winzerhof-wurst.at>
+ * @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\User\Events;
+
+use OCP\EventDispatcher\Event;
+use OCP\IUser;
+
+/**
+ * @since 18.0.0
+ */
+class UserLoggedInEvent extends Event {
+
+ /** @var IUser */
+ private $user;
+
+ /** @var string */
+ private $password;
+
+ /** @var bool */
+ private $isTokenLogin;
+
+ /**
+ * @since 18.0.0
+ */
+ public function __construct(IUser $user, string $password, bool $isTokenLogin) {
+ parent::__construct();
+ $this->user = $user;
+ $this->password = $password;
+ $this->isTokenLogin = $isTokenLogin;
+ }
+
+ /**
+ * @since 18.0.0
+ */
+ public function getUser(): IUser {
+ return $this->user;
+ }
+
+ /**
+ * @since 18.0.0
+ */
+ public function getPassword(): string {
+ return $this->password;
+ }
+
+ /**
+ * @since 18.0.0
+ */
+ public function isTokenLogin(): bool {
+ return $this->isTokenLogin;
+ }
+}
diff --git a/lib/public/User/Events/UserLoggedInWithCookieEvent.php b/lib/public/User/Events/UserLoggedInWithCookieEvent.php
new file mode 100644
index 00000000000..c9848e1cc7d
--- /dev/null
+++ b/lib/public/User/Events/UserLoggedInWithCookieEvent.php
@@ -0,0 +1,66 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * @copyright Copyright (c) 2019, 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\User\Events;
+
+use OCP\EventDispatcher\Event;
+use OCP\IUser;
+
+/**
+ * @since 18.0.0
+ */
+class UserLoggedInWithCookieEvent extends Event {
+
+ /** @var IUser */
+ private $user;
+
+ /** @var string|null */
+ private $password;
+
+ /**
+ * @since 18.0.0
+ */
+ public function __construct(IUser $user, ?string $password) {
+ parent::__construct();
+ $this->user = $user;
+ $this->password = $password;
+ }
+
+ /**
+ * @since 18.0.0
+ */
+ public function getUser(): IUser {
+ return $this->user;
+ }
+
+ /**
+ * @since 18.0.0
+ */
+ public function getPassword(): ?string {
+ return $this->password;
+ }
+
+}
diff --git a/lib/public/User/Events/UserLoggedOutEvent.php b/lib/public/User/Events/UserLoggedOutEvent.php
new file mode 100644
index 00000000000..14259149533
--- /dev/null
+++ b/lib/public/User/Events/UserLoggedOutEvent.php
@@ -0,0 +1,55 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * @copyright Copyright (c) 2019, 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\User\Events;
+
+use OCP\EventDispatcher\Event;
+use OCP\IUser;
+
+/**
+ * @since 18.0.0
+ */
+class UserLoggedOutEvent extends Event {
+
+ /** @var IUser|null */
+ private $user;
+
+ /**
+ * @since 18.0.0
+ */
+ public function __construct(IUser $user = null) {
+ parent::__construct();
+ $this->user = $user;
+ }
+
+ /**
+ * @since 18.0.0
+ */
+ public function getUser(): ?IUser {
+ return $this->user;
+ }
+
+}