Movatterモバイル変換


[0]ホーム

URL:


Jump to content
MediaWiki
Search

Manual:Hooks/getUserPermissionsErrors

From mediawiki.org
<Manual:Hooks
Translate this page
Languages:
getUserPermissionsErrors
Available fromversion 1.12.0
Add a permissions error when permissions errors are checked for.
Define function:
publicstaticfunctionongetUserPermissionsErrors($title,$user,$action,&$result){...}
Attach hook:Inextension.json:
{"Hooks":{"getUserPermissionsErrors":"MediaWiki\\Extension\\MyExtension\\Hooks::ongetUserPermissionsErrors"}}
Called from:File(s):Permissions/PermissionManager.php
Interface:getUserPermissionsErrorsHook.php

For more information about attaching hooks, seeManual:Hooks.
For examples of extensions using this hook, seeCategory:getUserPermissionsErrors extensions.

Details

[edit]
  • $title - Title object being checked against
  • $user - Current user object
  • $action - Action being checked
  • &$result - User permissions error to add. $result can be set 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?).

Differences fromgetUserPermissionsErrorsExpensive

[edit]

Both hooks are typically run when checking for proper permissions inTitle.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, butnot for functional access control.This behavior may provide false positives, but should never provide a false negative.

See also

[edit]
Retrieved from "https://www.mediawiki.org/w/index.php?title=Manual:Hooks/getUserPermissionsErrors&oldid=7494360"
Categories:

[8]ページ先頭

©2009-2025 Movatter.jp