Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Repo\Store\WikiPageEntityStorePermissionChecker Class Reference

Checks permissions to perform actions on the entity based on MediaWiki page permissions. More...

+ Inheritance diagram for Wikibase\Repo\Store\WikiPageEntityStorePermissionChecker:
+ Collaboration diagram for Wikibase\Repo\Store\WikiPageEntityStorePermissionChecker:

Public Member Functions

 __construct (EntityNamespaceLookup $namespaceLookup, EntityTitleLookup $titleLookup, PermissionManager $permissionManager, array $availableRights)
 
 getPermissionStatusForEntity (User $user, string $action, EntityDocument $entity, string $rigor=PermissionManager::RIGOR_SECURE)
 Check whether the given user has the permission to perform the given action on an entity.This will perform a check based on the entity's ID if the entity has an ID set (that is, the entity "exists"), or based merely on the entity type, in case the entity does not exist.
Parameters
User$user
string$action
EntityDocument$entity
string$rigorFlag for allowing quick permission checking. One of the PermissionManager::RIGOR_* constants. If set to 'PermissionManager::RIGOR_QUICK', implementations may return inaccurate results if determining the accurate result would be slow (e.g. checking for cascading protection). This is intended as an optimization for non-critical checks, e.g. for showing or hiding UI elements.
Exceptions
InvalidArgumentExceptionif unknown permission is requested
Returns
PermissionStatus a status object representing the check's result.

 
 getPermissionStatusForEntityId (User $user, string $action, EntityId $entityId, string $rigor=PermissionManager::RIGOR_SECURE)
 Check whether the given user has the permission to perform the given action on an entity.This requires the ID of an existing entity.
Parameters
User$user
string$action
EntityId$entityId
string$rigorFlag for allowing quick permission checking. One of the PermissionManager::RIGOR_* constants. If set to 'PermissionManager::RIGOR_QUICK', implementations may return inaccurate results if determining the accurate result would be slow (e.g. checking for cascading protection). This is intended as an optimization for non-critical checks, e.g. for showing or hiding UI elements.
Exceptions
InvalidArgumentExceptionif unknown permission is requested
Returns
PermissionStatus a status object representing the check's result.

 

Private Member Functions

 getPermissionStatusForEntityType (User $user, array $actions, $type, $rigor=PermissionManager::RIGOR_SECURE)
 Check whether the given user has the permission to perform the given action on a given entity type.
 
 getPageTitleInEntityNamespace ( $entityType)
 
 checkPermissionsForActions (User $user, array $actions, Title $title, string $entityType, string $rigor=PermissionManager::RIGOR_SECURE)
 
 getMediaWikiPermissionsToCheck (string $action, string $entityType)
 
 mediawikiPermissionExists (string $permission)
 
 mergeStatus (PermissionStatus $mergeTarget, PermissionStatus $mergeSource)
 

Private Attributes

const ACTION_MW_CREATE = 'create'
 
 $namespaceLookup
 
 $titleLookup
 
 $permissionManager
 
 $availableRights
 

Additional Inherited Members

- Public Attributes inherited from Wikibase\Repo\Store\EntityPermissionChecker
const ACTION_READ = 'read'
 
const ACTION_EDIT = 'edit'
 
const ACTION_EDIT_TERMS = 'term'
 
const ACTION_MERGE = 'merge'
 
const ACTION_REDIRECT = 'redirect'
 

Detailed Description

Checks permissions to perform actions on the entity based on MediaWiki page permissions.

For more information on the relationship between entities and wiki pages, see docs/entity-storage.wiki.

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\Store\WikiPageEntityStorePermissionChecker::__construct ( EntityNamespaceLookup $namespaceLookup,
EntityTitleLookup $titleLookup,
PermissionManager $permissionManager,
array $availableRights )
Parameters
EntityNamespaceLookup$namespaceLookup
EntityTitleLookup$titleLookup
PermissionManager$permissionManager
string[]$availableRights

Member Function Documentation

◆ checkPermissionsForActions()

Wikibase\Repo\Store\WikiPageEntityStorePermissionChecker::checkPermissionsForActions ( User $user,
array $actions,
Title $title,
string $entityType,
string $rigor = PermissionManager::RIGOR_SECURE )
private

◆ getMediaWikiPermissionsToCheck()

