diff options
author | Roeland Jago Douma <rullzer@owncloud.com> | 2015-12-17 13:03:37 +0100 |
---|---|---|
committer | Roeland Jago Douma <rullzer@owncloud.com> | 2015-12-17 16:18:34 +0100 |
commit | 7e44ea5da068bae204715e545b95c4852ad6283c (patch) | |
tree | cb69da44fbd42bfeae6a50d8bb46c9b5eddf9fda /lib/private/user.php | |
parent | d402ac91d70ead3e2824c2630904a9add51249e3 (diff) | |
download | nextcloud-server-7e44ea5da068bae204715e545b95c4852ad6283c.tar.gz nextcloud-server-7e44ea5da068bae204715e545b95c4852ad6283c.zip |
Remove deprecated function OC_User::getManager
Private deprecated function => removed
Replaced all instances with suggested replacement
Diffstat (limited to 'lib/private/user.php')
-rw-r--r-- | lib/private/user.php | 50 |
1 files changed, 21 insertions, 29 deletions
diff --git a/lib/private/user.php b/lib/private/user.php index 74441d9175a..9094f388f9e 100644 --- a/lib/private/user.php +++ b/lib/private/user.php @@ -66,14 +66,6 @@ class OC_User { return OC::$server->getUserSession(); } - /** - * @return \OC\User\Manager - * @deprecated Use \OC::$server->getUserManager() - */ - public static function getManager() { - return OC::$server->getUserManager(); - } - private static $_backends = array(); private static $_usedBackends = array(); @@ -132,7 +124,7 @@ class OC_User { public static function useBackend($backend = 'database') { if ($backend instanceof OC_User_Interface) { self::$_usedBackends[get_class($backend)] = $backend; - self::getManager()->registerBackend($backend); + \OC::$server->getUserManager()->registerBackend($backend); } else { // You'll never know what happens if (null === $backend OR !is_string($backend)) { @@ -146,17 +138,17 @@ class OC_User { case 'sqlite': \OCP\Util::writeLog('core', 'Adding user backend ' . $backend . '.', \OCP\Util::DEBUG); self::$_usedBackends[$backend] = new OC_User_Database(); - self::getManager()->registerBackend(self::$_usedBackends[$backend]); + \OC::$server->getUserManager()->registerBackend(self::$_usedBackends[$backend]); break; case 'dummy': self::$_usedBackends[$backend] = new \Test\Util\User\Dummy(); - self::getManager()->registerBackend(self::$_usedBackends[$backend]); + \OC::$server->getUserManager()->registerBackend(self::$_usedBackends[$backend]); break; default: \OCP\Util::writeLog('core', 'Adding default user backend ' . $backend . '.', \OCP\Util::DEBUG); $className = 'OC_USER_' . strToUpper($backend); self::$_usedBackends[$backend] = new $className(); - self::getManager()->registerBackend(self::$_usedBackends[$backend]); + \OC::$server->getUserManager()->registerBackend(self::$_usedBackends[$backend]); break; } } @@ -168,7 +160,7 @@ class OC_User { */ public static function clearBackends() { self::$_usedBackends = array(); - self::getManager()->clearBackends(); + \OC::$server->getUserManager()->clearBackends(); } /** @@ -213,7 +205,7 @@ class OC_User { * @deprecated Use \OC::$server->getUserManager()->createUser($uid, $password) */ public static function createUser($uid, $password) { - return self::getManager()->createUser($uid, $password); + return \OC::$server->getUserManager()->createUser($uid, $password); } /** @@ -226,7 +218,7 @@ class OC_User { * @deprecated Use \OC::$server->getUserManager()->get() and then run delete() on the return */ public static function deleteUser($uid) { - $user = self::getManager()->get($uid); + $user = \OC::$server->getUserManager()->get($uid); if ($user) { return $user->delete(); } else { @@ -343,7 +335,7 @@ class OC_User { if (is_null($displayName)) { $displayName = $uid; } - $user = self::getManager()->get($uid); + $user = \OC::$server->getUserManager()->get($uid); if ($user) { return $user->setDisplayName($displayName); } else { @@ -452,7 +444,7 @@ class OC_User { */ public static function getDisplayName($uid = null) { if ($uid) { - $user = self::getManager()->get($uid); + $user = \OC::$server->getUserManager()->get($uid); if ($user) { return $user->getDisplayName(); } else { @@ -490,7 +482,7 @@ class OC_User { * Change the password of a user */ public static function setPassword($uid, $password, $recoveryPassword = null) { - $user = self::getManager()->get($uid); + $user = \OC::$server->getUserManager()->get($uid); if ($user) { return $user->setPassword($password, $recoveryPassword); } else { @@ -507,7 +499,7 @@ class OC_User { * Check whether a specified user can change his avatar */ public static function canUserChangeAvatar($uid) { - $user = self::getManager()->get($uid); + $user = \OC::$server->getUserManager()->get($uid); if ($user) { return $user->canChangeAvatar(); } else { @@ -524,7 +516,7 @@ class OC_User { * Check whether a specified user can change his password */ public static function canUserChangePassword($uid) { - $user = self::getManager()->get($uid); + $user = \OC::$server->getUserManager()->get($uid); if ($user) { return $user->canChangePassword(); } else { @@ -541,7 +533,7 @@ class OC_User { * Check whether a specified user can change his display name */ public static function canUserChangeDisplayName($uid) { - $user = self::getManager()->get($uid); + $user = \OC::$server->getUserManager()->get($uid); if ($user) { return $user->canChangeDisplayName(); } else { @@ -560,7 +552,7 @@ class OC_User { * returns the user id or false */ public static function checkPassword($uid, $password) { - $manager = self::getManager(); + $manager = \OC::$server->getUserManager(); $username = $manager->checkPassword($uid, $password); if ($username !== false) { return $username->getUID(); @@ -576,7 +568,7 @@ class OC_User { * @deprecated Use \OC::$server->getUserManager->getHome() */ public static function getHome($uid) { - $user = self::getManager()->get($uid); + $user = \OC::$server->getUserManager()->get($uid); if ($user) { return $user->getHome(); } else { @@ -595,7 +587,7 @@ class OC_User { * @param integer $offset */ public static function getUsers($search = '', $limit = null, $offset = null) { - $users = self::getManager()->search($search, $limit, $offset); + $users = \OC::$server->getUserManager()->search($search, $limit, $offset); $uids = array(); foreach ($users as $user) { $uids[] = $user->getUID(); @@ -616,7 +608,7 @@ class OC_User { */ public static function getDisplayNames($search = '', $limit = null, $offset = null) { $displayNames = array(); - $users = self::getManager()->searchDisplayName($search, $limit, $offset); + $users = \OC::$server->getUserManager()->searchDisplayName($search, $limit, $offset); foreach ($users as $user) { $displayNames[$user->getUID()] = $user->getDisplayName(); } @@ -630,7 +622,7 @@ class OC_User { * @return boolean */ public static function userExists($uid) { - return self::getManager()->userExists($uid); + return \OC::$server->getUserManager()->userExists($uid); } /** @@ -639,7 +631,7 @@ class OC_User { * @param string $uid the user to disable */ public static function disableUser($uid) { - $user = self::getManager()->get($uid); + $user = \OC::$server->getUserManager()->get($uid); if ($user) { $user->setEnabled(false); } @@ -651,7 +643,7 @@ class OC_User { * @param string $uid */ public static function enableUser($uid) { - $user = self::getManager()->get($uid); + $user = \OC::$server->getUserManager()->get($uid); if ($user) { $user->setEnabled(true); } @@ -664,7 +656,7 @@ class OC_User { * @return bool */ public static function isEnabled($uid) { - $user = self::getManager()->get($uid); + $user = \OC::$server->getUserManager()->get($uid); if ($user) { return $user->isEnabled(); } else { |