ctsit / redcap_oncore_client

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

Add a feature to save a server vars value as institutional ID #27

Closed pbchase closed 5 years ago

pbchase commented 5 years ago

Add a feature to save a server variable's value as the Institutional ID.

Apache sets a number of variables and hands them to the called application via the server environment. In a shibboleth environment, one of these could be the institutional ID that we would like to see in the staff_id field of the oncore_staff_identifier entity. We need to read that environment variable and write its value and the current username into a record of the oncore_staff_identifier entity. That should allow us to lookup the staff_id when checking if the currently logged in user is in the protocol_staff entity for the current protocol. To make this feature work at different sites, sites without shibboileth, and development environments, the environment variables read should be configurable.

To that end, do these things:

  1. Add a configuration field to the system-level configuration of the redcap_oncore_client. Name that field something like "staff_id_variable_name". It should be a text field.
  2. Modify the subjectsPull plugin page or its included classes to read the name of the environment variable in the above config entry, read the value of that environment variable and write/update a record in the oncore_staff_identifier with that value as the staff_id attribute and the currently logged in REDCap user's username as the user_id attribute.

A good place to do this step might be just before https://github.com/ctsit/redcap_oncore_client/blob/9029edd7bef479a1ff434f12a8c4ca16068f8ede/classes/entity/list/SubjectsDiffList.php#L76

Make sure you test that the var exists. Also, test that the value stored in the var has non-zero length. Also, verify that this feature does not insert an additional record on each page load lest oncore_staff_identifier grow unchecked.

Note: To test this feature any server environment variable that is constant across page reloads will provide suitable input. One can see all the vars using the phpInfo() command. These variables would be suitable: HTTP_HOST, SERVER_ADDR, SERVER_NAME

pbchase commented 5 years ago

Functionality is addressed by PR #28