Wikibase\Repo\Store\WikiPageEntityStorePermissionChecker::getMediaWikiPermissionsToCheck ( string $action,
string $entityType )
private

◆ getPageTitleInEntityNamespace()

Wikibase\Repo\Store\WikiPageEntityStorePermissionChecker::getPageTitleInEntityNamespace ( $entityType)
private
Parameters
string$entityType
Returns
Title

◆ getPermissionStatusForEntity()

Wikibase\Repo\Store\WikiPageEntityStorePermissionChecker::getPermissionStatusForEntity ( User $user,
string $action,
EntityDocument $entity,
string $rigor = PermissionManager::RIGOR_SECURE )

Check whether the given user has the permission to perform the given action on an entity.This will perform a check based on the entity's ID if the entity has an ID set (that is, the entity "exists"), or based merely on the entity type, in case the entity does not exist.

Parameters
User$user
string$action
EntityDocument$entity
string$rigorFlag for allowing quick permission checking. One of the PermissionManager::RIGOR_* constants. If set to 'PermissionManager::RIGOR_QUICK', implementations may return inaccurate results if determining the accurate result would be slow (e.g. checking for cascading protection). This is intended as an optimization for non-critical checks, e.g. for showing or hiding UI elements.
Exceptions
InvalidArgumentExceptionif unknown permission is requested
Returns
PermissionStatus a status object representing the check's result.

Implements Wikibase\Repo\Store\EntityPermissionChecker.

◆ getPermissionStatusForEntityId()

Wikibase\Repo\Store\WikiPageEntityStorePermissionChecker::getPermissionStatusForEntityId ( User $user,
string $action,
EntityId $entityId,
string $rigor = PermissionManager::RIGOR_SECURE )

Check whether the given user has the permission to perform the given action on an entity.This requires the ID of an existing entity.

Parameters
User$user
string$action
EntityId$entityId
string$rigorFlag for allowing quick permission checking. One of the PermissionManager::RIGOR_* constants. If set to 'PermissionManager::RIGOR_QUICK', implementations may return inaccurate results if determining the accurate result would be slow (e.g. checking for cascading protection). This is intended as an optimization for non-critical checks, e.g. for showing or hiding UI elements.
Exceptions
InvalidArgumentExceptionif unknown permission is requested
Returns
PermissionStatus a status object representing the check's result.

Implements Wikibase\Repo\Store\EntityPermissionChecker.

◆ getPermissionStatusForEntityType()

Wikibase\Repo\Store\WikiPageEntityStorePermissionChecker::getPermissionStatusForEntityType ( User $user,
array $actions,
$type,
$rigor = PermissionManager::RIGOR_SECURE )
private

Check whether the given user has the permission to perform the given action on a given entity type.

This does not require an entity to exist.

Useful especially for checking whether the user is allowed to create an entity of a given type.

Parameters
User$user
string[]$actions
string$type
string$rigorFlag for allowing quick permission checking. One of the PermissionManager::RIGOR_* constants. If set to 'PermissionManager::RIGOR_QUICK', implementations may return inaccurate results if determining the accurate result would be slow (e.g. checking for cascading protection). This is intended as an optimization for non-critical checks, e.g. for showing or hiding UI elements.
Exceptions
InvalidArgumentExceptionif unknown permission is requested
Returns
PermissionStatus a status object representing the check's result.

◆ mediawikiPermissionExists()

Wikibase\Repo\Store\WikiPageEntityStorePermissionChecker::mediawikiPermissionExists ( string $permission)
private

◆ mergeStatus()

Wikibase\Repo\Store\WikiPageEntityStorePermissionChecker::mergeStatus ( PermissionStatus $mergeTarget,
PermissionStatus $mergeSource )
private

Member Data Documentation

◆ $availableRights

Wikibase\Repo\Store\WikiPageEntityStorePermissionChecker::$availableRights
private

◆ $namespaceLookup

Wikibase\Repo\Store\WikiPageEntityStorePermissionChecker::$namespaceLookup
private

◆ $permissionManager

Wikibase\Repo\Store\WikiPageEntityStorePermissionChecker::$permissionManager
private

◆ $titleLookup

Wikibase\Repo\Store\WikiPageEntityStorePermissionChecker::$titleLookup
private

◆ ACTION_MW_CREATE

const Wikibase\Repo\Store\WikiPageEntityStorePermissionChecker::ACTION_MW_CREATE = 'create'
private

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