New Module for Drupal: CiviCRM Private Report

A couple of weeks back I wrote here some thoughts about letting users manage and modify their own private collection of reports without actually having site-wide "administer reports" privileges. I've since gone ahead and written up the code to make this happen, and I would love to get feedback from the community on its usefulness and ways to improve it.

This code is available as a Drupal module for CiviCRM 3.4.x and 4.0.x, on Drupal.org by the project name CiviCRM Private Report. Following is a quick overview of how it works.

Key features

Each user has a private space for reports visible and editable by that user alone.

Users can copy any report that they can access into their own private report space.

CiviCRM's native listings of available reports do not show user-private reports, but do provide a link to the user's own list of private reports.

Any user-private report is accessible only by the user who created that report, with the exception of administrative users.

Administrative users can view any user-private report and may promote it to site-wide availability (that is, removing the private ownership status of the report).

Permissions

At this point the module essentially offers two classes of access. Basic functionality is available to users with CiviCRM's "Access Report Criteria" permission, plus this module's own "Administer own CiviCRM reports" permission. Administrative functions are granted to users with CiviCRM's "Administer Reports" permission.

Basic functionality: Creating and managing my private reports

Users with basic functionality can create a private copy of any CiviCRM report to which they have access. This is done in the new "Private Copy" section of options, which is added just below the "Report Criteria" section at the top of the report.

Here they just enter a new name and click "Save copy." The report is then saved as a new report instance, to which only that user has access.

The user now has access to a limited set of "Report Settings" form fields. At the moment this includes the General Settings but not Email Delivery Settings or Other Settings. I decided to hide those settings simply to save some complexity, and I'm considering adding support for them but haven't looked at that closely yet. There's an issue for adding them, here: http://drupal.org/node/1396878

Having created a private report, the user may expect to see it on the Reports Listing page. However, no private reports are listed there. Instead, the user is notified that he has private reports not displayed in the list, with a link to his own list of private reports.

The "My user-private reports" page lists all of the user's private reports, with links to view or delete any of them, in essentially the same format as CiviCRM's Report Listing page.

Administrative functions: Promoting private reports

Once a user has created and refined his own reports, it's conceivable that one or more of those reports could be useful to other users. In this case, a user with administrative access can promote the report to side-wide availability, which means simply that it's no longer a private report.

An administrative user can access the list of all private reports on the site, which is grouped by user.

From this listing the administrative user can open and review any user's private report. In the "Private Copy" section, the administrative user has access to a button labeled "Promote to site-wide report," which she can use to take the report out of the user's private collection, thus causing it to be treated like any other CiviCRM report.

With this, the report is now listed in CiviCRM's native Report Listing page.

Future improvements and feedback

There's surely room for improvement, and your feedback will be very helpful. (For example, lcdweb brought up the idea of peer-based sharing between users, which I think would be great to do. There's an issue for this new feature linked below.)

Please download the latest version for your own use and let me have your feedback. The Drupal issue queue is the best place for support requests and new feature requests. This module is also in use on a client's live 3.4.x site, so I'm expecting any improvements there to be worked back into the publicly available module.

Filed under

Comments

You may be interested in this thread on creating a CMS-independent module for CiviCRM. Since your code doesn't have anything to do with Drupal per-se, it would probably work great as a standalone module.