ctsit / redcap_oncore_client

REDCap OnCore Client external module provides integration with Forte Research's OnCore
Other
4 stars 7 forks source link

Verify the logged in user is on the study staff #16

Closed pbchase closed 5 years ago

pbchase commented 5 years ago

The REDCap OnCore Client needs to verify that users attempting to access the enrollment data for a study are listed as study staff on that study. Study staff data can be provided by the OnCore API via the GetProtocolStaff method. Staff needs to be looked up via UFID. Study staff data should be cached like any other data fetched form OnCore. Managing queries of a user's UFID requires that we store that attribute as an extension of the REDCap user information.

To achieve these goals, I recommend these functions be implemented:

  1. Add a new entity named user_attributes with redcap_entity. This entity needs 2 attributes: username, staff_id
  2. For each user that opens the Pull OnCore Subjects page, test for a server environment variable named HTTP_GLID. If it exists, store/update it in the staff_id attribute with a username equal to the $REDCAP_USER.
  3. Add a new entity named protocol_staff. The entity should have 3 attributes: protocol_id (or whatever we called this attribute in the protocols table), staff_id, and stop_date
  4. Add an action to the existing actions that execute when the Refresh OnCore data button is pressed. The new action should use the getProtocolStaff OnCore API method to fetch the protocolStaff for this one protocol, store that data in the protocol_staff entity.
  5. Modify the actions that present data on the Pull OnCore Subjects plugin page to check the authorization of the currently logged in user before presenting enrollment data. Only users whose staff_id is listed in the current protocol's protocol_staff table with a stop date in the future are authorized to see enrollment data.
  6. Make sure the Refresh OnCore data button is visible and works at all times. This will allow people to refresh cached protocol staff data that might be blocking their access to the enrollment data.

Here's the workflow of a normal interaction with the new features that verify the logged in user is on staff:

ocr ctsit- meeting - workflow for authorized access to oncore enrollment data and forte EDC 2019-05-15 14 36 28_1

pbchase commented 5 years ago

Addressed by PR #18