mehmetc / jQuery.PRIMO

A client side convenience library for PRIMO.
MIT License
27 stars 8 forks source link

$.PRIMO.session.user.isOnCampus() configuration. #10

Closed danizen closed 7 years ago

danizen commented 7 years ago

NLM is a closed stack library - requests make no sense off campus.

Therefore, I have been asked to remove/hide the requests and locations tabs unless the user is on our local subnet, 130.14.0.0/16, and/or corresponding IPv6 so that we can have a single view that represents both our local on campus interface and remote interface.

I could implement this in a fairly raw way, but isOnCampus() seems a good solution, only how does it work? What does isOnCampus() check on the back-end, e.g. what do I configure to administrate this?

Thanks,

Dan Davis

mehmetc commented 7 years ago

Hi Dan,

isOnCampus() is a native Primo session variable. It works by checking if the IP address of the users browser falls within an IP range. Next to assigning true/false to this variable it can also assign an institution to the user that is different from the views institution.

You can configure the institution campus IP ranges by editing your institution on the backend and clicking on the 'Save & Continue' button this will bring up a screen were you can enter the IP ranges. After deploying Primo will know when you are on campus.

Mehmet