*
* @param string $tableName
* @param array|null $allGroups
- * @param array|null $includedGroups
+ * @param array $includedGroups
*
* @return array
* the ids of the groups for which the user has permissions
$contactID = NULL,
$tableName = 'civicrm_saved_search',
$allGroups = NULL,
- $includedGroups = NULL
+ $includedGroups = []
) {
+ if (!is_array($includedGroups)) {
+ CRM_Core_Error::deprecatedWarning('pass an array for included groups');
+ $includedGroups = (array) $includedGroups;
+ }
if ($contactID == NULL) {
$contactID = CRM_Core_Session::getLoggedInContactID();
}
* @param int $contactID
* @param string $tableName
* @param array|null $allGroups
- * @param array|null $includedGroups
+ * @param array $includedGroups
*
* @return array
*/
$contactID = NULL,
$tableName = 'civicrm_saved_search',
$allGroups = NULL,
- $includedGroups = NULL
+ $includedGroups = []
) {
- $userCacheKey = "{$contactID}_{$type}_{$tableName}_" . CRM_Core_Config::domainID() . '_' . md5(implode(',', array_merge((array) $allGroups, (array) $includedGroups)));
+ if (!is_array($includedGroups)) {
+ CRM_Core_Error::deprecatedWarning('pass an array for included groups');
+ $includedGroups = (array) $includedGroups;
+ }
+ $userCacheKey = "{$contactID}_{$type}_{$tableName}_" . CRM_Core_Config::domainID() . '_' . md5(implode(',', array_merge((array) $allGroups, $includedGroups)));
if (empty(Civi::$statics[__CLASS__]['permissioned_groups'])) {
Civi::$statics[__CLASS__]['permissioned_groups'] = [];
}
}
}
- if (empty($ids) && !empty($includedGroups) &&
- is_array($includedGroups)
- ) {
+ if (empty($ids) && !empty($includedGroups)) {
// This is pretty alarming - we 'sometimes' include all included groups
// seems problematic per https://lab.civicrm.org/dev/core/-/issues/1879
$ids = $includedGroups;
// and addCustomDataToColumns() will allow access to all custom groups.
$permCustomGroupIds = [];
if (!CRM_Core_Permission::check('access all custom data')) {
- $permCustomGroupIds = CRM_ACL_API::group(CRM_Core_Permission::VIEW, NULL, 'civicrm_custom_group', $allGroups, NULL);
+ $permCustomGroupIds = CRM_ACL_API::group(CRM_Core_Permission::VIEW, NULL, 'civicrm_custom_group', $allGroups);
// do not allow custom data for reports if user doesn't have
// permission to access custom data.
if (!empty($this->_customGroupExtends) && empty($permCustomGroupIds)) {