ctsit / imagemap

Imagemap REDCap external module
Other
14 stars 27 forks source link

Imagemap only works if the user is connected to the UFHealth network #37

Closed marlycormar closed 5 years ago

marlycormar commented 5 years ago

Imagemap doesn't work in our production server if the user is not connected to the UFHealth network. To test this failure, connect to another network (use your phone for example) and log in to REDCap. Then, open a project with an imagemap example and the module will not work. However, the same steps are successful if connected to the UFHealth network.

Taryn and I are experiencing the same issue. She hasn't seen this failure in other modules.

ChemiKyle commented 5 years ago

@marlycormar I just created a project on prod using the instrument example included with the module and it worked as expected (though I had to type in a record ID instead of being presented with the green "Add New Record" button). Could you please add me to a project where this behavior is seen?

UPDATE: I was using the uf network assuming that ufhealth was the only network it would work on. I tried the same project on my phone using cell data and the images indeed did not show up. I will work on this tonight at home since all available networks here in the office are UF related.

ChemiKyle commented 5 years ago

Now that I'm on my home network, I can see there are 5 calls to https://redcap.ctsi.ufl.edu/redcap/api/ that are unable to be completed. These are cryptically referred to as resulting from index.php on line 66 (where all JS files for the module are loaded). For some reason the required JS files are not being loaded while not on a UF network.

UPDATE:
This seems specific to projects created on our REDCap server. If I switch to my VM and make a project there, there are no issues.
On prod, creating a project (while connected to my home network) and trying to use imagemap fails, but turning on the VPN and reloading the page renders the images, so that narrows it down, though I don't see anything unusual regarding the file permissions for the module.

Shib/API is to blame  https://github.com/ctsit/imagemap/blob/7da50e04076d6f5c139c72a5163932572b468cb8/ExternalModule.php#L123

Access via this api route must have something filtering via network.

marlycormar commented 5 years ago

@ChemiKyle thanks for fixing issue #37!

Tested in network & off network and works in both. The console doesn't show any errors. Keeping up with the original design, what about doing this:

global $auth_meth;
$ext_path = $auth_meth == 'shibboleth' ? $this->getUrl($path, true, true) : $ext_path = $this->getUrl($path, true, false);

Will leave it to your discretion.

ChemiKyle commented 5 years ago

@marlycormar, speaking with @pbchase on Friday he was under the impression that using the API endpoint was outdated; I originally had an implementation similar to your proposal but the current one was his idea.

marlycormar commented 5 years ago

Fixed by PR #38.