diff --git a/modules/statistics/php/statistics_site.class.inc b/modules/statistics/php/statistics_site.class.inc index aabcc2e0205..66979e40f43 100644 --- a/modules/statistics/php/statistics_site.class.inc +++ b/modules/statistics/php/statistics_site.class.inc @@ -40,6 +40,7 @@ class Statistics_Site extends \NDB_Menu */ function _hasAccess(\User $user) : bool { +<<<<<<< ff9cfba5feee88a24470e463aef0117915aff1a4 //TODO: Create a permission specific to statistics $hasAccessToAllProfiles = $user->hasAllPermissions( [ @@ -86,6 +87,15 @@ class Statistics_Site extends \NDB_Menu } return $hasAccessToAllProfiles || $hasCenterPermission; +<<<<<<< ab9b95f084e392fe6cfca355aeeddf073af79caf +======= + +======= + //TODO: To create a permission specific to statistics + return( $user->hasPermission('access_all_profiles') + || $user->hasPermission('data_entry')); +>>>>>>> [Statistics/Behavioural] Detailed View and Double Data Entry - Site permission fix (#6861) +>>>>>>> [Statistics/Behavioural] Detailed View and Double Data Entry - Site permission fix (#6861) } /** @@ -100,15 +110,31 @@ class Statistics_Site extends \NDB_Menu { //SITES +<<<<<<< ab9b95f084e392fe6cfca355aeeddf073af79caf + + $factory = \NDB_Factory::singleton(); + $user = $factory->user(); + +======= $factory = \NDB_Factory::singleton(); $user = $factory->user(); +>>>>>>> [Statistics/Behavioural] Detailed View and Double Data Entry - Site permission fix (#6861) if (!empty($centerID) && $user->hasCenter($centerID)) { $this->query_criteria .= " AND s.CenterID =:cid "; $this->query_vars['cid'] = $centerID; } else { +<<<<<<< ab9b95f084e392fe6cfca355aeeddf073af79caf $list_of_permitted_sites = []; +======= +<<<<<<< ff9cfba5feee88a24470e463aef0117915aff1a4 + $list_of_permitted_sites = (array) null; + $currentUser = \NDB_Factory::singleton()->user(); +======= + $list_of_permitted_sites = array(); +>>>>>>> [Statistics/Behavioural] Detailed View and Double Data Entry - Site permission fix (#6861) +>>>>>>> [Statistics/Behavioural] Detailed View and Double Data Entry - Site permission fix (#6861) if ($user->hasPermission('access_all_profiles')) { $list_of_permitted_sites = array_keys(\Utility::getSiteList()); @@ -116,9 +142,22 @@ class Statistics_Site extends \NDB_Menu $list_of_permitted_sites = array_keys($user->getStudySites()); } +<<<<<<< ab9b95f084e392fe6cfca355aeeddf073af79caf if (!empty($list_of_permitted_sites)) { $paramCenters = []; $centerIDs = []; +======= +<<<<<<< ff9cfba5feee88a24470e463aef0117915aff1a4 + $params = []; + $centerIDs = []; + foreach ($list_of_permitted_sites as $key => $siteID) { + $params[] = ":id$key"; + $centerIDs["id$key"] = $siteID; +======= + if (!empty($list_of_permitted_sites)) { + $paramCenters = array(); + $centerIDs = array(); +>>>>>>> [Statistics/Behavioural] Detailed View and Double Data Entry - Site permission fix (#6861) foreach ($list_of_permitted_sites as $key => $siteID) { $paramCenters[] = ":paramSiteID$key"; $centerIDs["paramSiteID$key"] = $siteID; @@ -130,6 +169,10 @@ class Statistics_Site extends \NDB_Menu $this->query_vars += $centerIDs; } else { $this->query_criteria .= "AND (s.CenterID IS NULL)"; +<<<<<<< ab9b95f084e392fe6cfca355aeeddf073af79caf +======= +>>>>>>> [Statistics/Behavioural] Detailed View and Double Data Entry - Site permission fix (#6861) +>>>>>>> [Statistics/Behavioural] Detailed View and Double Data Entry - Site permission fix (#6861) } } @@ -141,8 +184,13 @@ class Statistics_Site extends \NDB_Menu } else { $userProjectsIDs = $user->getData('ProjectIDs'); if (!empty($userProjectsIDs)) { +<<<<<<< ab9b95f084e392fe6cfca355aeeddf073af79caf $paramProjects = []; $projectsIDs = []; +======= + $paramProjects = array(); + $projectsIDs = array(); +>>>>>>> [Statistics/Behavioural] Detailed View and Double Data Entry - Site permission fix (#6861) foreach ($userProjectsIDs as $key => $projectID) { $paramProjects[] = ":paramProjectID$key"; $projectsIDs["paramProjectID$key"] = $projectID;