From: Tim Otten Date: Tue, 3 Mar 2015 02:06:01 +0000 (-0800) Subject: CRM-15854 - CiviMail workflow, old UI - Consistent interpretation of 'access CiviMail' X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=cb7b73f07667c97923cf922b4edd483797b2a590;p=civicrm-core.git CRM-15854 - CiviMail workflow, old UI - Consistent interpretation of 'access CiviMail' There are inconstencies in how permissions are interpreted: 1. Some parts of the UI treat 'access CiviMail' as an overarching permission (which implies create+schedule+approve mailings) and treat create+schedule+approve as standalone permissions. 2. Other parts treat 'access CiviMail' as a pre-requisite for create+schedule+approve. This revision updates various legacy UI's to consistently use the first approach. --- diff --git a/CRM/Mailing/Form/Approve.php b/CRM/Mailing/Form/Approve.php index 684cee77dc..0100b728f1 100644 --- a/CRM/Mailing/Form/Approve.php +++ b/CRM/Mailing/Form/Approve.php @@ -50,7 +50,7 @@ class CRM_Mailing_Form_Approve extends CRM_Core_Form { */ public function preProcess() { if (CRM_Mailing_Info::workflowEnabled()) { - if (!CRM_Core_Permission::check('approve mailings')) { + if (!CRM_Core_Permission::check('approve mailings') && !CRM_Core_Permission::check('access CiviMail')) { $this->redirectToListing(); } } diff --git a/CRM/Mailing/Form/Schedule.php b/CRM/Mailing/Form/Schedule.php index 2635ff21fc..3bb4dec014 100644 --- a/CRM/Mailing/Form/Schedule.php +++ b/CRM/Mailing/Form/Schedule.php @@ -45,7 +45,8 @@ class CRM_Mailing_Form_Schedule extends CRM_Core_Form { */ public function preProcess() { if (CRM_Mailing_Info::workflowEnabled() && - !CRM_Core_Permission::check('schedule mailings') + !CRM_Core_Permission::check('schedule mailings') && + !CRM_Core_Permission::check('access CiviMail') ) { $url = CRM_Utils_System::url('civicrm/mailing/browse/unscheduled', 'reset=1&scheduled=false'); CRM_Utils_System::redirect($url); diff --git a/CRM/Mailing/Page/View.php b/CRM/Mailing/Page/View.php index d6e0b9d5c2..328f26cebe 100644 --- a/CRM/Mailing/Page/View.php +++ b/CRM/Mailing/Page/View.php @@ -62,6 +62,7 @@ class CRM_Mailing_Page_View extends CRM_Core_Page { // if user is an admin, return true if (CRM_Core_Permission::check('administer CiviCRM') || + CRM_Core_Permission::check('approve mailings') || CRM_Core_Permission::check('access CiviMail') ) { return TRUE; diff --git a/CRM/Mailing/StateMachine/Send.php b/CRM/Mailing/StateMachine/Send.php index 2fbbfd7677..47cf26b668 100644 --- a/CRM/Mailing/StateMachine/Send.php +++ b/CRM/Mailing/StateMachine/Send.php @@ -58,11 +58,11 @@ class CRM_Mailing_StateMachine_Send extends CRM_Core_StateMachine { ); if (CRM_Mailing_Info::workflowEnabled()) { - if (CRM_Core_Permission::check('schedule mailings')) { + if (CRM_Core_Permission::check('schedule mailings') || CRM_Core_Permission::check('access CiviMail')) { $this->_pages['CRM_Mailing_Form_Schedule'] = NULL; } - if (CRM_Core_Permission::check('approve mailings')) { + if (CRM_Core_Permission::check('approve mailings') || CRM_Core_Permission::check('access CiviMail')) { $this->_pages['CRM_Mailing_Form_Approve'] = NULL; } } diff --git a/CRM/Mailing/xml/Menu/Mailing.xml b/CRM/Mailing/xml/Menu/Mailing.xml index f5cc3c1664..6b62c7de2f 100644 --- a/CRM/Mailing/xml/Menu/Mailing.xml +++ b/CRM/Mailing/xml/Menu/Mailing.xml @@ -186,7 +186,7 @@ civicrm/mailing/schedule Schedule Mailing CRM_Mailing_Form_Schedule - schedule mailings + access CiviMail;schedule mailings 700 @@ -201,7 +201,7 @@ civicrm/mailing/approve Approve Mailing CRM_Mailing_Form_Approve - approve mailings + access CiviMail;approve mailings 850