Skip to content
Snippets Groups Projects
Commit 634e1a1a authored by lobo's avatar lobo
Browse files

CRM-12197 - add skip IDS check permission

----------------------------------------
* CRM-12197: Overactive IDS causes test failure
  http://issues.civicrm.org/jira/browse/CRM-12197
parent a35e3e11
No related branches found
No related tags found
No related merge requests found
......@@ -67,10 +67,6 @@ class CRM_Core_Config_Defaults {
//$this->revampPages = array( 'CRM/Admin/Form/Setting/Url.tpl', 'CRM/Admin/Form/Preferences/Address.tpl' );
$this->revampPages = array();
// IDS enablement
$this->useIDS = defined('CIVICRM_IDS_ENABLE') ? (bool) CIVICRM_IDS_ENABLE : TRUE;
//
$size = trim(ini_get('upload_max_filesize'));
if ($size) {
$last = strtolower($size{strlen($size) - 1});
......
......@@ -89,9 +89,24 @@ Class CRM_Core_Form_Date {
* @access public
*/
static function buildDateRange(&$form, $fieldName, $count = 1, $from = '_from', $to = '_to', $fromLabel = 'From:', $required = FALSE, $operators = array(), $dateFormat = 'searchDate', $displayTime = FALSE) {
$selector = CRM_Core_Form_Date::returnDateRangeSelector($form, $fieldName, $count, $from, $to, $fromLabel, $required, $operators, $dateFormat, $displayTime);
CRM_Core_Form_Date::addDateRangeToForm($form, $fieldName, $selector, $from, $to, $fromLabel, $required , $dateFormat, $displayTime);
static function buildDateRange(
&$form, $fieldName, $count = 1,
$from = '_from', $to = '_to', $fromLabel = 'From:',
$required = FALSE, $operators = array(),
$dateFormat = 'searchDate', $displayTime = FALSE
) {
$selector =
CRM_Core_Form_Date::returnDateRangeSelector(
$form, $fieldName, $count,
$from, $to, $fromLabel,
$required, $operators,
$dateFormat, $displayTime
);
CRM_Core_Form_Date::addDateRangeToForm(
$form, $fieldName, $selector,
$from, $to, $fromLabel,
$required, $dateFormat, $displayTime
);
}
/**
......@@ -110,47 +125,54 @@ Class CRM_Core_Form_Date {
* @param Boolean $displayTime
* @return array Values for Selector
*/
static function returnDateRangeSelector(&$form, $fieldName, $count = 1, $from = '_from', $to = '_to', $fromLabel = 'From:', $required = FALSE, $operators = array(), $dateFormat = 'searchDate', $displayTime = FALSE) {
$selector = array('' => ts('- any -'),
0 => ts('Choose Date Range'),
'this.year' => ts('This Year'),
'this.fiscal_year' => ts('This Fiscal Year'),
'this.quarter' => ts('This Quarter'),
'this.month' => ts('This Month'),
'this.week' => ts('This Week'),
'this.day' => ts('This Day'),
'previous.year' => ts('Previous Year'),
'previous.fiscal_year' => ts('Previous Fiscal Year'),
'previous.quarter' => ts('Previous Quarter'),
'previous.month' => ts('Previous Month'),
'previous.week' => ts('Previous Week'),
'previous.day' => ts('Previous Day'),
'previous_before.year' => ts('Prior to Previous Year'),
'previous_before.quarter' => ts('Prior to Previous Quarter'),
'previous_before.month' => ts('Prior to Previous Month'),
'previous_before.week' => ts('Prior to Previous Week'),
'previous_before.day' => ts('Prior to Previous Day'),
'previous_2.year' => ts('Previous 2 Years'),
'previous_2.quarter' => ts('Previous 2 Quarters'),
'previous_2.month' => ts('Previous 2 Months'),
'previous_2.week' => ts('Previous 2 Weeks'),
'previous_2.day' => ts('Previous 2 Days'),
'earlier.year' => ts('To End of Prior Year'),
'earlier.quarter' => ts('To End of Prior Quarter'),
'earlier.month' => ts('To End of Prior Month'),
'earlier.week' => ts('To End of Prior Week'),
'earlier.day' => ts('To End of Prior Day'),
'greater.year' => ts('Current Year to-date'),
'greater.quarter' => ts('Current Quarter to-date'),
'greater.month' => ts('Current Month to-date'),
'greater.week' => ts('Current Week to-date'),
'greater.day' => ts('Current Day'),
'ending.year' => ts('From 12 Months Ago'),
'ending.quarter' => ts('From 3 Months Ago'),
'ending.month' => ts('From 1 Month Ago'),
'ending.week' => ts('From 1 Week Ago'),
);
$selector += $operators;
static function returnDateRangeSelector(
&$form, $fieldName, $count = 1,
$from = '_from', $to = '_to', $fromLabel = 'From:',
$required = FALSE, $operators = array(),
$dateFormat = 'searchDate', $displayTime = FALSE
) {
$selector =
array(
'' => ts('- any -'),
0 => ts('Choose Date Range'),
'this.year' => ts('This Year'),
'this.fiscal_year' => ts('This Fiscal Year'),
'this.quarter' => ts('This Quarter'),
'this.month' => ts('This Month'),
'this.week' => ts('This Week'),
'this.day' => ts('This Day'),
'previous.year' => ts('Previous Year'),
'previous.fiscal_year' => ts('Previous Fiscal Year'),
'previous.quarter' => ts('Previous Quarter'),
'previous.month' => ts('Previous Month'),
'previous.week' => ts('Previous Week'),
'previous.day' => ts('Previous Day'),
'previous_before.year' => ts('Prior to Previous Year'),
'previous_before.quarter' => ts('Prior to Previous Quarter'),
'previous_before.month' => ts('Prior to Previous Month'),
'previous_before.week' => ts('Prior to Previous Week'),
'previous_before.day' => ts('Prior to Previous Day'),
'previous_2.year' => ts('Previous 2 Years'),
'previous_2.quarter' => ts('Previous 2 Quarters'),
'previous_2.month' => ts('Previous 2 Months'),
'previous_2.week' => ts('Previous 2 Weeks'),
'previous_2.day' => ts('Previous 2 Days'),
'earlier.year' => ts('To End of Prior Year'),
'earlier.quarter' => ts('To End of Prior Quarter'),
'earlier.month' => ts('To End of Prior Month'),
'earlier.week' => ts('To End of Prior Week'),
'earlier.day' => ts('To End of Prior Day'),
'greater.year' => ts('Current Year to-date'),
'greater.quarter' => ts('Current Quarter to-date'),
'greater.month' => ts('Current Month to-date'),
'greater.week' => ts('Current Week to-date'),
'greater.day' => ts('Current Day'),
'ending.year' => ts('From 12 Months Ago'),
'ending.quarter' => ts('From 3 Months Ago'),
'ending.month' => ts('From 1 Month Ago'),
'ending.week' => ts('From 1 Week Ago'),
);
$selector = array_merge($selector, $operators);
$config = CRM_Core_Config::singleton();
//if fiscal year start on 1 jan then remove fiscal year task
......
......@@ -119,7 +119,7 @@ class CRM_Core_Invoke {
static public function init($args) {
// first fire up IDS and check for bad stuff
$config = CRM_Core_Config::singleton();
if ($config->useIDS) {
if (!CRM_Core_Permission::check('skip IDS check')) {
$ids = new CRM_Core_IDS();
$ids->check($args);
}
......
......@@ -148,7 +148,8 @@ class CRM_Core_Permission {
return TRUE;
}
if (self::check('administer Multiple Organizations') &&
if (
self::check('administer Multiple Organizations') &&
self::isMultisiteEnabled()
) {
return TRUE;
......@@ -451,6 +452,7 @@ class CRM_Core_Permission {
'import contacts' => $prefix . ts('import contacts'),
'edit groups' => $prefix . ts('edit groups'),
'administer CiviCRM' => $prefix . ts('administer CiviCRM'),
'skip IDS check' => $prefix . ts('skip IDS check'),
'access uploaded files' => $prefix . ts('access uploaded files'),
'profile listings and forms' => $prefix . ts('profile listings and forms'),
'profile listings' => $prefix . ts('profile listings'),
......
......@@ -59,10 +59,16 @@ class CRM_Upgrade_Incremental_php_FourFour {
* @return void
*/
function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
if ($rev == '4.4.alpha1') {
$config = CRM_Core_Config::singleton();
if (!empty($config->useIDS)) {
$postUpgradeMessage .= '<br />' . ts("The setting to skip IDS check has been deprecated. Please use the permission 'skip IDS check' to bypass the IDS system");
}
}
}
function upgrade_4_4_alpha1($rev) {
// task to process sql
// task to process sql
$this->addTask(ts('Upgrade DB to 4.4.alpha1: SQL'), 'task_4_4_x_runSql', $rev);
// Consolidate activity contacts CRM-12274.
......@@ -83,12 +89,12 @@ class CRM_Upgrade_Incremental_php_FourFour {
$ovValue[] = $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
$ovValue[] = $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
$ovValue[] = $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
$optionGroupID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'activity_contacts', 'id', 'name');
if (!empty($ovValue)) {
$ovValues = implode(', ', $ovValue);
$query = "
UPDATE civicrm_option_value
UPDATE civicrm_option_value
SET is_reserved = 1
WHERE option_group_id = {$optionGroupID} AND value IN ($ovValues)";
......@@ -109,7 +115,7 @@ WHERE option_group_id = {$optionGroupID} AND value IN ($ovValues)";
}
if (!$assigneeID || !$sourceID || !$targetID ) {
$insert = "
$insert = "
INSERT INTO civicrm_option_value
(option_group_id, label, value, name, weight, is_reserved, is_active)
VALUES
......@@ -134,24 +140,24 @@ CREATE TABLE IF NOT EXISTS civicrm_activity_contact (
";
$dao = CRM_Core_DAO::executeQuery($query);
$query = "
$query = "
INSERT INTO civicrm_activity_contact (activity_id, contact_id, record_type_id)
SELECT activity_id, target_contact_id, {$targetID} as record_type_id
FROM civicrm_activity_target";
$dao = CRM_Core_DAO::executeQuery($query);
$query = "
$query = "
INSERT INTO civicrm_activity_contact (activity_id, contact_id, record_type_id)
SELECT activity_id, assignee_contact_id, {$assigneeID} as record_type_id
FROM civicrm_activity_assignment";
$dao = CRM_Core_DAO::executeQuery($query);
$query = "
INSERT INTO civicrm_activity_contact (activity_id, contact_id, record_type_id)
SELECT id, source_contact_id, {$sourceID} as record_type_id
FROM civicrm_activity
FROM civicrm_activity
WHERE source_contact_id IS NOT NULL";
$dao = CRM_Core_DAO::executeQuery($query);
......@@ -162,9 +168,9 @@ WHERE source_contact_id IS NOT NULL";
$query = "DROP TABLE civicrm_activity_assignment";
$dao = CRM_Core_DAO::executeQuery($query);
$query = "ALTER TABLE civicrm_activity
$query = "ALTER TABLE civicrm_activity
DROP FOREIGN KEY FK_civicrm_activity_source_contact_id";
$dao = CRM_Core_DAO::executeQuery($query);
$query = "ALTER TABLE civicrm_activity DROP COLUMN source_contact_id";
......
......@@ -170,11 +170,6 @@ define( 'CIVICRM_UF_BASEURL' , '%%baseURL%%' );
*/
define( 'CIVICRM_SITE_KEY', '%%siteKey%%' );
/*
* If you want to disable IDS, set this to 0.
*/
define( 'CIVICRM_IDS_ENABLE', 1);
/**
* Enable this constant, if you want to send your email through the smarty
* templating engine(allows you to do conditional and more complex logic)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment