Introduce PermissionManager service
authorVedmaka <god.vedmaka@gmail.com>
Thu, 7 Mar 2019 20:02:07 +0000 (23:02 +0300)
committerDaniel Kinzler <dkinzler@wikimedia.org>
Fri, 5 Apr 2019 14:54:51 +0000 (14:54 +0000)
commit8e1342ed470a08d6658e2483976dfdc8f4388ea5
treea9dd9f569420704eb79df96cdda81174a4cb8157
parent2d721e69e885fb7ee6afbe9bd87d30972a00efd3
Introduce PermissionManager service

First iteration of adding a PermissionManager service as a replacement
for Title::userCan and User::isBlockedFrom methods.

- Created PermissionManager service
- Migrated Title::userCan to PermissionManager::userCan and deprecated the first
- Migrated Title::quickUserCan to PermissionManager::quickUserCan and deprecated the first
- Migrated User::isBlockedFrom to PermissionManager::isBlockedFrom and deprecated the first

Same for User::isBlockedFrom and PermissionManager::isBlockedFrom - the
$user parameter is now required so the declaration is changed from
isBlockedFrom( $title, ... ) to isBlockedFrom( $user, $title, .. ) which
means before User::isBlockedFrom removal all calls to it need to be updated.

Added PermissionManagerTest, it copies TitlePermissionTest but uses
PermissionManager instance instead of Title methods, this way keeping both tests
in place, we can ensure that nothing was broken and both are in working state
during the deprecation phase.

Bug: T208768
Change-Id: I94479b44afb3068695f8e327b46bda38e44e691f
includes/AutoLoader.php
includes/MediaWikiServices.php
includes/Permissions/PermissionManager.php [new file with mode: 0644]
includes/ServiceWiring.php
includes/Title.php
includes/user/User.php
tests/phpunit/includes/Permissions/PermissionManagerTest.php [new file with mode: 0644]
tests/phpunit/includes/TitlePermissionTest.php
tests/phpunit/includes/TitleTest.php