MediaWiki REL1_37
|
Represents an authority that has a specific set of permissions which are specified explicitly. More...
Public Member Functions | ||||||||||
__construct (UserIdentity $actor, array $permissions) | ||||||||||
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.
| ||||||||||
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.
| ||||||||||
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.
| ||||||||||
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.
| ||||||||||
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.
| ||||||||||
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.
| ||||||||||
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.
| ||||||||||
Private Member Functions | |
checkPermission (string $permission, ?PermissionStatus $status) | |
Private Attributes | |
UserIdentity | $actor |
array | $permissions |
permissions (stored in the keys, values are ignored) | |
Represents an authority that has a specific set of permissions which are specified explicitly.
This is useful for testing, but may also be used to represent a fixed set of permissions to be used in some context, e.g. in an asynchronous job.
Definition at line 37 of file SimpleAuthority.php.
MediaWiki\Permissions\SimpleAuthority::__construct | ( | UserIdentity | $actor, |
array | $permissions | ||
) |
UserIdentity | $actor | |
string[] | $permissions | A list of permissions to grant to the actor |
Definition at line 50 of file SimpleAuthority.php.
References MediaWiki\Permissions\SimpleAuthority\$actor, and MediaWiki\Permissions\SimpleAuthority\$permissions.
MediaWiki\Permissions\SimpleAuthority::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 |
string | $action | |
PageIdentity | $target | |
PermissionStatus | null | $status |
Implements MediaWiki\Permissions\Authority.
Definition at line 181 of file SimpleAuthority.php.
MediaWiki\Permissions\SimpleAuthority::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 |
string | $action | |
PageIdentity | $target | |
PermissionStatus | null | $status |
Implements MediaWiki\Permissions\Authority.
Definition at line 198 of file SimpleAuthority.php.
|
private |
Definition at line 127 of file SimpleAuthority.php.
References StatusValue\fatal().
MediaWiki\Permissions\SimpleAuthority::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.
string | $action | |
PageIdentity | $target | |
PermissionStatus | null | $status | aggregator for failures |
string | $action | |
PageIdentity | $target | |
PermissionStatus | null | $status |
Implements MediaWiki\Permissions\Authority.
Definition at line 164 of file SimpleAuthority.php.
MediaWiki\Permissions\SimpleAuthority::getBlock | ( | int | $freshness = self::READ_NORMAL | ) |
int | $freshness |
Implements MediaWiki\Permissions\Authority.
Definition at line 70 of file SimpleAuthority.php.
MediaWiki\Permissions\SimpleAuthority::getUser | ( | ) |
The user identity associated with this authority.
Implements MediaWiki\Permissions\Authority.
Definition at line 60 of file SimpleAuthority.php.
MediaWiki\Permissions\SimpleAuthority::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.
string | $permission |
string | $permission |
Implements MediaWiki\Permissions\Authority.
Definition at line 81 of file SimpleAuthority.php.
MediaWiki\Permissions\SimpleAuthority::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. |
string | ...$permissions |
Implements MediaWiki\Permissions\Authority.
Definition at line 113 of file SimpleAuthority.php.
MediaWiki\Permissions\SimpleAuthority::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. |
string | ...$permissions |
Implements MediaWiki\Permissions\Authority.
Definition at line 92 of file SimpleAuthority.php.
MediaWiki\Permissions\SimpleAuthority::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.
string | $action | |
PageIdentity | $target | |
PermissionStatus | null | $status | aggregator for failures |
string | $action | |
PageIdentity | $target | |
PermissionStatus | null | $status |
Implements MediaWiki\Permissions\Authority.
Definition at line 147 of file SimpleAuthority.php.
|
private |
Definition at line 40 of file SimpleAuthority.php.
Referenced by MediaWiki\Permissions\SimpleAuthority\__construct().
|
private |
permissions (stored in the keys, values are ignored)
Definition at line 43 of file SimpleAuthority.php.
Referenced by MediaWiki\Permissions\SimpleAuthority\__construct().