wiki.techinc.nl/tests/phpunit/includes/api
Thalia c67f181dd4 Introduce infrastructure for partial blocks for actions
This adds a new type of block restriction for actions, which extends
AbstractRestriction. Like page and namespace restrictions, action
restrictions are stored in the ipblocks_restrictions table.

Blockable actions are defined in a BlockActionInfo service, with a
method for getting all the blockable actions, getAllBlockActions.

Action blocks are checked for in PermissionManager::checkUserBlock
using DatabaseBlock::appliesToRight. To make this work, this patch
also removes the 'edit' case from AbstractBlock::appliesToRight,
which always returned true. This was incorrect, as blocks do not
always apply to edit, so cases that called appliesToRight('edit')
were fixed before this commit. appliesToRight('edit') now returns
null (i.e. unsure), which is correct because it is not possible to
determine whether a block applies to editing a particular page
without knowing what that page is, and appliesToRight doesn't know
that page.

There are some flags on sitewide blocks that predate partial blocks,
which block particular actions: 'createaccount' and 'sendemail'.
These are still handled in AbstractBlock::appliesToRight, and are
still checked for separately in the peripheral components.

The feature flag $wgEnablePartialActionBlocks must set to true to
enable partial action blocks.

Bug: T279556
Bug: T6995
Change-Id: I17962bb7c4247a12c722e7bc6bcaf8c36efd8600
2021-04-27 21:53:13 +01:00
..
format phpunit: Mass-replace setMethods with onlyMethods and adjust 2021-04-16 20:15:00 +02:00
query Introduce infrastructure for partial blocks for actions 2021-04-27 21:53:13 +01:00
Validator phpunit: Mass-replace setMethods with onlyMethods and adjust 2021-04-16 20:15:00 +02:00
ApiBaseTest.php phpunit: Mass-replace setMethods with onlyMethods and adjust 2021-04-16 20:15:00 +02:00
ApiBlockInfoTraitTest.php MediaWikiTestCase to MediaWikiIntegrationTestCase 2020-06-30 17:02:22 +01:00
ApiBlockTest.php ApiBlockTest: fake the current time to avoid flaky tests 2021-03-22 17:57:00 +01:00
ApiChangeContentModelTest.php Tests: Mark more more closures as static 2021-02-09 02:55:57 +00:00
ApiCheckTokenTest.php
ApiClearHasMsgTest.php Use new TalkPageNotificationManager 2020-05-15 12:35:45 -04:00
ApiComparePagesTest.php Tests: Mark more closures as static 2021-02-07 13:26:56 +01:00
ApiContinuationManagerTest.php MediaWikiTestCase to MediaWikiIntegrationTestCase 2020-06-30 17:02:22 +01:00
ApiCSPReportTest.php phpunit: Mass-replace setMethods with onlyMethods and adjust 2021-04-16 20:15:00 +02:00
ApiDeleteTest.php Use WatchlistManager in API classes 2021-04-21 04:41:06 +00:00
ApiDisabledTest.php
ApiEditPageTest.php Use WatchlistManager in API classes 2021-04-21 04:41:06 +00:00
ApiErrorFormatterTest.php Make ApiErrorFormatterTest more robust. 2021-02-05 16:21:19 -05:00
ApiLoginTest.php Tests: Mark more more closures as static 2021-02-09 02:55:57 +00:00
ApiLogoutTest.php Swap out uses of User->isLoggedIn() with ->isRegistered() 2020-12-22 03:13:37 +00:00
ApiMainTest.php Remove meaningless ->expects( $this->any() ) from all tests 2021-04-23 11:58:58 +02:00
ApiMessageTest.php Merge "Misc cleanup to api integration tests" 2021-01-21 07:32:08 +00:00
ApiMoveTest.php Use WatchlistManager in API classes 2021-04-21 04:41:06 +00:00
ApiOpenSearchTest.php Remove meaningless ->expects( $this->any() ) from all tests 2021-04-23 11:58:58 +02:00
ApiOptionsTest.php Merge "Remove unnecessary ->equalTo() from tests" 2021-04-23 14:43:04 +00:00
ApiPageSetTest.php Tests: Mark more more closures as static 2021-02-09 02:55:57 +00:00
ApiParseTest.php phpunit: Mass-replace setMethods with onlyMethods and adjust 2021-04-16 20:15:00 +02:00
ApiProtectTest.php Use WatchlistManager in API classes 2021-04-21 04:41:06 +00:00
ApiPurgeTest.php API: Clean up ApiPurgeTest 2021-03-13 02:29:09 +00:00
ApiResultTest.php Tests: Mark more closures as static 2021-02-07 13:26:56 +01:00
ApiRevisionDeleteTest.php Deprecate DatabaseBlock methods moved to DatabaseBlockStore 2020-09-13 22:17:27 +00:00
ApiRollbackTest.php Use WatchlistManager in API classes 2021-04-21 04:41:06 +00:00
ApiSetNotificationTimestampIntegrationTest.php Use WatchlistManager in API classes 2021-04-21 04:41:06 +00:00
ApiStashEditTest.php Convert PageEditStash to PageIdentity/UserIdentity 2021-04-14 09:12:04 -07:00
ApiTestCase.php API: Clean up ApiPurgeTest 2021-03-13 02:29:09 +00:00
ApiTestContext.php Remove documentation that literally repeats the code 2020-10-27 19:20:26 +00:00
ApiTokensTest.php
ApiUnblockTest.php Deprecate DatabaseBlock methods moved to DatabaseBlockStore 2020-09-13 22:17:27 +00:00
ApiUndeleteTest.php Use WatchlistManager in API classes 2021-04-21 04:41:06 +00:00
ApiUploadTest.php Use WatchlistManager in API classes 2021-04-21 04:41:06 +00:00
ApiUploadTestCase.php Use MediaWikiServices::getRepoGroup in api related classes 2020-04-11 23:58:00 +00:00
ApiUsageExceptionTest.php Misc cleanup to api integration tests 2021-01-21 06:32:58 +00:00
ApiUserrightsTest.php phpunit: Mass-replace setMethods with onlyMethods and adjust 2021-04-16 20:15:00 +02:00
ApiWatchTest.php Convert WatchedItem et al to PageIdentity 2021-03-26 15:51:19 -04:00
generateRandomImages.php Safer autoloading with respect to file-scope code 2021-01-11 11:59:36 +11:00
MockApi.php
MockApiQueryBase.php Replace some oldskool @see with @inheritDoc 2019-11-08 18:00:27 +00:00
RandomImageGenerator.php Use ::class for class name 2021-04-08 21:17:42 +02:00