Validate IP Address while accessing the course

Use Case - allow some courses only from known internal IP Addresses

Solution -

  • create two linked microsites, and add a custom property for the course called "internalOnly"
  • set this property on all internal only courses (those need to be disallowed from outside)
  • work with EduBrite support team to add IP address based restriction to access the internal site
  • add following check to run on course player page, in the external site in v2-footer-js
try{
if(window.location.href.indexOf("coursePlayer.do") > -1){
  if(typeof courseId != "undefined"){
    $.post("../site/customProps.do", {dispatch: "getCustomPropertyVal", entityType: "COURSE", entityId: courseId, propName: "internalOnly"}, function(data){
   if(data && data.value && data.value.toLowerCase() == "true"){
      $("#cpWrapper").remove(); 
      alert("Restricted course. Please access this course from txyz-internal.edubrite.com");
      g_navigateTo("../site/home.do");
   }
 }, "json");        
  }
}
}catch(er){alert(er)}

 


Rating: