lsgs / redcap-extended-reports

Provides various additional options to enhance REDCap's built-in reporting functionality.
GNU General Public License v3.0
1 stars 3 forks source link

Reshaped report does not show data to super users #11

Closed steentje34 closed 5 months ago

steentje34 commented 6 months ago

Hi @lsgs,

In very specific conditions, the EM produces a reshaped report that does contain the correct number of records, shows the record IDs for these records, but does not show any of the data linked to those records. Please find below the specific conditions:

I tried to corner the issue as much as possible, and it seems to be linked to the global variable $user_rights. Up to the line below, the content of this variable seems as expected (i.e. super user has super user powers). https://github.com/lsgs/redcap-extended-reports/blob/a0bd9b9adf02be9ec4af252a54fc0b0f995ba5c2/Report.php#L671

However, somewhere in the REDCap::getReport method the value of the global $user_rights variable is erased, and then project-specific rights are fetched. However, as in this particular scenario the admin is not granted any user rights in the project, the default instrument-level access for new instruments in production ("No Access") is applied for data export. The $user_rights variable is then used in the viewReport method, which results in a report that shows a row per record ID (containing record ID and DAG) but does not show any data for these records. Additionally, some of the buttons at the top of the report ('Stats & Charts', 'Export Data', 'Edit Report') are not displayed image

As a workaround, whenever we need to assist an end user with anything related to the EM Extended Reports, we will temporarily grant ourselves user rights in the project, but it would be ideal if a super user could view a reshaped report without explicitly being granted any user rights on a project. Would it be feasible for you to fix this?

lsgs commented 5 months ago

Thanks very much for looking at that @steentje34. I will fix it using a customised version of REDCap::getReport() incorporated in the Report class that doesn't do the reset of global $user_rights. New release soon...