MediaWiki  master
Authority.php
Go to the documentation of this file.
1 <?php
22 
23 use IDBAccessObject;
27 
37 interface Authority {
38 
43  public const READ_NORMAL = IDBAccessObject::READ_NORMAL;
44 
49  public const READ_LATEST = IDBAccessObject::READ_LATEST;
50 
59  public function getUser(): UserIdentity;
60 
70  public function getBlock( int $freshness = self::READ_NORMAL ): ?Block;
71 
80  public function isAllowed( string $permission ): bool;
81 
94  public function isAllowedAny( ...$permissions ): bool;
95 
108  public function isAllowedAll( ...$permissions ): bool;
109 
121  public function probablyCan(
122  string $action,
123  PageIdentity $target,
124  PermissionStatus $status = null
125  ): bool;
126 
141  public function definitelyCan(
142  string $action,
143  PageIdentity $target,
144  PermissionStatus $status = null
145  ): bool;
146 
160  public function authorizeRead(
161  string $action,
162  PageIdentity $target,
163  PermissionStatus $status = null
164  ): bool;
165 
179  public function authorizeWrite(
180  string $action,
181  PageIdentity $target,
182  PermissionStatus $status = null
183  ): bool;
184 
191  public function isRegistered(): bool;
192 
199  public function isTemp(): bool;
200 
207  public function isNamed(): bool;
208 }
A StatusValue for permission errors.
Interface for database access objects.
Represents a block that may prevent users from performing specific operations.
Definition: Block.php:40
Interface for objects (potentially) representing an editable wiki page.
This interface represents the authority associated the current execution context, such as a web reque...
Definition: Authority.php:37
isNamed()
Is the user a normal non-temporary registered user?
isAllowedAll(... $permissions)
Checks whether this authority has any of the given permissions in general.
authorizeWrite(string $action, PageIdentity $target, PermissionStatus $status=null)
Authorize write access.
getUser()
Returns the performer of the actions associated with this authority.
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.
getBlock(int $freshness=self::READ_NORMAL)
Returns any user block affecting the Authority.
isRegistered()
Get whether the user is registered.
definitelyCan(string $action, PageIdentity $target, PermissionStatus $status=null)
Checks whether this authority can perform the given action on the given target page.
isAllowed(string $permission)
Checks whether this authority has the given permission in general.
authorizeRead(string $action, PageIdentity $target, PermissionStatus $status=null)
Authorize read access.
isAllowedAny(... $permissions)
Checks whether this authority has any of the given permissions in general.
Interface for objects representing user identity.