Skip to content

#87 required contact id filter throws error for anonymous users

#87 (closed) Creating a dataprocessor api output with contact id as a required filter and defaulted to logged in contact id, throws exception when a non logged in user uses it.

Steps to reproduce

On WordPress

  1. Create a dataprocessor using the attached file test_contact_id.json
  2. Install Content Views and Content Views CiviCRM
  3. Create a Content View that uses this dataprocessor
  4. Access the page as an anonymous user

Fix

Use 0 if no logged in contact found CRM_Core_Session::getLoggedInContactID() ?? 0
I will add an MR that changes this line in following 2 files

  • Civi\DataProcessor\FilterHandler\ContactFilter
  • Civi\DataProcessor\FilterHandler\CaseRoleFilter

Comments

I understand that this is not an issue in dataprocessor itself but rather the systems using dataprocessor. But I think it's better to return 0 results instead of throwing an error to make it easier.

Could be related to #82

If you think it should be left as is, please close this.

Merge request reports