MediaWiki REL1_40
|
Represents the authority of a given User. More...
Inherits MediaWiki\Permissions\Authority.
Public Member Functions | ||||||||||
__construct (User $user, PermissionManager $permissionManager) | ||||||||||
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) | ||||||||||
Returns any user block affecting the 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.
| ||||||||||
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.
| ||||||||||
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.
| ||||||||||
Represents the authority of a given User.
For anonymous visitors, this will typically allow only basic permissions. For logged in users, permissions are generally based on group membership, but may be adjusted based on things like IP range blocks, OAuth grants, or rate limits.
Definition at line 46 of file UserAuthority.php.
MediaWiki\Permissions\UserAuthority::__construct | ( | User | $user, |
PermissionManager | $permissionManager ) |
User | $user | |
PermissionManager | $permissionManager |
Definition at line 73 of file UserAuthority.php.
MediaWiki\Permissions\UserAuthority::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 199 of file UserAuthority.php.
MediaWiki\Permissions\UserAuthority::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 226 of file UserAuthority.php.
MediaWiki\Permissions\UserAuthority::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 174 of file UserAuthority.php.
MediaWiki\Permissions\UserAuthority::getBlock | ( | int | $freshness = self::READ_NORMAL | ) |
Returns any user block affecting the Authority.
int | $freshness |
Implements MediaWiki\Permissions\Authority.
Definition at line 308 of file UserAuthority.php.
MediaWiki\Permissions\UserAuthority::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.
Implements MediaWiki\Permissions\Authority.
Definition at line 86 of file UserAuthority.php.
MediaWiki\Permissions\UserAuthority::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 97 of file UserAuthority.php.
MediaWiki\Permissions\UserAuthority::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 129 of file UserAuthority.php.
MediaWiki\Permissions\UserAuthority::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 108 of file UserAuthority.php.
MediaWiki\Permissions\UserAuthority::isNamed | ( | ) |
Is the user a normal non-temporary registered user?
Implements MediaWiki\Permissions\Authority.
Definition at line 329 of file UserAuthority.php.
MediaWiki\Permissions\UserAuthority::isRegistered | ( | ) |
Get whether the user is registered.
Implements MediaWiki\Permissions\Authority.
Definition at line 321 of file UserAuthority.php.
MediaWiki\Permissions\UserAuthority::isTemp | ( | ) |
Is the user an autocreated temporary user?
Implements MediaWiki\Permissions\Authority.
Definition at line 325 of file UserAuthority.php.
MediaWiki\Permissions\UserAuthority::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 152 of file UserAuthority.php.