Session Object
The Session Object gives access to the current users session object. The default indexer gives access to the values in the session. The session object can be used to store extra data with a specific user between requests, and is used to handle roles and authentication in the Remoting SDK and Data Abstract.
The code snippet below shows how the session object can be used:
function beforeProcessDelta(delta)
{
log('session.roles ='+session.roles);
session.AddRole('SpecifiedRole');
session.RemoveRole('SpecifiedRole');
log('session.timeout ='+session.timeout);
session['CustomVariable'] = 100;
}
Properties
id
Represents the session ID
(GUID). This field uniquely identifies the remote user.
expired
If set, the session is already expired; this should only be true after logout calls.
isNew
If set, this session is a newly created one (in this request), generally from login requests this is true, or when this user does his first request.
timeout
Timeout of this session in seconds. If no calls from this client arrive at the server for "timeout" seconds since it's last used, the session is automatically destroyed.
available
Returns true if there is a session at all. Clients and servers without a session manager will have this set to false; if it's false all other calls will fail.
roles
Gets or sets all roles associated with this session, separated by a comma. Roles are simple identifiers and are used to block or grant access to Remoting SDK and Data Abstract calls.
Functions
addRole(role)
Adds a new role.
removeRole(role)
Removes a role.
hasRole(role)
Returns true if the session contains that role.