Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SearchKit - Fix running searches for anonymous users #22597

Merged
merged 2 commits into from
Jan 22, 2022

Conversation

colemanw
Copy link
Member

@colemanw colemanw commented Jan 21, 2022

Overview

Fixes SearchKit crash when displaying results to anonymous users.

Technical Details

Some internal api calls during the search Run process were incorrectly checking permissions when they shouldn't, causing errors and missing field data.

@civibot
Copy link

civibot bot commented Jan 21, 2022

(Standard links)

@civibot civibot bot added the 5.46 label Jan 21, 2022
This function checks to see if a user has access to "get",
but anonymous users might not even have access to check if they have access!
@colemanw colemanw force-pushed the searchKitEntityAccess branch from 8d337cc to ca7b044 Compare January 21, 2022 17:18
@colemanw colemanw changed the title SearchKit - Fix checkEntityAccess for anonymous users SearchKit - Fix running searches for anonymous users Jan 21, 2022
The `checkPermissions` param was previously not getting copied into
`$this->savedSearch['api_params']` which caused trouble for less-
permissioned users, esp when the Run action is trying to internally
load field metadata.
@colemanw colemanw force-pushed the searchKitEntityAccess branch from ffd5be6 to 2775280 Compare January 21, 2022 20:10
@samuelsov
Copy link
Contributor

@colemanw Seems all good to me. I did a bunch of testing. It definitely solves the original problem (i.e. won't display the results when doing a SearchKit+FormBuilder page as anonymous with ByPass permission if any join are defined).
I can't find any regressions.

The patch was tested on CiviCRM 5.44.

@seamuslee001 seamuslee001 merged commit e463176 into civicrm:5.46 Jan 22, 2022
@seamuslee001 seamuslee001 deleted the searchKitEntityAccess branch January 22, 2022 00:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants