veda-consulting-company / uk.co.vedaconsulting.outlookapi

Other
4 stars 18 forks source link

Bugfix: Users without administer CiviCRM are unable to view CiviCases #61

Closed reecebenson closed 2 years ago

reecebenson commented 5 years ago

This fixes a reproducible bug whilst using the Outlook API Extension (disabling this extension fixes the issue). The client had users who were unable to view cases and were presented with the error:

CiviCRM_API3_Exception: "API permission check failed for Activity/getcount call; insufficient permission: require administer CiviCRM"

When it stated the permission didn't have "administer CiviCRM", it was either going to be a Core bug or an extension interfering with it. Quick search lead to this extension overriding permissions (see changes for the fix).

Expected Outcome

Be able to view cases whilst the Outlook API extension is enabled.

Actual Outcome

Presented with the above error, and following traceback:

#0 /var/www/html/drupal7/sites/all/modules/civicrm/CRM/Activity/BAO/Activity.php(950): civicrm_api3("Activity", "getcount", (Array:11))
#1 /var/www/html/drupal7/sites/all/modules/civicrm/CRM/Activity/Selector/Activity.php(361): CRM_Activity_BAO_Activity::getActivitiesCount((Array:8))
#2 /var/www/html/drupal7/sites/all/modules/civicrm/CRM/Core/Selector/Controller.php(234): CRM_Activity_Selector_Activity->getTotalCount(4, "316")
#3 /var/www/html/drupal7/sites/all/modules/civicrm/CRM/Case/Page/Tab.php(122): CRM_Core_Selector_Controller->__construct(Object(CRM_Activity_Selector_Activity), NULL, NULL, 4, Object(CRM_Case_Page_Tab), 1, NULL, "316")
#4 /var/www/html/drupal7/sites/all/modules/civicrm/CRM/Case/Page/Tab.php(196): CRM_Case_Page_Tab->view()
#5 /var/www/html/drupal7/sites/all/modules/civicrm/CRM/Core/Invoke.php(311): CRM_Case_Page_Tab->run((Array:4), NULL)
#6 /var/www/html/drupal7/sites/all/modules/civicrm/CRM/Core/Invoke.php(85): CRM_Core_Invoke::runItem((Array:13))
#7 /var/www/html/drupal7/sites/all/modules/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:4))
#8 /var/www/html/drupal7/sites/all/modules/civicrm/drupal/civicrm.module(444): CRM_Core_Invoke::invoke((Array:4))
#9 /var/www/html/drupal7/includes/menu.inc(527): civicrm_invoke("contact", "view", "case")
#10 /var/www/html/drupal7/index.php(21): menu_execute_active_handler()
#11 {main}

URL:

Environment:

Cheers

agileware-pengyi commented 5 years ago

Hi @reecebenson Thanks. This fixes my issue.

Environment: Wordpress 5.2 CiviCRM 5.13.3

Agileware ref: CIVICRM-1205

MegaphoneJon commented 5 years ago

This is substantially similar to #64, but #64 resolves a second potential issue with the domain API permissions as well.

rajeshrhino commented 2 years ago

Fixed in PR #64