diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2018-03-28 08:23:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-28 08:23:57 +0200 |
commit | b2e34167eb3fa3e6fdfa4ec13353a901e0725ebd (patch) | |
tree | 88a923842ad876ab180950e70eb8641e540bcdea /lib | |
parent | 1e13b3a8faacdd5d1a90573d12aca8fca5b5d7ae (diff) | |
parent | 74f0e3723327fbfb1cd7a96865019ff791b41593 (diff) | |
download | nextcloud-server-b2e34167eb3fa3e6fdfa4ec13353a901e0725ebd.tar.gz nextcloud-server-b2e34167eb3fa3e6fdfa4ec13353a901e0725ebd.zip |
Merge pull request #8976 from nextcloud/dep_user_code
Remove deprecated functions from OCP\User
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Encryption/Util.php | 8 | ||||
-rw-r--r-- | lib/private/Share/Share.php | 6 | ||||
-rw-r--r-- | lib/private/legacy/user.php | 21 | ||||
-rw-r--r-- | lib/public/User.php | 37 |
4 files changed, 12 insertions, 60 deletions
diff --git a/lib/private/Encryption/Util.php b/lib/private/Encryption/Util.php index fc0adbbd47b..ddd19ac6345 100644 --- a/lib/private/Encryption/Util.php +++ b/lib/private/Encryption/Util.php @@ -35,6 +35,7 @@ use OC\Files\Filesystem; use OC\Files\View; use OCP\Encryption\IEncryptionModule; use OCP\IConfig; +use OCP\IUser; class Util { @@ -271,9 +272,12 @@ class Util { } public function getUserWithAccessToMountPoint($users, $groups) { - $result = array(); + $result = []; if (in_array('all', $users)) { - $result = \OCP\User::getUsers(); + $users = $this->userManager->search('', null, null); + $result = array_map(function(IUser $user) { + return $user->getUID(); + }, $users); } else { $result = array_merge($result, $users); diff --git a/lib/private/Share/Share.php b/lib/private/Share/Share.php index 90a05ac51a8..9c82fcc268b 100644 --- a/lib/private/Share/Share.php +++ b/lib/private/Share/Share.php @@ -1238,7 +1238,8 @@ class Share extends Constants { $row['share_with_displayname'] = $row['share_with']; if ( isset($row['share_with']) && $row['share_with'] != '' && $row['share_type'] === self::SHARE_TYPE_USER) { - $row['share_with_displayname'] = \OCP\User::getDisplayName($row['share_with']); + $shareWithUser = \OC::$server->getUserManager()->get($row['share_with']); + $row['share_with_displayname'] = $shareWithUser === null ? $row['share_with'] : $shareWithUser->getDisplayName(); } else if(isset($row['share_with']) && $row['share_with'] != '' && $row['share_type'] === self::SHARE_TYPE_REMOTE) { $addressBookEntries = \OC::$server->getContactsManager()->search($row['share_with'], ['CLOUD']); @@ -1251,7 +1252,8 @@ class Share extends Constants { } } if ( isset($row['uid_owner']) && $row['uid_owner'] != '') { - $row['displayname_owner'] = \OCP\User::getDisplayName($row['uid_owner']); + $ownerUser = \OC::$server->getUserManager()->get($row['uid_owner']); + $row['displayname_owner'] = $ownerUser === null ? $row['uid_owner'] : $ownerUser->getDisplayName(); } if ($row['permissions'] > 0) { diff --git a/lib/private/legacy/user.php b/lib/private/legacy/user.php index 8f342281adb..9c877f22a46 100644 --- a/lib/private/legacy/user.php +++ b/lib/private/legacy/user.php @@ -312,6 +312,8 @@ class OC_User { * * @param string $uid * @return string|bool uid or false + * @deprecated 8.1.0 fetch \OCP\IUser (has getDisplayName()) by using method + * get() of \OCP\IUserManager - \OC::$server->getUserManager() */ public static function getDisplayName($uid = null) { if ($uid) { @@ -367,25 +369,6 @@ class OC_User { } /** - * Get a list of all users - * - * @return array an array of all uids - * - * Get a list of all users. - * @param string $search - * @param integer $limit - * @param integer $offset - */ - public static function getUsers($search = '', $limit = null, $offset = null) { - $users = \OC::$server->getUserManager()->search($search, $limit, $offset); - $uids = array(); - foreach ($users as $user) { - $uids[] = $user->getUID(); - } - return $uids; - } - - /** * Get a list of all users display name * * @param string $search diff --git a/lib/public/User.php b/lib/public/User.php index 14fdd6fb1ab..a669a3a06fc 100644 --- a/lib/public/User.php +++ b/lib/public/User.php @@ -58,31 +58,6 @@ class User { } /** - * Get a list of all users - * @param string $search search pattern - * @param int|null $limit - * @param int|null $offset - * @return array an array of all uids - * @deprecated 8.1.0 use method search() of \OCP\IUserManager - \OC::$server->getUserManager() - * @since 5.0.0 - */ - public static function getUsers( $search = '', $limit = null, $offset = null ) { - return \OC_User::getUsers( $search, $limit, $offset ); - } - - /** - * Get the user display name of the user currently logged in. - * @param string|null $user user id or null for current user - * @return string display name - * @deprecated 8.1.0 fetch \OCP\IUser (has getDisplayName()) by using method - * get() of \OCP\IUserManager - \OC::$server->getUserManager() - * @since 5.0.0 - */ - public static function getDisplayName( $user = null ) { - return \OC_User::getDisplayName( $user ); - } - - /** * Check if the user is logged in * @return boolean * @since 5.0.0 @@ -93,18 +68,6 @@ class User { } /** - * Check if a user exists - * @param string $uid the username - * @param string $excludingBackend (default none) - * @return boolean - * @deprecated 8.1.0 use method userExists() of \OCP\IUserManager - \OC::$server->getUserManager() - * @since 5.0.0 - */ - public static function userExists($uid, $excludingBackend = null) { - return \OC::$server->getUserManager()->userExists($uid); - } - - /** * Check if the user is a admin, redirects to home if not * @since 5.0.0 * @deprecated 13.0.0 Use annotation based ACLs from the AppFramework instead |