summaryrefslogtreecommitdiffstats
path: root/modules-available/locations
diff options
context:
space:
mode:
authorSimon Rettberg2018-03-28 14:55:54 +0200
committerSimon Rettberg2018-03-28 14:55:54 +0200
commitafee61496e9fa59d9e024339530b38c6652bba59 (patch)
tree7f41b59d5ef49278541ab3055374afa635b258d3 /modules-available/locations
parent[locations] Make subnet list editable again :) (diff)
downloadslx-admin-afee61496e9fa59d9e024339530b38c6652bba59.tar.gz
slx-admin-afee61496e9fa59d9e024339530b38c6652bba59.tar.xz
slx-admin-afee61496e9fa59d9e024339530b38c6652bba59.zip
[locations] Handle statistics permissions when showing/linking machine stats
Diffstat (limited to 'modules-available/locations')
-rw-r--r--modules-available/locations/page.inc.php11
-rw-r--r--modules-available/locations/templates/location-subnets.html9
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&amp;show=list&amp;filters=location={{locationid}}">{{machines}} / {{machines_online}} / {{machines_used}} ({{used_percent}}%)</a>
+ <span class="slx-ga2">{{lang_matchingMachines}}:</span>
+ {{#statsLink}}
+ <a href="?do=Statistics&amp;show={{statsLink}}&amp;filters=location={{locationid}}">
+ {{/statsLink}}
+ {{machines}} / {{machines_online}} / {{machines_used}} ({{used_percent}}%)
+ {{#statsLink}}
+ </a>
+ {{/statsLink}}
</div>
{{/haveStatistics}}
</div>