CRM-19201 - Report - Add support for reporting CiviCampaign activities.
authorBob Silvern <bobs00@cox.net>
Wed, 10 Aug 2016 00:34:15 +0000 (17:34 -0700)
committerBob Silvern <bobs00@cox.net>
Wed, 10 Aug 2016 00:34:15 +0000 (17:34 -0700)
----------------------------------------
* CRM-19201: Cannot search CiviCampaign/CiviCase activities or report CiviCampaign activities
  https://issues.civicrm.org/jira/browse/CRM-19201

CRM/Report/Form/Activity.php

index 7b06de4f37d06f850c1de3fbc0694bf34020986e..2be48c28609f8a1db8e1fd41d0ce3dbf6e49d779 100644 (file)
@@ -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;
       }
     }