diff --git a/RELEASE-NOTES-1.38 b/RELEASE-NOTES-1.38 index f457e950353..27012440e25 100644 --- a/RELEASE-NOTES-1.38 +++ b/RELEASE-NOTES-1.38 @@ -202,13 +202,14 @@ because of Phabricator reports. ::getRawUser and ::getRawDescription, deprecated since 1.37, has been removed. * ShellboxHttpClient class has been removed without deprecation. It was an internal class used by ShellboxClientFactory. -* The following User methods, deprecated in 1.37, have been removed: +* The following hard deprecated User methods have been removed: - ::resetIdByNameCache, - ::getStubThreshold, - ::matchEditTokenNoSuffix, - ::changeableByGroup, - ::changeableGroups, - - ::isAllowUsertalk + - ::isAllowUsertalk, + - ::getRights * Http::$httpEngine, deprecated since 1.34, has been removed. The only available HTTP engine is now Guzzle. CurlHttpRequest and PhpHttpRequest classes were removed. diff --git a/includes/user/User.php b/includes/user/User.php index ef5e68e11b7..c7ed24b5f39 100644 --- a/includes/user/User.php +++ b/includes/user/User.php @@ -2788,20 +2788,6 @@ class User implements Authority, UserIdentity, UserEmailContact { ->getBoolOption( $this, 'prefershttps' ); } - /** - * Get the permissions this user has. - * @return string[] permission names - * - * @deprecated since 1.34, hard deprecated since 1.37 - * Use MediaWikiServices::getInstance()->getPermissionManager() - * ->getUserPermissions(..) instead - * - */ - public function getRights() { - wfDeprecated( __METHOD__, '1.34' ); - return MediaWikiServices::getInstance()->getPermissionManager()->getUserPermissions( $this ); - } - /** * Get the list of explicit group memberships this user has. * The implicit * and user groups are not included. diff --git a/tests/phpunit/includes/user/UserTest.php b/tests/phpunit/includes/user/UserTest.php index 6e7e2f7ed0d..d3d3e698c98 100644 --- a/tests/phpunit/includes/user/UserTest.php +++ b/tests/phpunit/includes/user/UserTest.php @@ -128,70 +128,6 @@ class UserTest extends MediaWikiIntegrationTestCase { $this->assertNotContains( 'nukeworld', $rights ); } - /** - * TODO: Remove. This is the same as PermissionManagerTest::testGetUserPermissions - * @covers User::getRights - */ - public function testUserPermissions() { - $this->hideDeprecated( 'User::getRights' ); - $rights = $this->user->getRights(); - $this->assertContains( 'runtest', $rights ); - $this->assertNotContains( 'writetest', $rights ); - $this->assertNotContains( 'modifytest', $rights ); - $this->assertNotContains( 'nukeworld', $rights ); - } - - /** - * TODO: Remove. This is the same as PermissionManagerTest::testGetUserPermissionsHooks - * @covers User::getRights - */ - public function testUserGetRightsHooks() { - $this->hideDeprecated( 'User::getRights' ); - $user = $this->getTestUser( [ 'unittesters', 'testwriters' ] )->getUser(); - $userWrapper = TestingAccessWrapper::newFromObject( $user ); - - $rights = $user->getRights(); - $this->assertContains( 'test', $rights, 'sanity check' ); - $this->assertContains( 'runtest', $rights, 'sanity check' ); - $this->assertContains( 'writetest', $rights, 'sanity check' ); - $this->assertNotContains( 'nukeworld', $rights, 'sanity check' ); - - // Add a hook manipulating the rights - $this->setTemporaryHook( 'UserGetRights', static function ( $user, &$rights ) { - $rights[] = 'nukeworld'; - $rights = array_diff( $rights, [ 'writetest' ] ); - } ); - - MediaWikiServices::getInstance()->getPermissionManager()->invalidateUsersRightsCache( $user ); - $rights = $user->getRights(); - $this->assertContains( 'test', $rights ); - $this->assertContains( 'runtest', $rights ); - $this->assertNotContains( 'writetest', $rights ); - $this->assertContains( 'nukeworld', $rights ); - - // Add a Session that limits rights - $mock = $this->getMockBuilder( stdClass::class ) - ->addMethods( [ 'getAllowedUserRights', 'deregisterSession', 'getSessionId' ] ) - ->getMock(); - $mock->method( 'getAllowedUserRights' )->willReturn( [ 'test', 'writetest' ] ); - $mock->method( 'getSessionId' )->willReturn( - new MediaWiki\Session\SessionId( str_repeat( 'X', 32 ) ) - ); - $session = MediaWiki\Session\TestUtils::getDummySession( $mock ); - $mockRequest = $this->getMockBuilder( FauxRequest::class ) - ->onlyMethods( [ 'getSession' ] ) - ->getMock(); - $mockRequest->method( 'getSession' )->willReturn( $session ); - $userWrapper->mRequest = $mockRequest; - - $this->resetServices(); - $rights = $user->getRights(); - $this->assertContains( 'test', $rights ); - $this->assertNotContains( 'runtest', $rights ); - $this->assertNotContains( 'writetest', $rights ); - $this->assertNotContains( 'nukeworld', $rights ); - } - /** * @dataProvider provideGetGroupsWithPermission * @covers User::getGroupsWithPermission