Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRM-20430 - Permission 'save Report Criteria'. #12107

Merged
merged 1 commit into from
Jun 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CRM/Core/Permission.php
Original file line number Diff line number Diff line change
Expand Up @@ -1470,6 +1470,9 @@ public static function getEntityActionPermissions() {
'create' => array('edit message templates', 'edit user-driven message templates', 'edit system workflow message templates'),
'update' => array('edit message templates', 'edit user-driven message templates', 'edit system workflow message templates'),
);

$permissions['report_template']['update'] = 'save Report Criteria';
$permissions['report_template']['create'] = 'save Report Criteria';
return $permissions;
}

Expand Down
33 changes: 22 additions & 11 deletions CRM/Report/BAO/ReportInstance.php
Original file line number Diff line number Diff line change
Expand Up @@ -364,24 +364,35 @@ public static function doFormDelete($instanceId, $bounceTo = 'civicrm/report/lis
* - general script-add.
*/
public static function getActionMetadata() {
$actions = array(
'report_instance.save' => array('title' => ts('Save')),
'report_instance.copy' => array(
$actions = array();
if (CRM_Core_Permission::check('save Report Criteria')) {
$actions['report_instance.save'] = array('title' => ts('Save'));
$actions['report_instance.copy'] = array(
'title' => ts('Save a Copy'),
'data' => array(
'is_confirm' => TRUE,
'confirm_title' => ts('Save a copy...'),
'confirm_refresh_fields' => json_encode(array(
'title' => array('selector' => '.crm-report-instanceForm-form-block-title', 'prepend' => ts('(Copy) ')),
'description' => array('selector' => '.crm-report-instanceForm-form-block-description', 'prepend' => ''),
'parent_id' => array('selector' => '.crm-report-instanceForm-form-block-parent_id', 'prepend' => ''),
'title' => array(
'selector' => '.crm-report-instanceForm-form-block-title',
'prepend' => ts('(Copy) '),
),
'description' => array(
'selector' => '.crm-report-instanceForm-form-block-description',
'prepend' => '',
),
'parent_id' => array(
'selector' => '.crm-report-instanceForm-form-block-parent_id',
'prepend' => '',
),
)),
),
),
'report_instance.print' => array('title' => ts('Print Report')),
'report_instance.pdf' => array('title' => ts('Print to PDF')),
'report_instance.csv' => array('title' => ts('Export as CSV')),
);
);
}
$actions['report_instance.print'] = array('title' => ts('Print Report'));
$actions['report_instance.pdf'] = array('title' => ts('Print to PDF'));
$actions['report_instance.csv'] = array('title' => ts('Export as CSV'));

if (CRM_Core_Permission::check('administer Reports')) {
$actions['report_instance.delete'] = array(
'title' => ts('Delete report'),
Expand Down
4 changes: 4 additions & 0 deletions CRM/Report/Info.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ public function getPermissions($getAllUnconditionally = FALSE, $descriptions = F
ts('access Report Criteria'),
ts('Change report search criteria'),
),
'save Report Criteria' => array(
ts('save Report Criteria'),
ts('Save report search criteria'),
),
'administer private reports' => array(
ts('administer private reports'),
ts('Edit all private reports'),
Expand Down
1 change: 1 addition & 0 deletions CRM/Upgrade/Incremental/php/FiveFour.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public function setPreUpgradeMessage(&$preUpgradeMessage, $rev, $currentVer = NU
* an intermediate version; note that setPostUpgradeMessage is called repeatedly with different $revs.
*/
public function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
$postUpgradeMessage .= '<p>' . ts('A new %1 permission has been added. It is not granted by default. If your users create reports, you may wish to review your permissions.', array(1 => 'save Report Criteria')) . '</p>';
// Example: Generate a post-upgrade message.
// if ($rev == '5.12.34') {
// $postUpgradeMessage .= '<br /><br />' . ts("By default, CiviCRM now disables the ability to import directly from SQL. To use this feature, you must explicitly grant permission 'import SQL datasource'.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ function civicrm_webtest_enable() {
'access deleted contacts',
// 'access my cases and activities',
'access Report Criteria',
'save Report Criteria',
'access uploaded files',
// 'add cases',
'add contacts',
Expand Down