Skip to content

Commit 535281e

Browse files
committed
refactor: move canView() to UsageGraphs_UsageGraphs
since the permissions required to view admin usage graphs are the same no matter the section, canView() can be moved to the abstract UsageGraphs_UsageGraphs class to be used as is by all usagegraph classes
1 parent 0cf5cef commit 535281e

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

code/web/services/Admin/AbstractUsageGraphs.php

+7
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,11 @@ protected function launchGraph(string $sectionName): void {
3333
$this->display('usage-graph.tpl', $graphTitle);
3434
}
3535

36+
public function canView(): bool {
37+
return UserAccount::userHasPermission([
38+
'View Dashboards',
39+
'View System Reports',
40+
]);
41+
}
42+
3643
}

code/web/services/Admin/UsageGraphs.php

-6
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@ function getActiveAdminSection(): string {
2121
return 'system_reports';
2222
}
2323

24-
function canView(): bool {
25-
return UserAccount::userHasPermission([
26-
'View Dashboards',
27-
'View System Reports',
28-
]);
29-
}
3024

3125
public function buildCSV() {
3226
global $interface;

0 commit comments

Comments
 (0)