diff options
-rw-r--r-- | apps/user_ldap/tests/User_LDAPTest.php | 9 | ||||
-rw-r--r-- | lib/private/Encryption/Util.php | 7 | ||||
-rw-r--r-- | lib/private/Share/Share.php | 2 | ||||
-rw-r--r-- | lib/public/User.php | 12 |
4 files changed, 9 insertions, 21 deletions
diff --git a/apps/user_ldap/tests/User_LDAPTest.php b/apps/user_ldap/tests/User_LDAPTest.php index 2b5952c9742..5a165305d58 100644 --- a/apps/user_ldap/tests/User_LDAPTest.php +++ b/apps/user_ldap/tests/User_LDAPTest.php @@ -491,10 +491,9 @@ class User_LDAPTest extends TestCase { private function getUsers($search = '', $limit = null, $offset = null) { $users = \OC::$server->getUserManager()->search($search, $limit, $offset); - $uids = []; - foreach ($users as $user) { - $uids[] = $user->getUID(); - } + $uids = array_map(function(IUser $user) { + return $user->getUID(); + }, $users); return $uids; } @@ -1098,7 +1097,7 @@ class User_LDAPTest extends TestCase { $this->assertEquals('Roland Deschain', $result); //empty displayname retrieved - $result = \OC::$server->getUserManager()->get('newyorker')->getDisplayName(); + $result = \OC::$server->getUserManager()->get('newyorker') === null ? 'newyorker' : \OC::$server->getUserManager()->get('newyorker')->getDisplayName(); $this->assertEquals('newyorker', $result); } diff --git a/lib/private/Encryption/Util.php b/lib/private/Encryption/Util.php index 1f5a511c39b..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 { @@ -274,9 +275,9 @@ class Util { $result = []; if (in_array('all', $users)) { $users = $this->userManager->search('', null, null); - foreach ($users as $user) { - $result[] = $user->getUID(); - } + $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 4211d6c8fc2..9c82fcc268b 100644 --- a/lib/private/Share/Share.php +++ b/lib/private/Share/Share.php @@ -1252,7 +1252,7 @@ class Share extends Constants { } } if ( isset($row['uid_owner']) && $row['uid_owner'] != '') { - $ownerUser = \OC::$server->get($row['uid_owner']); + $ownerUser = \OC::$server->getUserManager()->get($row['uid_owner']); $row['displayname_owner'] = $ownerUser === null ? $row['uid_owner'] : $ownerUser->getDisplayName(); } diff --git a/lib/public/User.php b/lib/public/User.php index ba9039054be..a669a3a06fc 100644 --- a/lib/public/User.php +++ b/lib/public/User.php @@ -68,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 |