Skip to content
Snippets Groups Projects

check for process permission on each queue before outputting.

1 unresolved thread
+ 56
54
@@ -219,63 +219,65 @@ class OverviewForm extends FormBase {
*/
$queues = $this->queueWorkerManager->getDefinitions();
foreach ($queues as $name => $queue_definition) {
$queue = $this->queueFactory->get($name);
$operations = [];
// If queue inspection is enabled for this implementation.
if ($this->queueUIManager->fromQueueName($name)) {
$operations['inspect'] = [
'title' => $this->t('Inspect'),
'url' => Url::fromRoute('queue_ui.inspect', ['queueName' => $name]),
if ($this->currentUser->hasPermission('process ' . $name . ' queue')) {
Please register or sign in to reply
$queue = $this->queueFactory->get($name);
$operations = [];
// If queue inspection is enabled for this implementation.
if ($this->queueUIManager->fromQueueName($name)) {
$operations['inspect'] = [
'title' => $this->t('Inspect'),
'url' => Url::fromRoute('queue_ui.inspect', ['queueName' => $name]),
];
}
$row = [
'title' => [
'#markup' => (string) $queue_definition['title'],
],
'name' => [
'#markup' => $name,
],
'items' => [
'#markup' => $queue->numberOfItems(),
],
'class' => [
'#markup' => $this->queueUIManager->queueClassName($queue),
],
'cron' => [
'#type' => 'number',
'#title' => $this->t('Cron Time'),
'#title_display' => 'hidden',
'#placeholder' => $this->t('Cron disabled'),
'#value' => ($queue_definition['cron']['time'] ?? ''),
'#parents' => [],
'#name' => 'cron[' . $name . ']',
],
'operations' => [
'#type' => 'operations',
'#links' => $operations,
],
];
}
$row = [
'title' => [
'#markup' => (string) $queue_definition['title'],
],
'name' => [
'#markup' => $name,
],
'items' => [
'#markup' => $queue->numberOfItems(),
],
'class' => [
'#markup' => $this->queueUIManager->queueClassName($queue),
],
'cron' => [
'#type' => 'number',
'#title' => $this->t('Cron Time'),
'#title_display' => 'hidden',
'#placeholder' => $this->t('Cron disabled'),
'#value' => ($queue_definition['cron']['time'] ?? ''),
'#parents' => [],
'#name' => 'cron[' . $name . ']',
],
'operations' => [
'#type' => 'operations',
'#links' => $operations,
],
];
// Enable sort if queue_order is enabled.
if ($queue_order_installed) {
$weight = $queue_definition['weight'] ?? 10;
$row['#attributes'] = ['class' => ['draggable']];
$row['#weight'] = $weight;
$row['weight'] = [
'#type' => 'weight',
'#title' => $this->t('Weight for @title', ['@title' => $name]),
'#title_display' => 'invisible',
'#default_value' => $weight,
'#name' => 'weight[' . $name . ']',
// Classify the weight element for #tabledrag.
'#attributes' => ['class' => ['queue-order-weight']],
'#parents' => ['weight', $name],
];
// Enable sort if queue_order is enabled.
if ($queue_order_installed) {
$weight = $queue_definition['weight'] ?? 10;
$row['#attributes'] = ['class' => ['draggable']];
$row['#weight'] = $weight;
$row['weight'] = [
'#type' => 'weight',
'#title' => $this->t('Weight for @title', ['@title' => $name]),
'#title_display' => 'invisible',
'#default_value' => $weight,
'#name' => 'weight[' . $name . ']',
// Classify the weight element for #tabledrag.
'#attributes' => ['class' => ['queue-order-weight']],
'#parents' => ['weight', $name],
];
}
$form['queues'][$name] = $row;
}
$form['queues'][$name] = $row;
}
// Add this element so the cron values from the table rows get submitted to
Loading