Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[dashboard] Use user site permissions for dashboard charts #8132

Merged
merged 2 commits into from
Dec 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
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