Only show metrics dashboard pane if the user has access to metrics.
This commit is contained in:
parent
14b72d7930
commit
209cb5e48a
|
@ -8,13 +8,15 @@
|
||||||
* Implements hook_farm_dashboard_panes().
|
* Implements hook_farm_dashboard_panes().
|
||||||
*/
|
*/
|
||||||
function farm_metrics_farm_dashboard_panes() {
|
function farm_metrics_farm_dashboard_panes() {
|
||||||
return array(
|
$panes = array();
|
||||||
'farm_metrics' => array(
|
if (user_access('access farm metrics')) {
|
||||||
|
$panes['farm_metrics'] = array(
|
||||||
'title' => t('Metrics'),
|
'title' => t('Metrics'),
|
||||||
'callback' => 'farm_metrics_dashboard_pane',
|
'callback' => 'farm_metrics_dashboard_pane',
|
||||||
'group' => 'metrics',
|
'group' => 'metrics',
|
||||||
),
|
);
|
||||||
);
|
}
|
||||||
|
return $panes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -20,7 +20,7 @@ function farm_metrics_hook_info() {
|
||||||
function farm_metrics_permission() {
|
function farm_metrics_permission() {
|
||||||
$perms = array(
|
$perms = array(
|
||||||
'access farm metrics' => array(
|
'access farm metrics' => array(
|
||||||
'title' => t('Access the farmOS metrics endpoint'),
|
'title' => t('Access farm metrics'),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
return $perms;
|
return $perms;
|
||||||
|
|
Loading…
Reference in New Issue