Merge pull request #15188 from eileenmcnaughton/dedupe12
authorSeamus Lee <seamuslee001@gmail.com>
Thu, 5 Sep 2019 21:47:01 +0000 (07:47 +1000)
committerGitHub <noreply@github.com>
Thu, 5 Sep 2019 21:47:01 +0000 (07:47 +1000)
dev/core#1230 Dedupe permissions - allow safe mode merging based on 'merge duplicate contacts'

1  2 
CRM/Dedupe/Merger.php

index 9e22a66feca07f210c1f1c489fcf4ff8b6d6505e,003239ff58706b6f71c080a459280c1c41a3422d..2e5d26cde7e2a3406a83930eec5c683e81297d70
@@@ -701,9 -696,11 +701,11 @@@ INNER JOIN  civicrm_membership membersh
     * @throws \CRM_Core_Exception
     * @throws \CiviCRM_API3_Exception
     */
 -  public static function batchMerge($rgid, $gid = NULL, $mode = 'safe', $batchLimit = 1, $isSelected = 2, $criteria = [], $checkPermissions = TRUE, $reloadCacheIfEmpty = NULL) {
 +  public static function batchMerge($rgid, $gid = NULL, $mode = 'safe', $batchLimit = 1, $isSelected = 2, $criteria = [], $checkPermissions = TRUE, $reloadCacheIfEmpty = NULL, $searchLimit = 0) {
      $redirectForPerformance = ($batchLimit > 1) ? TRUE : FALSE;
+     if ($mode === 'aggressive' && $checkPermissions && !CRM_Core_Permission::check('force merge duplicate contacts')) {
+       throw new CRM_Core_Exception(ts('Insufficient permissions for aggressive mode batch merge'));
+     }
      if (!isset($reloadCacheIfEmpty)) {
        $reloadCacheIfEmpty = (!$redirectForPerformance && $isSelected == 2);
      }