3

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

3 Answers 3

2

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.

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

I think you can bypass using permission_check hook.

5
  • 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
    Commented Jan 3, 2018 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. Commented Jan 3, 2018 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. Commented Jan 3, 2018 at 13:26
  • 1
    You can use $_REQUEST to check the required parameters. Commented Jan 3, 2018 at 13:27
  • Thank you for the input - will get back to this once I have news.
    – Fabian
    Commented Jan 4, 2018 at 6:40
0

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 and acknowledge you have read our privacy policy.

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