From bbfeec41209c9a7723dd93c0e84d13e9c29da1ac Mon Sep 17 00:00:00 2001 From: Brian Shaughnessy Date: Wed, 8 May 2013 23:50:39 -0400 Subject: [PATCH] CRM-12569 permission activity links and tasks more accurately --- CRM/Activity/Selector/Activity.php | 12 +++++++----- CRM/Activity/Task.php | 11 +++++++---- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/CRM/Activity/Selector/Activity.php b/CRM/Activity/Selector/Activity.php index ff5c3c3d0c..0a92ca5b71 100644 --- a/CRM/Activity/Selector/Activity.php +++ b/CRM/Activity/Selector/Activity.php @@ -209,11 +209,13 @@ class CRM_Activity_Selector_Activity extends CRM_Core_Selector_Base implements C elseif ($activityTypeName == 'Print PDF Letter') { $updateUrl = 'civicrm/activity/pdf/add'; } - $actionLinks += array(CRM_Core_Action::UPDATE => array('name' => ts('Edit'), - 'url' => $updateUrl, - 'qs' => $qsUpdate, - 'title' => ts('Update Activity'), - )); + if ( CRM_Activity_BAO_Activity::checkPermission($activityId, CRM_Core_Action::UPDATE) ) { + $actionLinks += array(CRM_Core_Action::UPDATE => array('name' => ts('Edit'), + 'url' => $updateUrl, + 'qs' => $qsUpdate, + 'title' => ts('Update Activity'), + )); + } } if ( diff --git a/CRM/Activity/Task.php b/CRM/Activity/Task.php index 09745c23d3..073cd0024a 100644 --- a/CRM/Activity/Task.php +++ b/CRM/Activity/Task.php @@ -110,10 +110,13 @@ class CRM_Activity_Task { $config = CRM_Core_Config::singleton(); if (in_array('CiviCase', $config->enableComponents)) { - self::$_tasks[6] = array('title' => ts('File on Case'), - 'class' => 'CRM_Activity_Form_Task_FileOnCase', - 'result' => FALSE, - ); + if ( CRM_Core_Permission::check('access all cases and activities') || + CRM_Core_Permission::check('access my cases and activities') ) { + self::$_tasks[6] = array('title' => ts('File on Case'), + 'class' => 'CRM_Activity_Form_Task_FileOnCase', + 'result' => FALSE, + ); + } } //CRM-4418, check for delete -- 2.25.1