From d3e6c71f2ca4540f52cdfc9e80179162bad30885 Mon Sep 17 00:00:00 2001 From: Bob Silvern Date: Tue, 9 Aug 2016 17:34:15 -0700 Subject: [PATCH] CRM-19201 - Report - Add support for reporting CiviCampaign activities. ---------------------------------------- * CRM-19201: Cannot search CiviCampaign/CiviCase activities or report CiviCampaign activities https://issues.civicrm.org/jira/browse/CRM-19201 --- CRM/Report/Form/Activity.php | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/CRM/Report/Form/Activity.php b/CRM/Report/Form/Activity.php index 7b06de4f37..2be48c2860 100644 --- a/CRM/Report/Form/Activity.php +++ b/CRM/Report/Form/Activity.php @@ -61,8 +61,24 @@ class CRM_Report_Form_Activity extends CRM_Report_Form { $components = CRM_Core_Component::getEnabledComponents(); foreach ($components as $componentName => $componentInfo) { - $permission = sprintf("access %s", $componentName == 'CiviCase' ? "all cases and activities" : $componentName); - if (CRM_Core_Permission::check($permission)) { + // CRM-19201: Add support for reporting CiviCampaign activities + // "access all cases and activities" is used here rather than "access my + // cases and activities" to prevent those with only the later permission + // from seeing a list of all cases which might present a privacy issue. + switch ($componentName) { + case 'CiviCase': + $perm = "access all cases and activities"; + break; + + case 'CiviCampaign': + $perm = "administer $componentName"; + break; + + default: + $perm = "access $componentName"; + break; + } + if (CRM_Core_Permission::check($perm)) { $accessAllowed[] = $componentInfo->componentID; } } -- 2.25.1