MediaWiki REL1_39
MediaWiki\Permissions\UltimateAuthority Class Reference

Represents an authority that has all permissions. More...

Inheritance diagram for MediaWiki\Permissions\UltimateAuthority:
Collaboration diagram for MediaWiki\Permissions\UltimateAuthority:

Public Member Functions

 __construct (UserIdentity $actor, $isTemp=false)
 
 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

 
 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

 
 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

 
 getBlock (int $freshness=self::READ_NORMAL)
 
 getUser ()
 The user identity associated with this authority.
 
 isAllowed (string $permission)
 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.
Parameters
string$permission
Returns
bool

 
 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

 
 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

 
 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 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

 

Detailed Description

Represents an authority that has all permissions.

This is intended for use in maintenance scripts and tests.

Stability: newable
Since
1.36

Definition at line 35 of file UltimateAuthority.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Permissions\UltimateAuthority::__construct ( UserIdentity $actor,
$isTemp = false )
Stability: stable
to call
Parameters
UserIdentity$actor
bool$isTemp

Definition at line 48 of file UltimateAuthority.php.

References MediaWiki\Permissions\UltimateAuthority\isTemp().

Member Function Documentation

◆ authorizeRead()

MediaWiki\Permissions\UltimateAuthority::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

Parameters
string$action
PageIdentity$target
PermissionStatus | null$status
Returns
bool

Implements MediaWiki\Permissions\Authority.

Definition at line 150 of file UltimateAuthority.php.

◆ authorizeWrite()

MediaWiki\Permissions\UltimateAuthority::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

Parameters
string$action
PageIdentity$target
PermissionStatus | null$status
Returns
bool

Implements MediaWiki\Permissions\Authority.

Definition at line 167 of file UltimateAuthority.php.

◆ definitelyCan()

MediaWiki\Permissions\UltimateAuthority::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

Parameters
string$action
PageIdentity$target
PermissionStatus | null$status
Returns
bool

Implements MediaWiki\Permissions\Authority.

Definition at line 133 of file UltimateAuthority.php.

◆ getBlock()

MediaWiki\Permissions\UltimateAuthority::getBlock ( int $freshness = self::READ_NORMAL)
Parameters
int$freshness
Returns
?Block always null
Since
1.37

Implements MediaWiki\Permissions\Authority.

Definition at line 68 of file UltimateAuthority.php.

◆ getUser()

MediaWiki\Permissions\UltimateAuthority::getUser ( )

The user identity associated with this authority.

Returns
UserIdentity

Implements MediaWiki\Permissions\Authority.

Definition at line 58 of file UltimateAuthority.php.

◆ isAllowed()

MediaWiki\Permissions\UltimateAuthority::isAllowed ( string $permission)

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.

Parameters
string$permission
Returns
bool

Returns
bool

Implements MediaWiki\Permissions\Authority.

Definition at line 77 of file UltimateAuthority.php.

◆ isAllowedAll()

MediaWiki\Permissions\UltimateAuthority::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

Returns
bool

Implements MediaWiki\Permissions\Authority.

Definition at line 99 of file UltimateAuthority.php.

◆ isAllowedAny()

MediaWiki\Permissions\UltimateAuthority::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

Returns
bool

Implements MediaWiki\Permissions\Authority.

Definition at line 86 of file UltimateAuthority.php.

◆ isNamed()

MediaWiki\Permissions\UltimateAuthority::isNamed ( )

Is the user a normal non-temporary registered user?

Since
1.39
Returns
bool

Implements MediaWiki\Permissions\Authority.

Definition at line 183 of file UltimateAuthority.php.

◆ isRegistered()

MediaWiki\Permissions\UltimateAuthority::isRegistered ( )

Get whether the user is registered.

Returns
bool
Since
1.39

Implements MediaWiki\Permissions\Authority.

Definition at line 175 of file UltimateAuthority.php.

◆ isTemp()

MediaWiki\Permissions\UltimateAuthority::isTemp ( )

Is the user an autocreated temporary user?

Since
1.39
Returns
bool

Implements MediaWiki\Permissions\Authority.

Definition at line 179 of file UltimateAuthority.php.

Referenced by MediaWiki\Permissions\UltimateAuthority\__construct().

◆ probablyCan()

MediaWiki\Permissions\UltimateAuthority::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

Parameters
string$action
PageIdentity$target
PermissionStatus | null$status
Returns
bool

Implements MediaWiki\Permissions\Authority.

Definition at line 116 of file UltimateAuthority.php.


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