Only show metrics dashboard pane if the user has access to metrics.

This commit is contained in:
Michael Stenta 2020-02-26 10:32:38 -05:00
parent 14b72d7930
commit 209cb5e48a
2 changed files with 7 additions and 5 deletions

View File

@ -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;
} }
/** /**

View File

@ -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;