class MediaRevisionAccessCheck implements AccessInterface (View source)

Provides an access checker for media item revisions.

Properties

protected ContentEntityStorageInterface $mediaStorage

The media storage.

protected EntityAccessControlHandlerInterface $mediaAccess

The media access control handler.

Methods

__construct(EntityTypeManagerInterface $entity_type_manager)

Constructs a new MediaRevisionAccessCheck.

access(Route $route, AccountInterface $account, int $media_revision = NULL, MediaInterface $media = NULL)

Checks routing access for the media item revision.

bool
checkAccess(MediaInterface $media, AccountInterface $account, string $op = 'view')

Checks media item revision access.

Details

__construct(EntityTypeManagerInterface $entity_type_manager)

Constructs a new MediaRevisionAccessCheck.

Parameters

EntityTypeManagerInterface $entity_type_manager

The entity type manager.

AccessResultInterface access(Route $route, AccountInterface $account, int $media_revision = NULL, MediaInterface $media = NULL)

Checks routing access for the media item revision.

Parameters

Route $route

The route to check against.

AccountInterface $account

The currently logged in account.

int $media_revision

(optional) The media item revision ID. If not specified, but $media is, access is checked for that object's revision.

MediaInterface $media

(optional) A media item. Used for checking access to a media items default revision when $media_revision is unspecified. Ignored when $media_revision is specified. If neither $media_revision nor $media are specified, then access is denied.

Return Value

AccessResultInterface

The access result.

bool checkAccess(MediaInterface $media, AccountInterface $account, string $op = 'view')

Checks media item revision access.

Parameters

MediaInterface $media

The media item to check.

AccountInterface $account

A user object representing the user for whom the operation is to be performed.

string $op

(optional) The specific operation being checked. Defaults to 'view'.

Return Value

bool

TRUE if the operation may be performed, FALSE otherwise.