MediaWiki  master
MediaWiki\Permissions\Authority Interface Reference

This interface represents the authority associated the current execution context, such as a web request. More...

Inheritance diagram for MediaWiki\Permissions\Authority:

Public Member Functions

 authorizeRead (string $action, PageIdentity $target, PermissionStatus $status=null)
 Authorize read access. More...
 
 authorizeWrite (string $action, PageIdentity $target, PermissionStatus $status=null)
 Authorize write access. More...
 
 definitelyCan (string $action, PageIdentity $target, PermissionStatus $status=null)
 Checks whether this authority can perform the given action on the given target page. More...
 
 getUser ()
 Returns the performer of the actions associated with this authority. More...
 
 isAllowed (string $permission)
 Checks whether this authority has the given permission in general. More...
 
 isAllowedAll (... $permissions)
 Checks whether this authority has any of the given permissions in general. More...
 
 isAllowedAny (... $permissions)
 Checks whether this authority has any of the given permissions in general. More...
 
 probablyCan (string $action, PageIdentity $target, PermissionStatus $status=null)
 Checks whether this authority can probably perform the given action on the given target page. More...
 

Detailed Description

This interface represents the authority associated the current execution context, such as a web request.

The authority determines which actions can or cannot be performed withing that execution context.

See the individual implementations for information on how that authority is determined.

Since
1.36

Definition at line 35 of file Authority.php.

Member Function Documentation

◆ authorizeRead()

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.

Parameters
string$action
PageIdentity$target
PermissionStatus | null$statusaggregator for failures
Returns
bool

Implemented in User, MediaWiki\Permissions\UserAuthority, MediaWiki\Permissions\UltimateAuthority, and MediaWiki\Permissions\SimpleAuthority.

Referenced by DifferenceEngine\getPermissionErrors(), EditPage\isPageExistingAndViewable(), and MediaWiki\Revision\RevisionRecord\userCanBitfield().

◆ authorizeWrite()

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.

Parameters
string$action
PageIdentity$target
PermissionStatus | null$statusaggregator for failures
Returns
bool

Implemented in User, MediaWiki\Permissions\UserAuthority, MediaWiki\Permissions\UltimateAuthority, and MediaWiki\Permissions\SimpleAuthority.

Referenced by MergeHistory\authorizeMerge(), MovePage\authorizeMove(), MediaWiki\Auth\AuthManager\checkAccountCreatePermissions(), RecentChange\doMarkPatrolled(), WikiPage\doUserEditContent(), MovePage\moveSubpagesIfAllowed(), and UploadBase\verifyTitlePermissions().

◆ definitelyCan()

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.

Parameters
string$action
PageIdentity$target
PermissionStatus | null$statusaggregator for failures
Returns
bool

Implemented in User, MediaWiki\Permissions\UserAuthority, MediaWiki\Permissions\UltimateAuthority, and MediaWiki\Permissions\SimpleAuthority.

Referenced by MergeHistory\checkPermissions(), and MovePage\checkPermissions().

◆ getUser()

◆ isAllowed()

◆ isAllowedAll()

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.

See also
isAllowed
Parameters
string...$permissions Permissions to test. At least one must be given.
Returns
bool True if the user is allowed to perform all of the given actions

Implemented in User, MediaWiki\Permissions\UserAuthority, MediaWiki\Permissions\UltimateAuthority, and MediaWiki\Permissions\SimpleAuthority.

◆ isAllowedAny()

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.

See also
isAllowed
Parameters
string...$permissions Permissions to test. At least one must be given.
Returns
bool True if user is allowed to perform any of the given actions

Implemented in User, MediaWiki\Permissions\UserAuthority, MediaWiki\Permissions\UltimateAuthority, and MediaWiki\Permissions\SimpleAuthority.

Referenced by WatchedItemQueryService\getExtraDeletedPageLogEntryRelatedCond(), WatchedItemQueryService\getUserRelatedConds(), LogEventsList\userCanBitfield(), and MediaWiki\Revision\RevisionRecord\userCanBitfield().

◆ probablyCan()

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, and may produce false positives. It is intended for determining which UI elements should be offered to the user.

Parameters
string$action
PageIdentity$target
PermissionStatus | null$statusaggregator for failures
Returns
bool

Implemented in User, MediaWiki\Permissions\UserAuthority, MediaWiki\Permissions\UltimateAuthority, and MediaWiki\Permissions\SimpleAuthority.

Referenced by OutputPage\performerCanEditOrCreate(), MergeHistory\probablyCanMerge(), and MovePage\probablyCanMove().


The documentation for this interface was generated from the following file: