Skip to content

Commit

Permalink
[dashboard] Use user site permissions for dashboard charts
Browse files Browse the repository at this point in the history
  • Loading branch information
CamilleBeau committed Jul 5, 2022
1 parent d462e6e commit 66168a5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions modules/statistics/php/charts.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ class Charts extends \NDB_Page
$DB = \NDB_Factory::singleton()->database();

$recruitmentBySiteData = [];
$list_of_sites = \Utility::getSiteList(true, false);
$user = \NDB_Factory::singleton()->user();
$list_of_sites = $user->getStudySites();

foreach ($list_of_sites as $siteID => $siteName) {
$totalRecruitment = $DB->pselectOne(
Expand Down Expand Up @@ -138,7 +139,8 @@ class Charts extends \NDB_Page
{
$DB = \NDB_Factory::singleton()->database();
$sexData = [];
$list_of_sites = \Utility::getSiteList(true, false);
$user = \NDB_Factory::singleton()->user();
$list_of_sites = $user->getStudySites();

foreach ($list_of_sites as $siteID => $siteName) {
$sexData['labels'][] = $siteName;
Expand Down Expand Up @@ -203,7 +205,8 @@ class Charts extends \NDB_Page
$scanData['labels'] = array_keys($labels);

// Massage the data into the appropriate format per site.
$list_of_sites = \Utility::getSiteList(true, false);
$user = \NDB_Factory::singleton()->user();
$list_of_sites = $user->getStudySites();
foreach ($list_of_sites as $siteID => $siteName) {
$scanData['datasets'][] = [
"name" => $siteName,
Expand Down Expand Up @@ -281,7 +284,8 @@ class Charts extends \NDB_Page
);
}

$list_of_sites = \Utility::getSiteList(true, false);
$user = \NDB_Factory::singleton()->user();
$list_of_sites = $user->getStudySites();

foreach ($list_of_sites as $siteID => $siteName) {
$recruitmentData['datasets'][] = [
Expand Down

0 comments on commit 66168a5

Please # to comment.