| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Permissions\Hook; |
| 4 | |
| 5 | use MediaWiki\Title\Title; |
| 6 | use MediaWiki\User\User; |
| 7 | |
| 8 | /** |
| 9 | * This is a hook handler interface, see docs/Hooks.md. |
| 10 | * Use the hook name "userCan" to register handlers implementing this interface. |
| 11 | * |
| 12 | * @deprecated since 1.37 use getUserPermissionsErrors or getUserPermissionsErrorsExpensive instead. |
| 13 | * @ingroup Hooks |
| 14 | */ |
| 15 | interface UserCanHook { |
| 16 | /** |
| 17 | * Use this hook to interrupt or advise the "user can do X to Y article" check. |
| 18 | * If you want to display an error message, try getUserPermissionsErrors. |
| 19 | * |
| 20 | * @since 1.35 |
| 21 | * |
| 22 | * @param Title $title Title being checked against |
| 23 | * @param User $user Current user |
| 24 | * @param string $action Action being checked |
| 25 | * @param string &$result Pointer to result returned if hook returns false. |
| 26 | * If null is returned, userCan checks are continued by internal code. |
| 27 | * @return bool|void True or no return value to continue or false to abort |
| 28 | */ |
| 29 | public function onUserCan( $title, $user, $action, &$result ); |
| 30 | } |