$components = CRM_Core_Component::getNames();
$componentClause = array();
foreach ($components as $componentID => $componentName) {
- if (!CRM_Core_Permission::check("access $componentName")) {
+ // CRM-19201: Add support for searching CiviCampaign and CiviCase
+ // activities.
+ // "access all cases and activities" is used here rather than
+ // "access my cases and activities" to prevent those with only the later
+ // permission to see 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)) {
$componentClause[] = " (activity_type.component_id IS NULL OR activity_type.component_id <> {$componentID}) ";
}
}