Skip to content

Commit

Permalink
dev/core#4184 Fix Import over-authorization
Browse files Browse the repository at this point in the history
  • Loading branch information
eileenmcnaughton committed Mar 15, 2023
1 parent ff32212 commit 250b13b
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function on_hook_civicrm_post(PostEvent $event): void {
public function onApiAuthorize(AuthorizeEvent $event): void {
$apiRequest = $event->getApiRequest();
$entity = $apiRequest['entity'];
if (strpos($entity, 'Import_') === 0) {
if (strpos($entity, 'Import_') === 0 && !in_array($event->getActionName(), ['getFields', 'getActions', 'checkAccess'], TRUE)) {
$userJobID = (int) (str_replace('Import_', '', $entity));
if (!UserJob::get(TRUE)->addWhere('id', '=', $userJobID)->selectRowCount()->execute()->count()) {
throw new UnauthorizedException('Import access not permitted');
Expand Down

0 comments on commit 250b13b

Please sign in to comment.