diff --git a/campaignion_manage/campaignion_manage.module b/campaignion_manage/campaignion_manage.module index ce28db6b9..8bc1a8088 100644 --- a/campaignion_manage/campaignion_manage.module +++ b/campaignion_manage/campaignion_manage.module @@ -29,7 +29,7 @@ function campaignion_manage_menu() { $items['admin/supporters'] = array( 'title' => t('Manage Supporters'), 'type' => MENU_NORMAL_ITEM, - 'access arguments' => array('manage redhen contacts'), + 'access arguments' => array('access redhen contacts'), 'page callback' => 'campaignion_manage_supporters_page', ); return $items; diff --git a/campaignion_manage/src/BulkOp/ContentPublish.php b/campaignion_manage/src/BulkOp/ContentPublish.php index da6870589..b13d8bdd1 100644 --- a/campaignion_manage/src/BulkOp/ContentPublish.php +++ b/campaignion_manage/src/BulkOp/ContentPublish.php @@ -36,4 +36,12 @@ public function apply($nids, $values) { return $messages; } + + /** + * Check if the currently active user has access to the operation. + */ + public function userHasAccess() { + return user_access('bypass node access') || user_access('administer nodes'); + } + } diff --git a/campaignion_manage/src/BulkOp/ContentUnpublish.php b/campaignion_manage/src/BulkOp/ContentUnpublish.php index f833f0b95..d6dae82a9 100644 --- a/campaignion_manage/src/BulkOp/ContentUnpublish.php +++ b/campaignion_manage/src/BulkOp/ContentUnpublish.php @@ -38,4 +38,12 @@ public function apply($nids, $values) { return $messages; } + + /** + * Check if the currently active user has access to the operation. + */ + public function userHasAccess() { + return user_access('bypass node access') || user_access('administer nodes'); + } + } diff --git a/campaignion_manage/src/BulkOp/SupporterExport.php b/campaignion_manage/src/BulkOp/SupporterExport.php index 1342e7132..1b4947031 100644 --- a/campaignion_manage/src/BulkOp/SupporterExport.php +++ b/campaignion_manage/src/BulkOp/SupporterExport.php @@ -100,7 +100,7 @@ public function batchFinish(&$data, &$results) { * @param integer $level GZIP compression level (default: 9) * @return string New filename (with .gz appended) if success, or FALSE if operation fails */ - protected function compressFile($src_file_name, $dest_file_name = NULL, $level = 9){ + protected function compressFile($src_file_name, $dest_file_name = NULL, $level = 9){ if ($dest_file_name == NULL) { $dest_file_name = $src_file_name . '.gz'; } @@ -114,13 +114,21 @@ protected function compressFile($src_file_name, $dest_file_name = NULL, $level = fclose($fp_in); } else { - $result = FALSE; + $result = FALSE; } - gzclose($fp_out); + gzclose($fp_out); } else { $result = FALSE; } return $result; } + + /** + * Check if the currently active user has access to the operation. + */ + public function userHasAccess() { + return user_access('administer redhen contacts') || user_access('manage redhen contacts') || user_access('access redhen contacts'); + } + } diff --git a/campaignion_manage/src/BulkOp/SupporterNewsletter.php b/campaignion_manage/src/BulkOp/SupporterNewsletter.php index b0bcd4368..15c65823e 100644 --- a/campaignion_manage/src/BulkOp/SupporterNewsletter.php +++ b/campaignion_manage/src/BulkOp/SupporterNewsletter.php @@ -46,4 +46,12 @@ public function getBatch(&$data) { } public function batchFinish(&$data, &$results) {} + + /** + * Check if the currently active user has access to the operation. + */ + public function userHasAccess() { + return user_access('administer redhen contacts') || user_access('manage redhen contacts'); + } + } diff --git a/campaignion_manage/src/BulkOp/SupporterTag.php b/campaignion_manage/src/BulkOp/SupporterTag.php index 390df6256..c7ca6318a 100644 --- a/campaignion_manage/src/BulkOp/SupporterTag.php +++ b/campaignion_manage/src/BulkOp/SupporterTag.php @@ -96,4 +96,12 @@ public function batchFinish(&$data, &$results) { } } } + + /** + * Check if the currently active user has access to the operation. + */ + public function userHasAccess() { + return user_access('administer redhen contacts') || user_access('manage redhen contacts'); + } + } diff --git a/campaignion_manage/src/BulkOpForm.php b/campaignion_manage/src/BulkOpForm.php index 4f01e2e78..942549609 100644 --- a/campaignion_manage/src/BulkOpForm.php +++ b/campaignion_manage/src/BulkOpForm.php @@ -31,6 +31,9 @@ public function form(&$form, &$form_state) { ); foreach ($this->ops as $name => $op) { + if (!$op->userHasAccess()) { + continue; + } $form['bulk-wrapper']['operations']['#options'][$name] = $op->title(); $form['bulk-wrapper']['op-wrapper']['op'][$name] = array( '#type' => 'fieldset',