If one sends out a mailing using CiviCRM, one can access an overview of the mailing's result from the mailings menu (see screenshot). From this summary you will also be able to access more detailed information, including the unique opens (see screenshot).

As this information can be considered quite sensitive in regard to data protection, I would like to restrict access to it to certain users/roles. I tried editing the permissions of all relevant mailing reports I could find.

However, it turns out that this information does not seem to be based on CiviCRM'S report function. Even If restrict user's access to any report functions, the detailed mailing information can still be viewed.

Hence my questions are:

  • Which permission is actually relevant for opening pages such as civicrm/mailing/report/event?reset=1&event=opened&mid=XYZ&distinct=1 ?
  • Is there any way to restrict access to this information without denying users to use CiviMail at all?

Tested on CiviCRM 4.7.18 and Drupal 7.54.

Summary Screen Detailed Information


I think you can bypass using permission_check hook.

  • Thanks I do not think that works as the documentation says "This hook is implemented for forms (eg Add, Edit) but not yet for reports and viewing of objects like Activities on the Contact Summary page as of 4.7.17" – Fabian Jan 3 '18 at 12:53
  • 1
    It does get called on all pages now. I think no one bothered to update the documentation once it was fixed for other pages. Please give a try. – Pradeep Nayak Jan 3 '18 at 13:26
  • That should work, but i think you would lack the context in the hook to distinguish between accessing CiviMail and accessing the event reports in CiviMail. – Thomas Schüttler Jan 3 '18 at 13:26
  • 1
    You can use $_REQUEST to check the required parameters. – Pradeep Nayak Jan 3 '18 at 13:27
  • Thank you for the input - will get back to this once I have news. – Fabian Jan 4 '18 at 6:40

I don't know an intended way to alter the permissions directly.

However, you can play around with disallowing the simple mailing event reports altogether for unprivledged users and restrict access for users to the regular reports as you need it.

SELECT * FROM civicrm_menu where path = 'civicrm/mailing/report/event';

e.g. altering access_arguments from a:2:{i:0;a:1:{i:0;s:15:"access CiviMail";}i:1;s:3:"and";} to a:2:{i:0;a:1:{i:0;s:18:"administer CiviCRM";}i:1;s:3:"and";} will only allow admins to view any of the event reports.

  • Thank's for the feedback. Does that mean that the permission to view those pages is indeed "access CiviMail"? – Fabian Jan 3 '18 at 12:58
  • By default, yes. – Thomas Schüttler Jan 3 '18 at 13:07
  • Thank you for the input - will get back to this once I have news. – Fabian Jan 4 '18 at 6:40

We ended up using a hook as suggested. Anyone interested in how we did it can take a look at the code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.