Manual:フック/getUserPermissionsErrors

From MediaWiki.org
Jump to navigation Jump to search
This page is a translated version of the page Manual:Hooks/getUserPermissionsErrors and the translation is 27% complete.

Other languages:
English • ‎français • ‎日本語
getUserPermissionsErrors
version 1.12.0 から利用可能
Add a permissions error when permissions errors are checked for.
関数の定義:
public static function ongetUserPermissionsErrors( $title, $user, $action, &$result ) { ... }
フックのアタッチ:

extension.json 内:

{
	"Hooks": {
		"getUserPermissionsErrors": "MyExtensionHooks::ongetUserPermissionsErrors"
	}
}

MediaWiki 1.25 以前では:

$wgHooks['getUserPermissionsErrors'][] = 'MyExtensionHooks::ongetUserPermissionsErrors';
呼び出し元:ファイル: Permissions/PermissionManager.php

フックの付け方の詳細はManual:フックの情報を参照してください。
このフックを使用する拡張機能の例については、Category:getUserPermissionsErrors extensions/ja を参照してください。

詳細

  • $title - Title object being checked against
  • $user - Current user object
  • $action - Action being checked
  • &$result - User permissions error to add. If none, return true. $result can be returned as a single error message key (string), or an array of error message keys when multiple messages are needed (although it seems to take an array as one message key with parameters?).

getUserPermissionsErrorsExpensive との違い

Both hooks are typically run when checking for proper permissions in Title.php . When it is desirable to skip potentially expensive cascading permission checks, only getUserPermissionsErrors is run. This behavior is suitable for nonessential UI controls in common cases, but not for functional access control. This behavior may provide false positives, but should never provide a false negative.

関連項目