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

COMCL-409: Remove unnecessary API 4 backend permission checks #127

Merged
merged 1 commit into from
Nov 28, 2023

Conversation

omarabuhussein
Copy link
Member

@omarabuhussein omarabuhussein commented Nov 27, 2023

Overview

When an anonymous user tries to submit a contribution page configured with GoCardless, an error saying "Authorization Failed" is thrown. This issue is fixed with this PR.

Technical details

The that shows up in the logs is the following:

-- | -- | --
  |   | 2023-11-27 15:53:49.944 | /var/www/default/htdocs/httpdocs/index.php:21 { …} |  
  |   | 2023-11-27 15:53:49.944 | /var/www/default/htdocs/httpdocs/includes/menu.inc:527 { …} |  
  |   | 2023-11-27 15:53:49.944 | /var/www/default/htdocs/httpdocs/profiles/compuclient/modules/contrib/civicrm/drupal/civicrm.module:471 { …} |  
  |   | 2023-11-27 15:53:49.944 | /var/www/default/htdocs/httpdocs/profiles/compuclient/modules/contrib/civicrm/CRM/Core/Invoke.php:36 { …} |  
  |   | 2023-11-27 15:53:49.944 | /var/www/default/htdocs/httpdocs/profiles/compuclient/modules/contrib/civicrm/CRM/Core/Invoke.php:69 { …} |  
  |   | 2023-11-27 15:53:49.944 | /var/www/default/htdocs/httpdocs/profiles/compuclient/modules/contrib/civicrm/CRM/Core/Invoke.php:319 { …} |  
  |   | 2023-11-27 15:53:49.944 | /var/www/default/htdocs/httpdocs/profiles/compuclient/modules/contrib/civicrm/CRM/Core/Controller.php:355 { …} |  
  |   | 2023-11-27 15:53:49.944 | /var/www/default/htdocs/httpdocs/profiles/compuclient/modules/contrib/civicrm/packages/HTML/QuickForm/Page.php:103 { …} |  
  |   | 2023-11-27 15:53:49.944 | /var/www/default/htdocs/httpdocs/profiles/compuclient/modules/contrib/civicrm/packages/HTML/QuickForm/Controller.php:203 { …} |  
  |   | 2023-11-27 15:53:49.944 | /var/www/default/htdocs/httpdocs/profiles/compuclient/modules/contrib/civicrm/CRM/Core/QuickForm/Action/Next.php:43 { …} |  
  |   | 2023-11-27 15:53:49.944 | /var/www/default/htdocs/httpdocs/profiles/compuclient/modules/contrib/civicrm/CRM/Core/StateMachine.php:144 { …} |  
  |   | 2023-11-27 15:53:49.944 | /var/www/default/htdocs/httpdocs/profiles/compuclient/modules/contrib/civicrm/CRM/Core/Form.php:573 { …} |  
  |   | 2023-11-27 15:53:49.944 | /var/www/default/htdocs/httpdocs/profiles/compuclient/modules/contrib/civicrm/CRM/Contribute/Form/Contribution/Confirm.php:854 { …} |  
  |   | 2023-11-27 15:53:49.944 | /var/www/default/htdocs/httpdocs/profiles/compuclient/modules/contrib/civicrm/CRM/Contribute/Form/Contribution/Confirm.php:2394 { …} |  
  |   | 2023-11-27 15:53:49.944 | /var/www/default/htdocs/httpdocs/profiles/compuclient/modules/contrib/civicrm/CRM/Contribute/Form/Contribution/Confirm.php:2753 { …} |  
  |   | 2023-11-27 15:53:49.944 | /var/www/default/htdocs/httpdocs/profiles/compuclient/modules/contrib/civicrm/CRM/Contribute/Form/Contribution/Confirm.php:1102 { …} |  
  |   | 2023-11-27 15:53:49.944 | /var/www/default/htdocs/httpdocs/profiles/compuclient/modules/contrib/civicrm/CRM/Contribute/BAO/Contribution.php:239 { …} |  
  |   | 2023-11-27 15:53:49.944 | /var/www/default/htdocs/httpdocs/profiles/compuclient/modules/contrib/civicrm/CRM/Utils/Hook.php:366 { …} |  
  |   | 2023-11-27 15:53:49.944 | /var/www/default/htdocs/httpdocs/profiles/compuclient/modules/contrib/civicrm/Civi/Core/CiviEventDispatcher.php:209 { …} |  
  |   | 2023-11-27 15:53:49.944 | /var/www/default/htdocs/httpdocs/profiles/compuclient/modules/contrib/civicrm/vendor/symfony/event-dispatcher/EventDispatcher.php:44 { …} |  
  |   | 2023-11-27 15:53:49.944 | /var/www/default/htdocs/httpdocs/profiles/compuclient/modules/contrib/civicrm/vendor/symfony/event-dispatcher/EventDispatcher.php:214 { …} |  
  |   | 2023-11-27 15:53:49.944 | /var/www/default/htdocs/httpdocs/profiles/compuclient/modules/contrib/civicrm/Civi/Core/CiviEventDispatcher.php:260 { …} |  
  |   | 2023-11-27 15:53:49.944 | /var/www/default/htdocs/httpdocs/profiles/compuclient/modules/contrib/civicrm/CRM/Utils/Hook/DrupalBase.php:73 { …} |  
  |   | 2023-11-27 15:53:49.944 | /var/www/default/htdocs/httpdocs/profiles/compuclient/modules/contrib/civicrm/CRM/Utils/Hook.php:283 { …} |  
  |   | 2023-11-27 15:53:49.944 | /var/www/default/htdocs/httpdocs/profiles/compuclient/modules/contrib/civicrm/ext/io.compuco.financeextras/financeextras.php:160 { …} |  
  |   | 2023-11-27 15:53:49.944 | /var/www/default/htdocs/httpdocs/profiles/compuclient/modules/contrib/civicrm/Civi/Core/CiviEventDispatcher.php:209 { …} |  
  |   | 2023-11-27 15:53:49.944 | /var/www/default/htdocs/httpdocs/profiles/compuclient/modules/contrib/civicrm/vendor/symfony/event-dispatcher/EventDispatcher.php:44 { …} |  
  |   | 2023-11-27 15:53:49.944 | /var/www/default/htdocs/httpdocs/profiles/compuclient/modules/contrib/civicrm/vendor/symfony/event-dispatcher/EventDispatcher.php:214 { …} |  
  |   | 2023-11-27 15:53:49.944 | /var/www/default/htdocs/httpdocs/profiles/compuclient/modules/contrib/civicrm/ext/io.compuco.financeextras/Civi/Financeextras/Event/Listener/ContributionPaymentUpdatedListener.php:12 { …} |  
  |   | 2023-11-27 15:53:49.944 | /var/www/default/htdocs/httpdocs/profiles/compuclient/modules/contrib/civicrm/ext/io.compuco.financeextras/Civi/Financeextras/Event/Listener/ContributionPaymentUpdatedListener.php:36 { …} |  
  |   | 2023-11-27 15:53:49.944 | /var/www/default/htdocs/httpdocs/profiles/compuclient/modules/contrib/civicrm/ext/io.compuco.financeextras/Civi/Financeextras/Utils/OptionValueUtils.php:27 { …} |  
  |   | 2023-11-27 15:53:49.944 | /var/www/default/htdocs/httpdocs/profiles/compuclient/modules/contrib/civicrm/Civi/Api4/Generic/AbstractAction.php:234 { …} |  
  |   | 2023-11-27 15:53:49.944 | /var/www/default/htdocs/httpdocs/profiles/compuclient/modules/contrib/civicrm/Civi/API/Kernel.php:147 { …} |  
  |   | 2023-11-27 15:53:49.944 | } |  
  |   | 2023-11-27 15:53:49.944 | › } |  
  |   | 2023-11-27 15:53:49.944 | ›   throw new \Civi\API\Exception\UnauthorizedException("Authorization failed"); |  
  |   | 2023-11-27 15:53:49.944 | › if (!$event->isAuthorized()) { |  
  |   | 2023-11-27 15:53:49.944 | /var/www/default/htdocs/httpdocs/profiles/compuclient/modules/contrib/civicrm/Civi/API/Kernel.php:223 { |  
  |   | 2023-11-27 15:53:49.944 | trace: { |  
  |   | 2023-11-27 15:53:49.944 | #line: 223 |  
  |   | 2023-11-27 15:53:49.943 | #file: "/var/www/default/htdocs/httpdocs/profiles/compuclient/modules/contrib/civicrm/Civi/API/Kernel.php" |  
  |   | 2023-11-27 15:53:49.943 | #code: 0 |  
  |   | 2023-11-27 15:53:49.943 | #message: "Authorization failed" |  
  |   | 2023-11-27 15:53:49.943 | ] |  
  |   | 2023-11-27 15:53:49.943 | "error_code" => "unauthorized" |  
  |   | 2023-11-27 15:53:49.943 | -extraParams: array:1 [ |  
  |   | 2023-11-27 15:53:49.943 | "exception" => Civi\API\Exception\UnauthorizedException {#1259 |  
  |   | 2023-11-27 15:53:49.943 | "code" => null |  
  |   | 2023-11-27 15:53:49.943 | "message" => "Authorization failed" |  
  |   | 2023-11-27 15:53:49.943 | $Fatal Error Details = array:3 [ |  
  |   | 2023-11-27 15:53:49.943 | Nov 27 15:53:48  [error]

Which is caused by an API v4 call that force permission checks, so similar to what I did here: #113
I removed the other remaining API v4 calls permission checks.

@omarabuhussein omarabuhussein merged commit eba1d5c into CIWEMB-15-creditnote-workstream Nov 28, 2023
2 checks passed
@omarabuhussein omarabuhussein deleted the COMCL-409-fix-perms branch November 28, 2023 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants