From e7cd8d6fae10aaf5ffb576c41db8c7cce72f2fcc Mon Sep 17 00:00:00 2001 From: CamilleBeau Date: Tue, 5 Jul 2022 15:11:31 -0400 Subject: [PATCH 1/2] [dashboard] Use user site permissions for dashboard charts --- modules/statistics/php/charts.class.inc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/modules/statistics/php/charts.class.inc b/modules/statistics/php/charts.class.inc index 68b0469ab5d..44168168ecc 100644 --- a/modules/statistics/php/charts.class.inc +++ b/modules/statistics/php/charts.class.inc @@ -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( @@ -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; @@ -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, @@ -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'][] = [ From 20b7185af2e8dfc05b5b181b2aac8db770d19028 Mon Sep 17 00:00:00 2001 From: CamilleBeau Date: Tue, 5 Jul 2022 15:15:07 -0400 Subject: [PATCH 2/2] Add to changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a071fca4e4..02d6f16e4c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -120,6 +120,7 @@ multi-echo aquisitions (PR #7515). - The `Center_name` field in the `mri_protocol` table has been replaced by `CenterID` from the `psc` table. The default value of `CenterID` is `NULL`. Previously, the default for `Center_name` was `AAAA` or `ZZZZ`. (PR #7525) +- The statistics displayed in the dashboard was changed to only show the data relevant to the user's site(s). (PR #8132) #### Bug Fixes - A LINST instrument Date field name now appears correctly (not truncated) on the