No groups displayed on Manage Groups when "All Groups" is selected
Given a user who:
- Doesn't have "View All Contacts" permission;
- DOES have an ACL that gives permission to Edit "All Groups";
The "Manage Groups" screen shows no groups. However, a Group.get
API call works correctly.
This is because CRM_ACL_BAO_ACL::group()
expects an argument $allGroups
to be passed, with an array of all the groups for this particular context. The API code path populates this argument; the UI code path doesn't. Here are call stacks for each. I've marked where they converge with **
:
UI call stack
CRM/ACL/BAO/ACL.php.CRM_ACL_BAO_ACL::group:895
** CRM/ACL/API.php.CRM_ACL_API::group:179
CRM/Contact/BAO/Group.php.CRM_Contact_BAO_Group::getPermissionClause:603
CRM/Contact/BAO/Group.php.CRM_Contact_BAO_Group::whereClause:1249
CRM/Contact/BAO/Group.php.CRM_Contact_BAO_Group::getGroupList:826
CRM/Contact/BAO/Group.php.CRM_Contact_BAO_Group::getGroupListSelector:747
CRM/Group/Page/AJAX.php.CRM_Group_Page_AJAX::getGroupList:67
CRM/Core/Invoke.php.CRM_Core_Invoke::runItem:275
CRM/Core/Invoke.php.CRM_Core_Invoke::_invoke:84
CRM/Core/Invoke.php.CRM_Core_Invoke::invoke:52
drupal/civicrm.module.civicrm_invoke:445
/home/jon/local/groundswell/htdocs/includes/menu.inc.menu_execute_active_handler:527
/home/jon/local/groundswell/htdocs/index.php.{main}:21:
API code path
CRM/ACL/BAO/ACL.php.CRM_ACL_BAO_ACL::group:895
** CRM/ACL/API.php.CRM_ACL_API::group:179
CRM/ACL/API.php.CRM_ACL_API::groupPermission:215
CRM/Contact/BAO/Group.php.CRM_Contact_BAO_Group::checkPermission:312
api/v3/Group.php.civicrm_api3_group_get:82
Civi/API/Provider/MagicFunctionProvider.php.Civi\API\Provider\MagicFunctionProvider->invoke:89
Civi/API/Kernel.php.Civi\API\Kernel->runRequest:169
Civi/API/Kernel.php.Civi\API\Kernel->runSafe:100
api/api.php.civicrm_api:23
CRM/Utils/REST.php.CRM_Utils_REST::process:311
CRM/Utils/REST.php.CRM_Utils_REST::ajax:548
CRM/Core/Invoke.php.CRM_Core_Invoke::runItem:275
CRM/Core/Invoke.php.CRM_Core_Invoke::_invoke:84
CRM/Core/Invoke.php.CRM_Core_Invoke::invoke:52
drupal/civicrm.module.civicrm_invoke:445
/home/jon/local/groundswell/htdocs/includes/menu.inc.menu_execute_active_handler:527
/home/jon/local/groundswell/htdocs/index.php.{main}:21
I have a PR to submit, but I'm not sure if my fix is at the correct layer of the call stack.