Wikibase
MediaWiki Wikibase extension
Wikibase\Repo\Store\EntityPermissionChecker Interface Reference

Service interface for checking a user's permissions on a given entity. More...

+ Inheritance diagram for Wikibase\Repo\Store\EntityPermissionChecker:

Public Member Functions

 getPermissionStatusForEntity (User $user, $action, EntityDocument $entity, $rigor=PermissionManager::RIGOR_SECURE)
 Check whether the given user has the permission to perform the given action on an entity. More...
 
 getPermissionStatusForEntityId (User $user, $action, EntityId $entityId, $rigor=PermissionManager::RIGOR_SECURE)
 Check whether the given user has the permission to perform the given action on an entity. More...
 

Public Attributes

const ACTION_READ = 'read'
 
const ACTION_EDIT = 'edit'
 
const ACTION_EDIT_TERMS = 'term'
 
const ACTION_MERGE = 'merge'
 
const ACTION_REDIRECT = 'redirect'
 

Detailed Description

Service interface for checking a user's permissions on a given entity.

Author
Daniel Kinzler

Member Function Documentation

◆ getPermissionStatusForEntity()

Wikibase\Repo\Store\EntityPermissionChecker::getPermissionStatusForEntity ( User  $user,
  $action,
EntityDocument  $entity,
  $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
Status a status object representing the check's result.

Implemented in Wikibase\Repo\Store\WikiPageEntityStorePermissionChecker.

◆ getPermissionStatusForEntityId()

Wikibase\Repo\Store\EntityPermissionChecker::getPermissionStatusForEntityId ( User  $user,
  $action,
EntityId  $entityId,
  $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
Status a status object representing the check's result.

Implemented in Wikibase\Repo\Store\WikiPageEntityStorePermissionChecker.

Member Data Documentation

◆ ACTION_EDIT

const Wikibase\Repo\Store\EntityPermissionChecker::ACTION_EDIT = 'edit'

◆ ACTION_EDIT_TERMS

const Wikibase\Repo\Store\EntityPermissionChecker::ACTION_EDIT_TERMS = 'term'

◆ ACTION_MERGE

const Wikibase\Repo\Store\EntityPermissionChecker::ACTION_MERGE = 'merge'

◆ ACTION_READ

const Wikibase\Repo\Store\EntityPermissionChecker::ACTION_READ = 'read'

◆ ACTION_REDIRECT

const Wikibase\Repo\Store\EntityPermissionChecker::ACTION_REDIRECT = 'redirect'

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