Global

Methods

include(scriptPath)

Inserts the content of the JSS script file at the given path into the script file that calls the function. The scope of the script is the same as the scope from which the function was called.

Parameters:
Name Type Description
scriptPath String

path of JSS script file.

publish(name, funcOrObj, instructionsopt)

Adds the given object (usually a function) to the global scope using the given name. If the published object is a function then it will be made available via RPC unless 'serverOnly' is supplied in the instructions argument.

Functions declared in the global scope and those referenced by publish (without the serverOnly flag) are automatically made available via RPC when the URL of the .jss file in which they're defined are referenced by allowed <script> tag in HTML. The Javascript code required to call them is automatically generated by CompleteFTP. Refer to JSS Web-App Basics for more information.

The following example illustrates some usages:

function globalFunction() {
}

(function () {
    function publishedFunction() {
    }

    function serverOnlyFunction() {
    }

    function internalFunction() {
    }

    publish("publishedFunction", publishedFunction);
    publish("serverOnlyFunction", serverOnlyFunction, { serverOnly: true });
}());

Both globalFunction() and publishedFunction() are available for RPC, the former because it's a global function and the latter because it's published using the publish function. Neither internalFunction() and serverOnlyFunction() are not available via RPC, but serverOnlyFunction() may be called by any other .jss file that includes it using the include function because it's published with the serverSide flag.

Parameters:
Name Type Attributes Description
name String

Name via which the object is to be referenced

funcOrObj FunctionOrObject

Object or function to be published

instructions Object <optional>

Specifies how the object is to be published.

Properties
Name Type Attributes Description
serverOnly Object <optional>

If this property is true then the function will not be made available via RPC.

maxCallsPerMinute Object <optional>

Maximum number of RPC invocations allowed per minute (default is 100).

Type Definitions

FileInfo

Represents a single file or folder in a file listing

Type:
  • Object
Properties:
Name Type Description
name String

Name of the file or folder

length Number

Length of the file (0 if folder)

isDirectory Boolean

Is this a folder?

modified Date

Date when the file (or folder - excluding contents) was last modified.

permissions String

Permissions of the file or folder.

owner String

Name of the user account which owns the file or folder.

group String

Name of the group to which the folder belongs.

HttpConfiguration

Configuration of HTTP request

Type:
  • Object
Properties:
Name Type Description
params Object

Query arguments. These may alternatively be included in the url argument.

timeout Number

Timeout in milliseconds.

headers Object

HTTP headers.

contentType Object

MIME type.

HttpResponse

Encapsulates the response to a HTTP request.

Type:
  • Object
Properties:
Name Type Description
body String

The body of the response

status HttpResponseStatus

The response code and its description

HttpResponseStatus

Encapsulates the status of an HTTP response

Type:
  • Object
Properties:
Name Type Description
code number

The response code

description String

The response description

IdentityProvider

Contains information about an SAML IDP (IDentity Provider)

Type:
  • Object
Properties:
Name Type Description
name String

Name of the IDP.

id String

Identifier of the IDP (usually its URL).

PublicKeyInfo

Public key information.

Type:
  • Object
Properties:
Name Type Description
type String

The algorithm of the key: DSA, RSA, ECDSAsha2Nistp256, ECDSAsha2Nistp384 or ECDSAsha2Nistp512.

fingerprint String

The fingerprint of the key.

encodedKey String

The same key encoded in OpenSSH format (no comment included).

SingleSignOn

Contains information about SAML Single Sign-On (SSO).

Type:
  • Object
Properties:
Name Type Description
enabled Boolean

Is SAML SSO enabled?

path String

Path under which SAML requests are processed (usually /SAML).

identityProviders Array.<IdentityProvider>

Array of SAML IDPs (IDentity Providers).

SiteInfo

Contains information about a site

Type:
  • Object
Properties:
Name Type Description
name String

Name of the site.

welcomeMessage String

Welcome-message of the site.

singleSignOn SingleSignOn

Single Sign-on (SAML) settings.

loginPath String

Path to the login page (usually /Login).

publicAccessEnabled Boolean

True if public HTTP/HTTPS access is enabled on this site.

httpEnabled Boolean

True if HTTP is enabled on this site.

httpsEnabled Boolean

True if HTTPS is enabled on this site.

sharingEnabled Boolean

True if sharing is enabled on this site.

logoutPath String

Path to the logout page (usually /Logout).