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

Drush cc all throw exception on using 'check_permissions' param

    Details

    • Type: Bug
    • Status: Won't Do
    • Priority: Trivial
    • Resolution: Won't Do
    • Affects Version/s: 4.7.0
    • Fix Version/s: 4.7.25
    • Component/s: None
    • Labels:
      None
    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Needs Funding
    • Verified?:
      No

      Description

      There are a lot more places in civi code where we set "check_permissions" = TRUE while calling APIs. If any of this is executed by "drush cc all" command results into an exception of -

      API permission check failed for Group/get call; insufficient permission: require access CiviCRM in [error] civicrm_api3() (line 45 of /home/drudev2/public_html/druyoga/drupal/sites/all/modules/civicrm/api/api.php

      This is because drush cc executes as an anonymous user. Two solutions I can think of -

      1. Make drush cc authenticated as admin.
      2. Avoid `check_permissions` param while in drush cc mode.

      One way to replicate this behavior.

      1. Create a view of CiviCRM Mailings. Add some fields and filters like Mailing Name, from name, etc. Save.
      2. Execute "drush cc all" on the command line.

      We can pass admin user as "$drush cc all --user=1" which works fine and passes the permission check, but should we consider this as some of them may not be knowing of the --user param.

      (CRM-20292 also relates to `drush cc all` as anonymous user.)

        Attachments

          Activity

            People

            • Assignee:
              jitendra.purohit Jitendra Purohit
              Reporter:
              jitendra.purohit Jitendra Purohit
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: