Task #3559

Documentation: Add example for "Fake Custom Object" to test Activation Condition scripts

Added by Daniel Lutz almost 4 years ago. Updated almost 4 years ago.

Status:NewStart date:2015-10-30
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Documentation
Target version:3.2.0

Description

The following JavaScript "Fake Custom Object" can serve for testing a script:

cookie_krb = new Object();
cookie_krb.getName = function() {return "_idp_krb_enabled"};
cookie_krb.getValue = function() {return "true"};

function Custom() {

//---- 1. IP ----
ip_OK = "192.168.1.55";
ip_wrong = "10.0.75.3";
this.remoteAddr = ip_OK;
// ---- 2. Header ----
this.getHeader = function(header_id) {
var firefox = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0";
var ie = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3;)"
var ie_myOrg = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3; IESE55; IESE110)"
return ie;
}
  1. ---- 3. Cookies ----
    this.getCookies = function() {
    return [cookie_krb];
    }
    }
    var custom = new Custom();

// --- example: ----
alert(custom.getHeader("user-agent"));
alert(custom.getCookies()[0].getName());

History

#1 Updated by Daniel Lutz almost 4 years ago

  • Target version set to 3.2.0

Also available in: Atom PDF