diff options
author | Simon Rettberg | 2018-03-28 14:55:54 +0200 |
---|---|---|
committer | Simon Rettberg | 2018-03-28 14:55:54 +0200 |
commit | afee61496e9fa59d9e024339530b38c6652bba59 (patch) | |
tree | 7f41b59d5ef49278541ab3055374afa635b258d3 | |
parent | [locations] Make subnet list editable again :) (diff) | |
download | slx-admin-afee61496e9fa59d9e024339530b38c6652bba59.tar.gz slx-admin-afee61496e9fa59d9e024339530b38c6652bba59.tar.xz slx-admin-afee61496e9fa59d9e024339530b38c6652bba59.zip |
[locations] Handle statistics permissions when showing/linking machine stats
-rw-r--r-- | modules-available/locations/page.inc.php | 11 | ||||
-rw-r--r-- | modules-available/locations/templates/location-subnets.html | 9 |
2 files changed, 19 insertions, 1 deletions
diff --git a/modules-available/locations/page.inc.php b/modules-available/locations/page.inc.php index 0a6fdb10..80a8076b 100644 --- a/modules-available/locations/page.inc.php +++ b/modules-available/locations/page.inc.php @@ -357,6 +357,11 @@ class Page_Locations extends Page } else { $locationList[$lid]['havesysconfig'] = false; } + if (User::hasPermission('.statistics.view.list', $lid)) { + $visibleLocationIds[] = $lid; + } else { + $locationList[$lid]['havestatistics'] = false; + } if (!in_array($lid, $visibleLocationIds)) { unset($locationList[$lid]); } elseif (!in_array($lid, $allowedLocationIds)) { @@ -554,6 +559,12 @@ class Page_Locations extends Page } } $data['haveStatistics'] = true; + // Link + if (User::hasPermission('.statistics.view.list')) { + $data['statsLink'] = 'list'; + } elseif (User::hasPermission('.statistics.view.summary')) { + $data['statsLink'] = 'summary'; + } } $data['machines'] = $count; $data['machines_online'] = $online; diff --git a/modules-available/locations/templates/location-subnets.html b/modules-available/locations/templates/location-subnets.html index db94be0a..69e369c2 100644 --- a/modules-available/locations/templates/location-subnets.html +++ b/modules-available/locations/templates/location-subnets.html @@ -69,7 +69,14 @@ {{/haveDozmod}} {{#haveStatistics}} <div> - <span class="slx-ga2">{{lang_matchingMachines}}:</span> <a href="?do=Statistics&show=list&filters=location={{locationid}}">{{machines}} / {{machines_online}} / {{machines_used}} ({{used_percent}}%)</a> + <span class="slx-ga2">{{lang_matchingMachines}}:</span> + {{#statsLink}} + <a href="?do=Statistics&show={{statsLink}}&filters=location={{locationid}}"> + {{/statsLink}} + {{machines}} / {{machines_online}} / {{machines_used}} ({{used_percent}}%) + {{#statsLink}} + </a> + {{/statsLink}} </div> {{/haveStatistics}} </div> |