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

'View custom data' permission needed for anonymous user if you want to see it with drush api or php api

    Details

    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None

      Description

      Suppose you have a custom field on an address. And suppose you want to get the information in this custom field using the drush api or the php api. Like e.g.

      drush cvapi Address.get sequential=1 return="custom_1"

      This only works if anonymous users have the 'access custom data' permission. I think this is a bug, because the drush-api and the php api should always have all permissions.

      Using the API explorer, this always works, regardless of the permissions of anonymous users.

      For some entities (like e.g. Membership), if you don't provide a return parameter, the custom fields are also returned by default, regardless of the permissions of anonymous users. In this case

      drush cvapi Membership.get sequential=1 return="custom_44" id=666

      does not show custom fields, but

      drush cvapi Membership.get sequential=1 id=666

      does, which confused me a lot

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              johanv Johan Vervloet
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: