summaryrefslogtreecommitdiffstats
path: root/lib/private/Server.php
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2017-09-27 12:53:56 +0200
committerRobin Appelman <robin@icewind.nl>2017-12-11 16:05:38 +0100
commit949fc50cc5c2927c08c35ab7e0987ceceb708013 (patch)
tree6916bfb0cd04d6fdefe2c73b5b37199280bb8926 /lib/private/Server.php
parent5bc8c94a117e5d0a0468ba242ccb0b56d486c080 (diff)
downloadnextcloud-server-949fc50cc5c2927c08c35ab7e0987ceceb708013.tar.gz
nextcloud-server-949fc50cc5c2927c08c35ab7e0987ceceb708013.zip
Dispatch event on User predelete
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/private/Server.php')
-rw-r--r--lib/private/Server.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/private/Server.php b/lib/private/Server.php
index f4f7cb75ad1..0886dfd4413 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -133,6 +133,7 @@ use OCP\Share;
use OCP\Share\IShareHelper;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
+use Symfony\Component\EventDispatcher\GenericEvent;
/**
* Class Server
@@ -348,6 +349,8 @@ class Server extends ServerContainer implements IServerContainer {
$defaultTokenProvider = null;
}
+ $dispatcher = $c->getEventDispatcher();
+
$userSession = new \OC\User\Session($manager, $session, $timeFactory, $defaultTokenProvider, $c->getConfig(), $c->getSecureRandom(), $c->getLockdownManager());
$userSession->listen('\OC\User', 'preCreateUser', function ($uid, $password) {
\OC_Hook::emit('OC_User', 'pre_createUser', array('run' => true, 'uid' => $uid, 'password' => $password));
@@ -356,9 +359,10 @@ class Server extends ServerContainer implements IServerContainer {
/** @var $user \OC\User\User */
\OC_Hook::emit('OC_User', 'post_createUser', array('uid' => $user->getUID(), 'password' => $password));
});
- $userSession->listen('\OC\User', 'preDelete', function ($user) {
+ $userSession->listen('\OC\User', 'preDelete', function ($user) use ($dispatcher) {
/** @var $user \OC\User\User */
\OC_Hook::emit('OC_User', 'pre_deleteUser', array('run' => true, 'uid' => $user->getUID()));
+ $dispatcher->dispatch('OCP\IUser::preDelete', new GenericEvent($user));
});
$userSession->listen('\OC\User', 'postDelete', function ($user) {
/** @var $user \OC\User\User */