Manual:Hooks/TitleQuickPermissions

Details
The Title class has a number of functions for checking if a user has permissions to do a certain task on that Title. An outside caller will use the function Title::userCan, which then internally calls a series of permissions checks. Quick permissions are checked first in the Title::checkQuickPermissions function. Quick permissions are the most basic of permissions needed to perform an action. For example, if checking if a user can edit a page, seeing if they have the 'edit' permission is a quick permission check. Only after quick permissions are checked will the Title class proceed to more intensive checks, such as page protection.

This hook allows early abortion from the Title::checkQuickPermissions function. It can be used to either: do custom quick permission checks, and abort early if an extension determines the user is not allowed to perform the action; override the quick permissions checks, and allow a user who would normally not be allowed to do something, do something.

Parameters
The parameters are:


 * $title is the Title object being checked
 * $user is the User object performing the action
 * $action is the action being performed
 * &$errors is an array of permissions errors, each in the form of an array of a message key and parameters (e.g., )
 * $doExpensiveQueries is a boolean indicating whether the caller wants permissions checks that involve expensive queries to be performed, or if they should be skipped
 * $short is a boolean indicating whether the caller wants all permissions checks to be performed (meaning the caller wants a list of all the errors), or if the process should abort upon reaching the first error (meaning the caller just wants to know if the user can perform the action, and does not care why)

Returning false from this hook will cause the remainder of the quick permissions checks to not be evaluated.