Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-20581

Civi event users do not have access to StateProvince entity via the API

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.7.19
    • Fix Version/s: 4.7.20
    • Component/s: CiviEvent
    • Labels:
    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Needs Funding
    • Verified?:
      No

      Description

      We are using CiviCRM with Drupal 7.54 and we just upgraded to CiviCRM 4.7.19. After the upgrade, when I go to an event (Event->Manage Events->[some event]->location) with a user who has 'access CiviEvent' permissions and try to go to the location tab I receive this error:

      CiviCRM_API3_Exception: "Authorization failed to join onto StateProvince api in parameter loc_block_id.address_id.state_province_id.name"
      #0 sites/all/modules/civicrm/CRM/Event/BAO/Event.php(1889): civicrm_api3("Event", "get", (Array:5))
      #1 sites/all/modules/civicrm/CRM/Event/Form/ManageEvent/Location.php(172): CRM_Event_BAO_Event::getLocationEvents()
      #2 sites/all/modules/civicrm/CRM/Core/Form.php(564): CRM_Event_Form_ManageEvent_Location->buildQuickForm()
      #3 sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Display.php(92): CRM_Core_Form->buildForm()
      #4 sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Display->perform(Object(CRM_Event_Form_ManageEvent_Location), "display")
      #5 sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Event_Form_ManageEvent_Location), "display")
      #6 sites/all/modules/civicrm/CRM/Core/Controller.php(351): HTML_QuickForm_Page->handle("display")
      #7 sites/all/modules/civicrm/CRM/Utils/Wrapper.php(113): CRM_Core_Controller->run()
      #8 sites/all/modules/civicrm/CRM/Core/Invoke.php(283): CRM_Utils_Wrapper->run("CRM_Event_Form_ManageEvent_Location", "Event Location", (Array:0))
      #9 sites/all/modules/civicrm/CRM/Core/Invoke.php(84): CRM_Core_Invoke::runItem((Array:14))
      #10 sites/all/modules/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:4))
      #11 sites/all/modules/civicrm/drupal/civicrm.module(448): CRM_Core_Invoke::invoke((Array:4))
      #12 includes/menu.inc(527): civicrm_invoke("event", "manage", "location")
      #13 index.php(20): menu_execute_active_handler()
      #14 \{main}
      

      The error is triggered when CRM_Event_BAO_Event::getLocationEvents() is called.
      Located in CRM/Event/BAO/Event.php

      I believe this error is triggered because CiviEvent users don't have permission to the StateProvince entity via the API.  I'm assuming they should because if they don't users without 'administer CiviCRM' won't be able to complete events.

      As a workaround I've added the permissions via drupal - hook_civicrm_alterAPIPermissions but it may be better to add the access to Core in CRM/Core/Permission.php.

        Attachments

          Activity

            People

            • Assignee:
              palantejon Jon K Goldberg
              Reporter:
              tom.m Thomas Mannell
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: