Extension:PluggableAuth/PluggableAuthUserAuthorization

From MediaWiki.org
Jump to navigation Jump to search
PluggableAuth/PluggableAuthUserAuthorization
Available from version 1.0
called to determine if the user is authorized to log in to the wiki
Define function:
public static function onPluggableAuth_PluggableAuthUserAuthorization( User $user, &$authorized ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"PluggableAuth/PluggableAuthUserAuthorization": "MyExtensionHooks::onPluggableAuthPluggableAuthUserAuthorization"
	}
}

For MediaWiki ≤1.25:

$wgHooks['PluggableAuth/PluggableAuthUserAuthorization'][] = 'MyExtensionHooks::onPluggableAuthPluggableAuthUserAuthorization';
Called from:File(s): PluggableAuth extension

For more information about attaching hooks, see Manual:Hooks.
For examples of extensions using this hook, see Category:PluggableAuth/PluggableAuthUserAuthorization extensions.

The parameters to the handler are:

  • User $user: the User object
  • &$authorized: Boolean return value (true if authorized, false otherwise)

The possible return values for the handler are defined in Manual:Hooks. In particular, if there has not been an error, the hook function should return no value or null to allow other handlers to run or it should return false to prevent further handlers from running. It is, therefore, possible that the value of $authorized passed in may be false from a previous handler invocation that returned no value or null. The handler may choose to override that value or to leave it unchanged.