summaryrefslogtreecommitdiffstats
path: root/lib/user.php
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2013-09-20 12:45:56 +0200
committerBart Visscher <bartv@thisnet.nl>2013-09-20 14:32:43 +0200
commitac73ce1b2a9cbcafce29d9f6be768b0629f68ddb (patch)
tree4195b9010cbfa9b01fa71001c8df8a75ec77ebbb /lib/user.php
parent69c28400b47a3a16ead6fc0d5ee5e2212d0d8ab0 (diff)
downloadnextcloud-server-ac73ce1b2a9cbcafce29d9f6be768b0629f68ddb.tar.gz
nextcloud-server-ac73ce1b2a9cbcafce29d9f6be768b0629f68ddb.zip
Add UserSession to server container
Diffstat (limited to 'lib/user.php')
-rw-r--r--lib/user.php43
1 files changed, 2 insertions, 41 deletions
diff --git a/lib/user.php b/lib/user.php
index 0f6f40aec9a..7f6a296c3ea 100644
--- a/lib/user.php
+++ b/lib/user.php
@@ -37,54 +37,15 @@
* logout()
*/
class OC_User {
- public static $userSession = null;
-
public static function getUserSession() {
- if (!self::$userSession) {
- $manager = new \OC\User\Manager();
- self::$userSession = new \OC\User\Session($manager, \OC::$session);
- self::$userSession->listen('\OC\User', 'preCreateUser', function ($uid, $password) {
- \OC_Hook::emit('OC_User', 'pre_createUser', array('run' => true, 'uid' => $uid, 'password' => $password));
- });
- self::$userSession->listen('\OC\User', 'postCreateUser', function ($user, $password) {
- /** @var $user \OC\User\User */
- \OC_Hook::emit('OC_User', 'post_createUser', array('uid' => $user->getUID(), 'password' => $password));
- });
- self::$userSession->listen('\OC\User', 'preDelete', function ($user) {
- /** @var $user \OC\User\User */
- \OC_Hook::emit('OC_User', 'pre_deleteUser', array('run' => true, 'uid' => $user->getUID()));
- });
- self::$userSession->listen('\OC\User', 'postDelete', function ($user) {
- /** @var $user \OC\User\User */
- \OC_Hook::emit('OC_User', 'post_deleteUser', array('uid' => $user->getUID()));
- });
- self::$userSession->listen('\OC\User', 'preSetPassword', function ($user, $password, $recoveryPassword) {
- /** @var $user \OC\User\User */
- OC_Hook::emit('OC_User', 'pre_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword));
- });
- self::$userSession->listen('\OC\User', 'postSetPassword', function ($user, $password, $recoveryPassword) {
- /** @var $user \OC\User\User */
- OC_Hook::emit('OC_User', 'post_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword));
- });
- self::$userSession->listen('\OC\User', 'preLogin', function ($uid, $password) {
- \OC_Hook::emit('OC_User', 'pre_login', array('run' => true, 'uid' => $uid, 'password' => $password));
- });
- self::$userSession->listen('\OC\User', 'postLogin', function ($user, $password) {
- /** @var $user \OC\User\User */
- \OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password));
- });
- self::$userSession->listen('\OC\User', 'logout', function () {
- \OC_Hook::emit('OC_User', 'logout', array());
- });
- }
- return self::$userSession;
+ return OC::$server->getUserSession();
}
/**
* @return \OC\User\Manager
*/
public static function getManager() {
- return self::getUserSession()->getManager();
+ return OC::$server->getUserManager();
}
private static $_backends = array();