$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;
}
}