CRM-15854 - CiviMail workflow, old UI - Consistent interpretation of 'access CiviMail'
authorTim Otten <totten@civicrm.org>
Tue, 3 Mar 2015 02:06:01 +0000 (18:06 -0800)
committerTim Otten <totten@civicrm.org>
Tue, 3 Mar 2015 03:56:32 +0000 (19:56 -0800)
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.

CRM/Mailing/Form/Approve.php
CRM/Mailing/Form/Schedule.php
CRM/Mailing/Page/View.php
CRM/Mailing/StateMachine/Send.php
CRM/Mailing/xml/Menu/Mailing.xml

index 684cee77dc628d6934217d64cd405d039c98f2f2..0100b728f1e917c0f4244948b232c45347211766 100644 (file)
@@ -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();
       }
     }
index 2635ff21fc4d9dd8860c65b73b865749ae6e4401..3bb4dec0140339faeaf631d33062489279f5592a 100644 (file)
@@ -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);
index d6e0b9d5c2663e7a69f9b9b0195974545889ff4e..328f26cebe161cfa670beb2403f8b8572f0c6819 100644 (file)
@@ -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;
index 2fbbfd767712c35aa017198808ddfd53ccf15e1e..47cf26b66854e2bb75f9a8514496482f36fb0748 100644 (file)
@@ -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;
       }
     }
index f5cc3c166450e881bddd660901290005797afe0b..6b62c7de2f7e631043b382de53e0b294f39def38 100644 (file)
     <path>civicrm/mailing/schedule</path>
     <title>Schedule Mailing</title>
     <page_callback>CRM_Mailing_Form_Schedule</page_callback>
-    <access_arguments>schedule mailings</access_arguments>
+    <access_arguments>access CiviMail;schedule mailings</access_arguments>
     <weight>700</weight>
   </item>
   <item>
     <path>civicrm/mailing/approve</path>
     <title>Approve Mailing</title>
     <page_callback>CRM_Mailing_Form_Approve</page_callback>
-    <access_arguments>approve mailings</access_arguments>
+    <access_arguments>access CiviMail;approve mailings</access_arguments>
     <weight>850</weight>
   </item>
   <item>