MediaWiki master
|
This interface represents the authority associated with the current execution context, such as a web request. More...
Inherited by MediaWiki\Permissions\SimpleAuthority, MediaWiki\Permissions\UltimateAuthority, MediaWiki\Permissions\UserAuthority, and MediaWiki\User\User.
Public Member Functions | |
authorizeAction (string $action, ?PermissionStatus $status=null) | |
Authorize an action. | |
authorizeRead (string $action, PageIdentity $target, ?PermissionStatus $status=null) | |
Authorize read access. | |
authorizeWrite (string $action, PageIdentity $target, ?PermissionStatus $status=null) | |
Authorize write access. | |
definitelyCan (string $action, PageIdentity $target, ?PermissionStatus $status=null) | |
Checks whether this authority can perform the given action on the given target page. | |
getBlock (int $freshness=IDBAccessObject::READ_NORMAL) | |
Returns any user block affecting the Authority. | |
getUser () | |
Returns the performer of the actions associated with this authority. | |
isAllowed (string $permission, ?PermissionStatus $status=null) | |
Checks whether this authority has the given permission in general. | |
isAllowedAll (... $permissions) | |
Checks whether this authority has any of the given permissions in general. | |
isAllowedAny (... $permissions) | |
Checks whether this authority has any of the given permissions in general. | |
isDefinitelyAllowed (string $action, ?PermissionStatus $status=null) | |
Checks whether this authority is allowed to perform the given action. | |
isNamed () | |
Is the user a normal non-temporary registered user? | |
isRegistered () | |
Get whether the user is registered. | |
isTemp () | |
Is the user an autocreated temporary user? | |
probablyCan (string $action, PageIdentity $target, ?PermissionStatus $status=null) | |
Checks whether this authority can probably perform the given action on the given target page. | |
This interface represents the authority associated with the current execution context, such as a web request.
The authority determines which actions can or cannot be performed within that execution context.
See the individual implementations for information on how that authority is determined.
Definition at line 37 of file Authority.php.
MediaWiki\Permissions\Authority::authorizeAction | ( | string | $action, |
?PermissionStatus | $status = null ) |
Authorize an action.
This should be used immediately before performing the action.
Calling this method may have non-trivial side-effects, such as incrementing a rate limit counter.
string | $action | |
PermissionStatus | null | $status | aggregator for failures |
Implemented in MediaWiki\Permissions\SimpleAuthority, MediaWiki\Permissions\UltimateAuthority, MediaWiki\Permissions\UserAuthority, and MediaWiki\User\User.
Referenced by ChangeTags\updateTagsWithChecks().
MediaWiki\Permissions\Authority::authorizeRead | ( | string | $action, |
PageIdentity | $target, | ||
?PermissionStatus | $status = null ) |
Authorize read access.
This should be used immediately before performing read access on restricted information.
Calling this method may have non-trivial side-effects, such as incrementing a rate limit counter.
string | $action | |
PageIdentity | $target | |
PermissionStatus | null | $status | aggregator for failures |
Implemented in MediaWiki\Permissions\SimpleAuthority, MediaWiki\Permissions\UltimateAuthority, MediaWiki\Permissions\UserAuthority, and MediaWiki\User\User.
Referenced by DifferenceEngine\getPermissionErrors(), MediaWiki\Revision\RevisionArchiveRecord\userCan(), and MediaWiki\Revision\RevisionRecord\userCanBitfield().
MediaWiki\Permissions\Authority::authorizeWrite | ( | string | $action, |
PageIdentity | $target, | ||
?PermissionStatus | $status = null ) |
Authorize write access.
This should be used immediately before updating persisted information.
Calling this method may have non-trivial side-effects, such as incrementing a rate limit counter.
string | $action | |
PageIdentity | $target | |
PermissionStatus | null | $status | aggregator for failures |
Implemented in MediaWiki\Permissions\SimpleAuthority, MediaWiki\Permissions\UltimateAuthority, MediaWiki\Permissions\UserAuthority, and MediaWiki\User\User.
Referenced by MediaWiki\Auth\AuthManager\authorizeCreateAccount(), MediaWiki\Page\MergeHistory\authorizeMerge(), MediaWiki\Page\MovePage\authorizeMove(), MediaWiki\Page\MovePage\moveSubpagesIfAllowed(), and UploadBase\verifyTitlePermissions().
MediaWiki\Permissions\Authority::definitelyCan | ( | string | $action, |
PageIdentity | $target, | ||
?PermissionStatus | $status = null ) |
Checks whether this authority can perform the given action on the given target page.
This method performs a thorough check, but does not protect against race conditions. It is intended to be used when a user is intending to perform an action, but has not yet committed to it. For example, when a user goes to the edit page of an article, this method may be used to determine whether the user should be presented with a warning and a read-only view instead.
This method may apply rate limit checks and evaluate user blocks.
string | $action | |
PageIdentity | $target | |
PermissionStatus | null | $status | aggregator for failures |
Implemented in MediaWiki\Permissions\SimpleAuthority, MediaWiki\Permissions\UltimateAuthority, MediaWiki\Permissions\UserAuthority, and MediaWiki\User\User.
Referenced by MediaWiki\Page\MovePage\checkPermissions().
MediaWiki\Permissions\Authority::getBlock | ( | int | $freshness = IDBAccessObject::READ_NORMAL | ) |
Returns any user block affecting the Authority.
int | $freshness | Indicates whether slightly stale data is acceptable in, exchange for a fast response. |
Implemented in MediaWiki\Permissions\SimpleAuthority, MediaWiki\Permissions\UltimateAuthority, and MediaWiki\Permissions\UserAuthority.
MediaWiki\Permissions\Authority::getUser | ( | ) |
Returns the performer of the actions associated with this authority.
Actions performed under this authority should generally be attributed to the user identity returned by this method.
Implemented in MediaWiki\Permissions\SimpleAuthority, MediaWiki\Permissions\UltimateAuthority, MediaWiki\Permissions\UserAuthority, and MediaWiki\User\User.
Referenced by ChangeTags\activateTagWithChecks(), EmailNotification\actuallyNotifyOnPageChange(), MediaWiki\Auth\AuthManager\beginAccountCreation(), ChangeTags\createTagWithChecks(), ChangeTags\deactivateTagWithChecks(), ChangeTags\deleteTagWithChecks(), MediaWiki\Watchlist\WatchlistManager\isTempWatched(), MediaWiki\Watchlist\WatchlistManager\isWatched(), MediaWiki\Page\MergeHistory\merge(), MediaWiki\Page\MovePage\moveIfAllowed(), ChangesList\revDateLink(), and ChangeTags\updateTagsWithChecks().
MediaWiki\Permissions\Authority::isAllowed | ( | string | $permission, |
?PermissionStatus | $status = null ) |
Checks whether this authority has the given permission in general.
For some permissions, exceptions may exist, both positive and negative, on a per-target basis. This method offers a fast, lightweight check, but may produce false positives. It is intended for determining which UI elements should be offered to the user.
This method will not apply rate limit checks or evaluate user blocks.
string | $permission | |
PermissionStatus | null | $status |
Implemented in MediaWiki\Permissions\SimpleAuthority, MediaWiki\Permissions\UltimateAuthority, MediaWiki\Permissions\UserAuthority, and MediaWiki\User\User.
Referenced by EmailNotification\actuallyNotifyOnPageChange(), MediaWiki\Linker\Linker\getRevDeleteLink(), UploadBase\isAllowed(), UploadFromUrl\isAllowed(), MediaWiki\Page\MovePage\moveIfAllowed(), MediaWiki\User\TempUser\RealTempUserConfig\shouldAutoCreate(), ChangeTags\showTagEditingUI(), LogEventsList\userCanBitfield(), and LogEventsList\userCanViewLogType().
MediaWiki\Permissions\Authority::isAllowedAll | ( | $permissions | ) |
Checks whether this authority has any of the given permissions in general.
Implementations must ensure that this method returns false if isAllowed would return false for any of the given permissions. Calling isAllowedAll() with one parameter must be equivalent to calling isAllowed(). Calling isAllowedAny() with no parameter is not allowed.
string | ...$permissions Permissions to test. At least one must be given. |
Implemented in MediaWiki\Permissions\SimpleAuthority, MediaWiki\Permissions\UltimateAuthority, MediaWiki\Permissions\UserAuthority, and MediaWiki\User\User.
MediaWiki\Permissions\Authority::isAllowedAny | ( | $permissions | ) |
Checks whether this authority has any of the given permissions in general.
Implementations must ensure that this method returns true if isAllowed would return true for any of the given permissions. Calling isAllowedAny() with one parameter must be equivalent to calling isAllowed(). Calling isAllowedAny() with no parameter is not allowed.
string | ...$permissions Permissions to test. At least one must be given. |
Implemented in MediaWiki\Permissions\SimpleAuthority, MediaWiki\Permissions\UltimateAuthority, MediaWiki\Permissions\UserAuthority, and MediaWiki\User\User.
Referenced by LogEventsList\userCanBitfield(), and MediaWiki\Revision\RevisionRecord\userCanBitfield().
MediaWiki\Permissions\Authority::isDefinitelyAllowed | ( | string | $action, |
?PermissionStatus | $status = null ) |
Checks whether this authority is allowed to perform the given action.
This method performs a thorough check, but does not protect against race conditions. It is intended to be used when a user is intending to perform an action, but has not yet committed to it. For example, when a user visits their preferences page, this method may be used to determine whether the user should have the option to change their email address.
This method may apply rate limit checks and evaluate user blocks.
string | $action | |
PermissionStatus | null | $status | aggregator for failures |
Implemented in MediaWiki\Permissions\SimpleAuthority, MediaWiki\Permissions\UltimateAuthority, MediaWiki\Permissions\UserAuthority, and MediaWiki\User\User.
MediaWiki\Permissions\Authority::isNamed | ( | ) |
Is the user a normal non-temporary registered user?
Implemented in MediaWiki\Permissions\SimpleAuthority, MediaWiki\Permissions\UltimateAuthority, MediaWiki\Permissions\UserAuthority, and MediaWiki\User\User.
MediaWiki\Permissions\Authority::isRegistered | ( | ) |
Get whether the user is registered.
Implemented in MediaWiki\Permissions\SimpleAuthority, MediaWiki\Permissions\UltimateAuthority, MediaWiki\Permissions\UserAuthority, and MediaWiki\User\User.
Referenced by MediaWiki\User\TempUser\RealTempUserConfig\shouldAutoCreate().
MediaWiki\Permissions\Authority::isTemp | ( | ) |
Is the user an autocreated temporary user?
Implemented in MediaWiki\Permissions\SimpleAuthority, MediaWiki\Permissions\UltimateAuthority, MediaWiki\Permissions\UserAuthority, and MediaWiki\User\User.
MediaWiki\Permissions\Authority::probablyCan | ( | string | $action, |
PageIdentity | $target, | ||
?PermissionStatus | $status = null ) |
Checks whether this authority can probably perform the given action on the given target page.
This method offers a fast, lightweight check, but may produce false positives. It is intended for determining which UI elements should be offered to the user. This method will not apply rate limit checks or evaluate user blocks.
string | $action | |
PageIdentity | $target | |
PermissionStatus | null | $status | aggregator for failures |
Implemented in MediaWiki\Permissions\SimpleAuthority, MediaWiki\Permissions\UltimateAuthority, MediaWiki\Permissions\UserAuthority, and MediaWiki\User\User.
Referenced by MediaWiki\Auth\AuthManager\probablyCanCreateAccount(), MediaWiki\Page\MergeHistory\probablyCanMerge(), and MediaWiki\Page\MovePage\probablyCanMove().