From 9486be349559917e96c5cf27c321112e655970b9 Mon Sep 17 00:00:00 2001 From: eileen Date: Tue, 19 Apr 2016 21:28:10 +1200 Subject: [PATCH] Fix for test suite leakage issue, ornery test --- CRM/Contact/BAO/Group.php | 19 ++++++++++++------- tests/phpunit/CRM/Group/Page/AjaxTest.php | 1 - 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/CRM/Contact/BAO/Group.php b/CRM/Contact/BAO/Group.php index 84ca887149..075d926d70 100644 --- a/CRM/Contact/BAO/Group.php +++ b/CRM/Contact/BAO/Group.php @@ -606,15 +606,20 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group { public static function getPermissionClause($force = FALSE) { static $clause = 1; static $retrieved = FALSE; - if ((!$retrieved || $force) && !CRM_Core_Permission::check('view all contacts') && !CRM_Core_Permission::check('edit all contacts')) { - //get the allowed groups for the current user - $groups = CRM_ACL_API::group(CRM_ACL_API::VIEW); - if (!empty($groups)) { - $groupList = implode(', ', array_values($groups)); - $clause = "groups.id IN ( $groupList ) "; + if (!$retrieved || $force) { + if (CRM_Core_Permission::check('view all contacts') || CRM_Core_Permission::check('edit all contacts')) { + $clause = 1; } else { - $clause = '1 = 0'; + //get the allowed groups for the current user + $groups = CRM_ACL_API::group(CRM_ACL_API::VIEW); + if (!empty($groups)) { + $groupList = implode(', ', array_values($groups)); + $clause = "groups.id IN ( $groupList ) "; + } + else { + $clause = '1 = 0'; + } } } $retrieved = TRUE; diff --git a/tests/phpunit/CRM/Group/Page/AjaxTest.php b/tests/phpunit/CRM/Group/Page/AjaxTest.php index 24e88478ed..7db267319b 100644 --- a/tests/phpunit/CRM/Group/Page/AjaxTest.php +++ b/tests/phpunit/CRM/Group/Page/AjaxTest.php @@ -3,7 +3,6 @@ /** * Class CRM_Group_Page_AjaxTest * @group headless - * @group ornery */ class CRM_Group_Page_AjaxTest extends CiviUnitTestCase { /** -- 2.25.1