Access plugin that checks multiple permissions.
@ViewsAccess(
id = "tmgmt_job",
title = @Translation("View translation jobs")
)
Expanded class hierarchy of ViewJobAccess
class ViewJobAccess extends AccessPluginBase {
/**
* List of permissions that allow view access.
*
* @var array
*/
protected $permissions = [
'administer tmgmt',
'create translation jobs',
'accept translation jobs',
];
/**
* {@inheritdoc}
*/
public function summaryTitle() {
return $this
->t('Job view access');
}
/**
* {@inheritdoc}
*/
public function access(AccountInterface $account) {
foreach ($this->permissions as $permission) {
if ($account
->hasPermission($permission)) {
return TRUE;
}
}
}
/**
* {@inheritdoc}
*/
public function alterRouteDefinition(Route $route) {
$route
->setRequirement('_permission', (string) implode('+', $this->permissions));
}
}
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ViewJobAccess:: |
protected | property | List of permissions that allow view access. | |
ViewJobAccess:: |
public | function | ||
ViewJobAccess:: |
public | function | ||
ViewJobAccess:: |
public | function |