Page MenuHomePhabricator

GlobalBlock::isCreateAccountBlocked should return true
Closed, ResolvedPublic1 Estimated Story Points



Global blocks currently always block account creation.

(Note that T17273: Add "Prevent account creation" checkbox to allow global blocks which do not prevent account creation will make this configurable. If that is completed first, this task should return the correct value from isCreateAccountBlocked, instead of always returning true.)

How do global blocks block account creation? They do so via the hook GetUserPermissionsErrorsExpensive. This seems fragile and difficult to follow: account creation does expensive permissions checks; expensive permissions checks run a hook; GlobalBlocking has a handler that can return a global block error here.

Other types of blocks are explicitly checked for blocking account creation, via $block->isCreateAccountBlocked and $block->appliesToRight( 'createaccount' ). However, global blocks are currently not found at the same time as other types of blocks, and have to be check for separately.

After T257701: Add global blocks into CompositeBlocks rather than treating them separately, global blocks will be found at the same time as other blocks. We can ensure global blocks block account creation here, by returning true from GlobalBlock::isCreateAccountBlocked.

Acceptance criteria
  • Calling GlobalBlock::isCreateAccountBlocked() returns true
  • Calling GlobalBlock::appliesToRight( 'createaccount' ) returns the value returned by calling GlobalBlock::isCreateAccountBlocked()

Event Timeline

Tchanders set the point value for this task to 1.Oct 11 2022, 5:16 PM

Change 844050 had a related patch set uploaded (by AGueyte; author: AGueyte):

[mediawiki/extensions/GlobalBlocking@master] Add GlobalBlock::isCreateAccountBlocked to GlobalBlocking

Change 844050 merged by jenkins-bot:

[mediawiki/extensions/GlobalBlocking@master] Add GlobalBlock::isCreateAccountBlocked to GlobalBlocking