ModuleWorkspaceVoter

final readonly class \TYPO3\CMS\Backend\Security\Authorization\ModuleWorkspaceVoter

Implements
CacheableVoterInterface

Denies accessing a backend module that is not available in the current workspace of the backend user, see the "workspaces" option of a module: "live" restricts a module to the live workspace, "offline" to the other workspaces, "*" makes it available in every workspace, even without workspace (-99). A module without the option inherits it from its parent.

The restriction only applies with EXT:workspaces loaded.

The voter never grants, it abstains for a module available in the workspace, so that the decision on its access value is left to the other voters. The workspace is the one of the backend user object the principal was built from; without such an object the voter abstains as well.

ModuleProvider::accessGranted() ignores the restriction on request by setting the token attribute IGNORE_WORKSPACE_RESTRICTION.

Attributes

#[AsSecurityVoter]

Table of Contents

Interfaces

CacheableVoterInterface

Constants

IGNORE_WORKSPACE_RESTRICTION  : string = 'typo3.module.ignoreWorkspaceRestriction'
Token attribute to decide the access to a module regardless of the workspace

Methods

__construct()  : mixed
isAvailableInWorkspace()  : bool
Whether the module is available in the given workspace, the one place deciding the workspace restriction of modules
supportsAttribute()  : bool
supportsType()  : bool
vote()  : int

Constants

IGNORE_WORKSPACE_RESTRICTION

Token attribute to decide the access to a module regardless of the workspace

public string IGNORE_WORKSPACE_RESTRICTION = 'typo3.module.ignoreWorkspaceRestriction'

Methods

isAvailableInWorkspace()

Whether the module is available in the given workspace, the one place deciding the workspace restriction of modules

public static isAvailableInWorkspace(ModuleInterface $module, int $workspace) : bool

Parameters

$module : ModuleInterface
$workspace : int

Return values

bool

supportsAttribute()

public supportsAttribute(string $attribute) : bool

Parameters

$attribute : string

Return values

bool

supportsType()

public supportsType(string $subjectType) : bool

Parameters

$subjectType : string

Return values

bool

vote()

public vote(TokenInterface $token, mixed $subject, array $attributes[, Vote|null $vote = null ]) : int

Parameters

$token : TokenInterface
$subject : mixed
$attributes : array
$vote : Vote|null = null

Return values

int
On this page