Refs #729 - Hide updates from system report widget when permissions [system.manage_updates] are denied

This commit is contained in:
Sam Georges 2014-11-09 14:04:53 +11:00
parent 5e3ee40edf
commit e82198b8ad
2 changed files with 9 additions and 6 deletions

View File

@ -44,6 +44,7 @@ class Status extends ReportWidgetBase
protected function loadData()
{
$manager = UpdateManager::instance();
$this->vars['showUpdates'] = $this->controller->user->hasAccess('system.manage_updates');
$this->vars['updates'] = $manager->check();
}
}

View File

@ -7,12 +7,14 @@
<span class="status circle success"></span>
<?= e(trans('backend::lang.dashboard.status.online')) ?>
</li>
<li>
<a href="<?= Backend::url('system/updates') ?>">
<span class="status primary"><?= $updates ?></span>
<?= e(trans_choice('backend::lang.dashboard.status.update_available', $updates)) ?>
</a>
</li>
<?php if ($showUpdates): ?>
<li>
<a href="<?= Backend::url('system/updates') ?>">
<span class="status primary"><?= $updates ?></span>
<?= e(trans_choice('backend::lang.dashboard.status.update_available', $updates)) ?>
</a>
</li>
<?php endif ?>
</ul>
<?php else: ?>
<p class="flash-message static warning"><?= e($error) ?></p>