Matrix Science header
Public Member Functions

ms_session Class Reference
[Mascot security and authentication module]

Use this class to determine if a user is logged in and if they have 'permission' to perform tasks. More...

#include <ms_security_session.hpp>

Inheritance diagram for ms_session:
Inheritance graph
[legend]
Collaboration diagram for ms_session:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ms_session (const std::string session_id="")
 Use this constructor to open the current session.
 ms_session (const std::string userName, const std::string userPassword)
 Use this constructor to start a new secure session.
 ms_session (const int timeout, const std::string prefix)
 Use this constructor to start a new session independent of users and Mascot security.
 ms_session (const std::string userName, const std::string connectionID, const std::string database)
 This constructor is used by Mascot integra to login to Mascot.
void appendErrors (const ms_errors &src)
 Copies all errors from another instance and appends them at the end of own list.
bool canResultsFileBeViewed (const int userID) const
 Check if a results file with the passed user ID can be viewed.
void clearAllErrors ()
 Remove all errors from the current list of errors.
bool clearParam (const std::string name)
 Remove a custom parameter from the session file.
void copyFrom (const ms_errors *right)
 Use this member to make a copy of another instance.
bool destroy ()
 Destroy the current session. Should be called when a user logs out.
bool getBoolParam (const std::string name, bool &param) const
 Return a custom 'bool' parameter from the session file.
bool getDoubleParam (const std::string name, double &param) const
 Return a custom 'double' parameter from the session file.
double getDoubleParam (const std::string name) const
 Return a custom 'double' parameter from the session file.
std::string getEmailAddress () const
 Return the email address for the currently logged in user.
const ms_errsgetErrorHandler () const
 Retrive the error object using this function to get access to all errors and error parameters.
std::string getFullUserName () const
 Return the full name for the currently logged in user.
std::string getID () const
 Return the sessionID for this session file.
bool getIntParam (const std::string name, int &param) const
 Return a custom 'integer' parameter from the session file.
int getIntParam (const std::string name) const
 Return a custom 'integer' parameter from the session file.
std::string getIPAddress () const
 Return ip address of the currently logged in user.
time_t getLastAccessed () const
 Returns the time that the session was last updated.
int getLastError () const
 Return the error description of the last error that occurred.
std::string getLastErrorString () const
 Return the error description of the last error that occurred.
bool getLongParam (const std::string name, long &param) const
 Return a custom 'long' parameter from the session file.
long getLongParam (const std::string name) const
 Return a custom 'long' parameter from the session file.
std::map< std::string,
std::string > 
getParams () const
 Returns a list of all the parameters saved in the session file.
matrix_science::ms_security_tasks getPermittedTasks () const
 Returns the permitted tasks for the currently logged in user.
std::vector< int > getSpoofableUsers () const
 Returns a list of user IDs that can be spoofed.
std::string getStringParam (const std::string name) const
 Return a custom 'string' parameter from the session file.
bool getStringParam (const std::string name, std::string &param) const
 Return a custom 'string' parameter from the session file.
time_t getTimeout () const
 Returns the time when the session times out.
bool getTimeParam (const std::string name, time_t &param) const
 Return a custom 'time' parameter from the session file.
time_t getTimeParam (const std::string name) const
 Return a custom 'time' parameter from the session file.
int getUserID () const
 Return the unique userid for the currently logged in user.
std::string getUserName () const
 Return the user 'login' name for the currently logged in user.
matrix_science::ms_user::usertype getUserType () const
 Returns the type of user.
bool isFastaPermitted (const std::string database) const
 Check if a particular fasta file can be accessed.
bool isPermitted (const int taskID) const
 Check if the task is permitted.
bool isPermitted_double (const int taskID, const double value) const
 Check if the value is in the floating point parameter list.
bool isPermitted_long (const int taskID, const long value) const
 Check if the value is in the long integer parameter list.
bool isPermitted_string (const int taskID, const std::string value) const
 Check if the value is in the string parameter list.
bool isSecurityEnabled () const
 Return true if the security system is enabled.
bool isTimedOut () const
 Returns true if the current session has timed out.
bool isValid () const
 Call this function to determine if there have been any errors.
bool saveBoolParam (const std::string name, bool param)
 Save a custom 'bool' parameter in the session file.
bool saveDoubleParam (const std::string name, double param)
 Save a custom 'double' parameter in the session file.
bool saveIntParam (const std::string name, int param)
 Save a custom 'integer' parameter in the session file.
bool saveLongParam (const std::string name, long param)
 Save a custom 'long integer' parameter in the session file.
bool saveStringParam (const std::string name, const std::string param)
 Save a custom 'string' parameter in the session file.
bool saveTimeParam (const std::string name, time_t param)
 Save a custom 'time' parameter in the session file.
bool setPermittedTasks (const matrix_science::ms_security_tasks &val)
 Sets the permitted tasks for the currently logged in user.
bool update (const ms_security &sec)
 Only needs to be called by administration applications after user rights have changed.

Detailed Description

Use this class to determine if a user is logged in and if they have 'permission' to perform tasks.

This is the only security class that most applications will need to use. This class should be used even if security is disabled because the underlying structure deals with this. If security is disabled, then isValid() and isPermitted() will both return true.

Session information is saved in files in the ../sessions directory. The session files have the same name as the session id which will be of the general form 'username_uniquenumber'. The unique number is assigned by the system and the username is the login name.

Special cases are as follows:

Session NameDescription
[username]_[random_number] Session name for a normal user.
[username]_webserverauth Session name for a user logged in using web authentication. This session file is created/modified when the user is modified. It is not possible to use this session id unless the user is 'logged into' the web server using the name 'username'
all_secdisabledsession The Mascot security system is not enabled. This session file will only exist if security is disabled. Attempts to use it when security is enabled will fail.
cmd_cmdlinesession Any applications run directly from a shell or command prompt will use this session id. Any script run directly as a cgi application (or chained from a cgi script) will not be able to use this session id.
guest_guestsession Any user who is logged in as 'guest'. If the guest account is not enabled, this session will not be available
[name]_computername for 3rd party applications that have not implemented Mascot security, it is possible to specify a computer name rather than a login name and password.
[ipaddr]_computeripaddress For 3rd party applications that have not implemented Mascot security, it is possible to specify an ip address rather than a login name and password.
[string]_agentstring Agent string such as 'Mozilla'. Will only be used a last resort by third party applications.
integradb@name_session Mascot integra user. The integradb is the value returned by: ms_security_options::getIntegraDatabaseName(). Internally, this session id will be translated into a Mascot Integra session string by replacing the @ with a pipe symbol, and removing the underscore between the name and the session. The Mascot cookie will be this session id, and not the Integra connection string. There is a special case of the user being (system).

Constructor & Destructor Documentation

ms_session ( const std::string  session_id = "" )

Use this constructor to open the current session.

Call isValid() to check that a session was opened. If isValid() returns false, then getLastError() should be called to determine an appropriate action, such as asking a user to login.

A successful call to this constructor will cause the last accessed time to be updated (for ms_user::USER_NORMAL only).

If the session_id parameter is empty, then this constructor will try the following in turn:

  • Try to find the session_id from a cookie (MASCOT_SESSION=).
  • If the program is being run from the command line (no REMOTE_USER environment variable set) use cmd_cmdlinesession, with all access rights.
  • If security is disabled, then a disabled security session will be created.
  • If integrated web server authentication is enabled, check REMOTE_USER -- if that fails, try guest.
  • If a computer name/IP address has been specified as a work-around for 3rd party applications, try that.
  • If a guest account has been enabled use that.

isPermitted() should be then be called as required to determine if the user can perform certain actions.

Possible errors, and suitable actions for an interactive application, are:

Parameters:
session_idIf session_id is empty, then this constructor will try to find session_id from a cookie (MASCOT_SESSION=).
ms_session ( const std::string  userName,
const std::string  userPassword 
)

Use this constructor to start a new secure session.

The value from getID() should the be saved in a cookie.

Possible errors, and suitable actions for an interactive application, are:

Parameters:
userNameis the user name entered by the user.
userPasswordis the unencrypted password.
ms_session ( const std::string  userName,
const std::string  connectionID,
const std::string  database 
)

This constructor is used by Mascot integra to login to Mascot.

Deprecated:
Mascot Integra is not supported in Mascot Parser 2.5 and later.

This constructor should only be used from Mascot Integra, or an application running in the Integra environment. The Integra application will have access to the currently logged in user name, and also to the Integra connectionID.

Possible errors, and suitable actions for an interactive application, are:

If this function succeeds, it will set session_id to a session variable of the form database@userName_connectionID.

Parameters:
userNameis the Integra user name.
connectionIDis the Integra connection string.
databaseis the name of the Mascot integra database.
ms_session ( const int  timeout,
const std::string  prefix 
)

Use this constructor to start a new session independent of users and Mascot security.

Parameters:
timeoutis the inactivity time in seconds before the session becomes timed out. A value of zero indicates it will never time out.
prefixis a prefix to be used as the session id: will be of the form prefix_randomnumber.

Member Function Documentation

void appendErrors ( const ms_errors src ) [inherited]

Copies all errors from another instance and appends them at the end of own list.

Parameters:
srcThe object to copy the errors across from. See Maintaining object references: two rules of thumb.
bool canResultsFileBeViewed ( const int  userID ) const

Check if a results file with the passed user ID can be viewed.

This is a helper function to make end user programs simpler.

Parameters:
userIDis the USERID value from the results file. Old results files don't have this value, in which case ms_searchparams::getUSERID() will return 0.
Returns:
True if the user has rights to view this results file.
void clearAllErrors (  ) [inherited]

Remove all errors from the current list of errors.

The list of 'errors' can include fatal errors, warning messages, information messages and different levels of debugging messages.

All messages are accumulated into a list in this object, until clearAllErrors() is called.

See Error Handling.

See also:
isValid(), getLastError(), getLastErrorString(), getErrorHandler()
Examples:
common_error.cpp, resfile_error.cpp, and resfile_summary.cpp.
bool clearParam ( const std::string  name )

Remove a custom parameter from the session file.

Use this function when you no longer want a value associated with a key name.

See also Using custom parameters

Parameters:
nameName of the key value. Do not use an name with a leading underscore as these are reserved for system values.
Returns:
boolean value to indicate if the value was successfully removed.
void copyFrom ( const ms_errors right ) [inherited]

Use this member to make a copy of another instance.

Parameters:
rightis the source to initialise from
bool destroy (  )

Destroy the current session. Should be called when a user logs out.

The session file is deleted and all user parameters are removed. Don't attempt to use the object after calling destroy().

Returns:
True if the session was deleted. An attempt to delete the session file for a guest user, command line session, or authentication disabled will fail and return false.
bool getBoolParam ( const std::string  name,
bool &  param 
) const

Return a custom 'bool' parameter from the session file.

Note:
This function should not be used from programming languages other than C++. Use getBoolParam(const std::string) const instead.
See also:
saveBoolParam()

See also Using custom parameters

Parameters:
namename of the key value. Do not use an name with a leading underscore as these are reserved for system values.
paramIs the value of the parameter associated with the key name.
Returns:
boolean value to indicate if the value was successfully retrieved.
double getDoubleParam ( const std::string  name ) const

Return a custom 'double' parameter from the session file.

If a value of 0 is returned, it is not possible to determine if this is because there is no key value or if a value of zero was set for the key.

See also:
saveDoubleParam()

See also Using custom parameters

Parameters:
nameName of the key value. Do not use an name with a leading underscore as these are reserved for system values.
Returns:
The value of the parameter associated with the key name.
bool getDoubleParam ( const std::string  name,
double &  param 
) const

Return a custom 'double' parameter from the session file.

Note:
This function should not be used from programming languages other than C++. Use getDoubleParam(const std::string) const instead.
See also:
saveDoubleParam()

See also Using custom parameters

Parameters:
nameName of the key value. Do not use an name with a leading underscore as these are reserved for system values.
paramIs the value of the parameter associated with the key name.
Returns:
The value of the parameter associated with the key name.
std::string getEmailAddress (  ) const

Return the email address for the currently logged in user.

Note that there is no guarantee that this is a valid email address.

Returns:
email address for this session
const ms_errs * getErrorHandler (  ) const [inherited]

Retrive the error object using this function to get access to all errors and error parameters.

See Error Handling.

Returns:
Constant pointer to the error handler
See also:
isValid(), getLastError(), getLastErrorString(), clearAllErrors(), getErrorHandler()
Examples:
common_error.cpp, and http_helper_getstring.cpp.
std::string getFullUserName (  ) const

Return the full name for the currently logged in user.

See also:
getUserName()
Returns:
full user name for this session
std::string getID (  ) const

Return the sessionID for this session file.

This the same as the session filename. If isValid() returns false, this will return an empty string. System session ids are described in ms_session::ms_session.

Returns:
id of the session
bool getIntParam ( const std::string  name,
int &  param 
) const

Return a custom 'integer' parameter from the session file.

Note:
This function should not be used from programming languages other than C++. Use getIntParam(const std::string) const instead.
See also:
saveIntParam()

See also Using custom parameters

Parameters:
nameName of the key value. Do not use an name with a leading underscore as these are reserved for system values.
paramIs the value of the parameter associated with the key name.
Returns:
boolean value to indicate if the value was successfully retrieved.
int getIntParam ( const std::string  name ) const

Return a custom 'integer' parameter from the session file.

If a value of 0 is returned, it is not possible to determine if this is because there is no key value or if a value of zero was set for the key.

See also:
saveIntParam()

See also Using custom parameters

Parameters:
nameName of the key value. Do not use an name with a leading underscore as these are reserved for system values.
Returns:
The value of the parameter associated with the key name.
std::string getIPAddress (  ) const

Return ip address of the currently logged in user.

Will be 'UNKNOWN' if authentication is turned off and for the guest account.

Returns:
IP address
time_t getLastAccessed (  ) const

Returns the time that the session was last updated.

Note that this time is not valid if authentication is turned off or the guest account is in use.

Returns:
last access time
int getLastError (  ) const [inherited]

Return the error description of the last error that occurred.

All errors are accumulated into a list in this object, until clearAllErrors() is called. This function returns the last error that occurred.

See Error Handling.

See also:
isValid(), getLastErrorString(), clearAllErrors(), getErrorHandler()
Returns:
the error number of the last error, or 0 if there have been no errors.

Reimplemented in ms_mascotresfile.

std::string getLastErrorString (  ) const [inherited]

Return the error description of the last error that occurred.

All errors are accumulated into a list in this object, until clearAllErrors() is called. This function returns the last error that occurred.

Returns:
Most recent error, warning, information or debug message

See Error Handling.

See also:
isValid(), getLastError(), clearAllErrors(), getErrorHandler()

Reimplemented in ms_mascotresfile.

Examples:
common_error.cpp, config_enzymes.cpp, config_fragrules.cpp, config_license.cpp, config_mascotdat.cpp, config_masses.cpp, config_modfile.cpp, config_procs.cpp, config_quantitation.cpp, config_taxonomy.cpp, http_helper_getstring.cpp, and tools_aahelper.cpp.
bool getLongParam ( const std::string  name,
long &  param 
) const

Return a custom 'long' parameter from the session file.

Note:
This function should not be used from programming languages other than C++. Use getLongParam(const std::string) const instead.
See also:
saveLongParam()

See also Using custom parameters

Parameters:
nameName of the key value. Do not use an name with a leading underscore as these are reserved for system values.
paramIs the value of the parameter associated with the key name.
Returns:
boolean value to indicate if the value was successfully retrieved.
long getLongParam ( const std::string  name ) const

Return a custom 'long' parameter from the session file.

If a value of 0 is returned, it is not possible to determine if this is because there is no key value or if a value of zero was set for the key.

See also:
saveLongParam()

See also Using custom parameters

Parameters:
nameName of the key value. Do not use an name with a leading underscore as these are reserved for system values.
Returns:
The value of the parameter associated with the key name.
std::map< std::string, std::string > getParams (  ) const

Returns a list of all the parameters saved in the session file.

Note:
Do not use this function from programming languages other than C++.
Returns:
array of key, value pairs.
ms_security_tasks getPermittedTasks (  ) const

Returns the permitted tasks for the currently logged in user.

Returns:
A 'list' of the tasks that can be performed by the user.
std::vector< int > getSpoofableUsers (  ) const

Returns a list of user IDs that can be spoofed.

This will return an empty list if ms_security_tasks::SECTASK_ALLOWSPOOFOTHERUSER has not been specified.

If ms_security_tasks::SECTASK_SPOOFNAMEDGROUPSONLY is not specified, then this function returns all users by calling ms_security::getAllUserIDs().

If ms_security_tasks::SECTASK_SPOOFNAMEDGROUPSONLY is specified, then only users belonging to the names groups will be returned. This could be an empty list if the named groups don't contain any users or if there is no list of groups.

When ms-status.exe (or get_params.pl) is called with the parameter Show=MS_USERS, this function is called to create a list of users. The output format from these programs is:

   "username","user id","user type","full name","email address"
   

For example:

    C:\Inetpub\mascot\x-cgi>ms-status.exe Show=MS_USERS
    Content-type: text/plain
 
    "guest","1","1","Guest user","guest@localhost"
    "admin","2","1","Administrator","admin@localhost"
    "daemon","4","1","Mascot Daemon","daemon@localhost"
    "(system)","6","2","Mascot Integra system account","integra@localhost"
   
Returns:
a vector of IDs that can be spoofed, sorted by login names. See Using STL vector classes vectori, vectord and VectorString in Perl, Java, Python and C#.
bool getStringParam ( const std::string  name,
std::string &  param 
) const

Return a custom 'string' parameter from the session file.

Note:
This function should not be used from programming languages other than C++. Use getStringParam(const std::string) const instead.
See also:
saveStringParam()

See also Using custom parameters

Parameters:
nameName of the key value. Do not use an name with a leading underscore as these are reserved for system values.
paramIs the value of the parameter associated with the key name.
Returns:
boolean value to indicate if the value was successfully retrieved.
std::string getStringParam ( const std::string  name ) const

Return a custom 'string' parameter from the session file.

If an empty string is returned, it is not possible to determine if this is because there is no key value or if an empty string was set for the key.

See also:
saveStringParam()

See also Using custom parameters

Parameters:
nameName of the key value. Do not use an name with a leading underscore as these are reserved for system values.
Returns:
Is the value of the parameter associated with the key name or an empty string if there is no key.
time_t getTimeout (  ) const

Returns the time when the session times out.

Note that the timeout is not valid if authentication is turned off or the guest account is in use.

A value of zero indicates it will never time out.

Note also that the timeout is set globally in the security settings, so the return value of this function is the same as calling ms_security_options::getSessionTimeout() . The only case where the two can differ is if 1) the user logs in and 2) the session timeout is changed globally after that.

Returns:
timeout
time_t getTimeParam ( const std::string  name ) const

Return a custom 'time' parameter from the session file.

If a value of 0 is returned, it is not possible to determine if this is because there is no key value or if a value of zero was set for the key.

See also:
saveTimeParam()

See also Using custom parameters

Parameters:
nameName of the key value. Do not use an name with a leading underscore as these are reserved for system values.
Returns:
The value of the parameter associated with the key name.
bool getTimeParam ( const std::string  name,
time_t &  param 
) const

Return a custom 'time' parameter from the session file.

Note:
This function should not be used from programming languages other than C++. Use getTimeParam(const std::string) const instead.
See also:
saveTimeParam()

See also Using custom parameters

Parameters:
nameName of the key value. Do not use an name with a leading underscore as these are reserved for system values.
paramIs the value of the parameter associated with the key name.
Returns:
boolean value to indicate if the value was successfully retrieved.
int getUserID (  ) const

Return the unique userid for the currently logged in user.

Returns:
The unique user id of the person logged in. There are several predefined IDs - see ms_user::systemids. Returns -1 if there is an error.
std::string getUserName (  ) const

Return the user 'login' name for the currently logged in user.

Note that this will not include spaces. The full user name is available by calling: getFullUserName().

Returns:
user name for this session
ms_user::usertype getUserType (  ) const

Returns the type of user.

Returns:
The user type as defined by the administrator using the administration utility.
bool isFastaPermitted ( const std::string  database ) const

Check if a particular fasta file can be accessed.

Check if a user has rights to search against a particular database This is a special case because SECTASK_NAMEDFASTA is the only 'negative' task (and only if SECTASK_ALLFASTA is set), so this specific call makes end user programs simpler.

See also:
ms_security_tasks::isFastaPermitted()
Parameters:
databaseis the database name -- for example MSDB.
Returns:
True if the user has rights to search this database.
bool isPermitted ( const int  taskID ) const

Check if the task is permitted.

Returns true if the user is allowed to perform the task. If security is disabled, then this always returns true.

Parameters:
taskIDTask IDs are stored in security_tasks.xml file.
Returns:
true if the user can accomplish the given task
bool isPermitted_double ( const int  taskID,
const double  value 
) const

Check if the value is in the floating point parameter list.

See also:
ms_security_task::isPermitted_double()
Parameters:
taskIDThe taskID normally from the matrix_science::ms_security_tasks::TASKID enumeration -- for example, matrix_science::ms_security_tasks::SECTASK_MAXQUERIES.
valueis the value for comparison.
Returns:
True if the tasks is permitted.
bool isPermitted_long ( const int  taskID,
const long  value 
) const

Check if the value is in the long integer parameter list.

For example, this could called by an application to determine if a user has rights to run a search with 1000 spectra.

See also:
ms_security_task::isPermitted_long()
Parameters:
taskIDThe taskID normally from the matrix_science::ms_security_tasks::TASKID enumeration -- for example, matrix_science::ms_security_tasks::SECTASK_MAXQUERIES.
valueis the value for comparison.
Returns:
True if the tasks is permitted.
bool isPermitted_string ( const int  taskID,
const std::string  value 
) const

Check if the value is in the string parameter list.

For example, this could called by an application to determine if a user has rights to run a search against the MSDB database.

See also:
ms_security_task::isPermitted_string()
Parameters:
taskIDThe taskID normally from the matrix_science::ms_security_tasks::TASKID enumeration -- for example, matrix_science::ms_security_tasks::SECTASK_NAMEDFASTA.
valueis the value for comparison.
Returns:
True if the tasks is permitted.
bool isSecurityEnabled (  ) const

Return true if the security system is enabled.

If this returns false, then isPermitted() will also always return true.

Returns:
true if security is enabled, false otherwise
bool isTimedOut (  ) const

Returns true if the current session has timed out.

Some sessions such as the commandline session will never time out.

Returns:
boolean value to indicate if the session has timed out.
bool isValid (  ) const [inherited]

Call this function to determine if there have been any errors.

This will return true unless there have been any fatal errors.

See Error Handling.

Returns:
True if no fatal error occured
See also:
getLastError(), getLastErrorString(), clearAllErrors(), getErrorHandler()
Examples:
common_error.cpp, config_enzymes.cpp, config_fragrules.cpp, config_license.cpp, config_mascotdat.cpp, config_masses.cpp, config_modfile.cpp, config_procs.cpp, config_quantitation.cpp, config_taxonomy.cpp, http_helper_getstring.cpp, peptide_list.cpp, resfile_summary.cpp, and tools_aahelper.cpp.
bool saveBoolParam ( const std::string  name,
bool  param 
)

Save a custom 'bool' parameter in the session file.

This can be useful for saving additional information that will be available to a cgi program later on in the same session. The value can be retrieved using getBoolParam().

This function will fail if isValid() is false.

There is just one list of parameters saved in the session for all types, so the same name shouldn't be used for say both integer and string values.

See also Using custom parameters

Parameters:
nameName of the key value. Do not use an name with a leading underscore as these are reserved for system values.
paramThe value to be assigned to the key.
Returns:
true if the value is successfully saved.
bool saveDoubleParam ( const std::string  name,
double  param 
)

Save a custom 'double' parameter in the session file.

This can be useful for saving additional information that will be available to a cgi program later on in the same session. The value can be retrieved using getDoubleParam().

This function will fail if isValid() is false.

There is just one list of parameters saved in the session for all types, so the same name shouldn't be used for say both integer and string values.

See also Using custom parameters

Parameters:
nameName of the key value. Do not use an name with a leading underscore as these are reserved for system values.
paramThe value to be assigned to the key.
Returns:
true if the value is successfully saved.
bool saveIntParam ( const std::string  name,
int  param 
)

Save a custom 'integer' parameter in the session file.

This can be useful for saving additional information that will be available to a CGI program later on in the same session. The value can be retrieved using getIntParam().

This function will fail if isValid() is false.

There is just one list of parameters saved in the session for all types, so the same name shouldn't be used for say both integer and string values.

See also Using custom parameters

Parameters:
nameName of the key value. Do not use an name with a leading underscore as these are reserved for system values.
paramThe value to be assigned to the key.
Returns:
true if the value is successfully saved.
bool saveLongParam ( const std::string  name,
long  param 
)

Save a custom 'long integer' parameter in the session file.

This can be useful for saving additional information that will be available to a cgi program later on in the same session. The value can be retrieved using getLongParam().

This function will fail if isValid() is false.

There is just one list of parameters saved in the session for all types, so the same name shouldn't be used for say both integer and string values.

See also Using custom parameters

Parameters:
nameName of the key value. Do not use an name with a leading underscore as these are reserved for system values.
paramThe value to be assigned to the key.
Returns:
true if the value is successfully saved.
bool saveStringParam ( const std::string  name,
const std::string  param 
)

Save a custom 'string' parameter in the session file.

This can be useful for saving additional information that will be available to a CGI program later on in the same session. The value can be retrieved using getStringParam().

This function will fail if isValid() is false.

There is just one list of parameters saved in the session for all types, so the same name shouldn't be used for say both integer and string values.

See also Using custom parameters

Parameters:
nameName of the key value. Do not use an name with a leading underscore as these are reserved for system values.
paramThe value to be assigned to the key.
Returns:
true if the value is successfully saved.
bool saveTimeParam ( const std::string  name,
time_t  param 
)

Save a custom 'time' parameter in the session file.

This can be useful for saving additional information that will be available to a cgi program later on in the same session. The value can be retrieved using getTimeParam().

This function will fail if isValid() is false.

There is just one list of parameters saved in the session for all types, so the same name shouldn't be used for say both integer and string values.

See also Using custom parameters

Parameters:
nameName of the key value. Do not use an name with a leading underscore as these are reserved for system values.
paramThe value to be assigned to the key.
Returns:
true if the value is successfully saved.
bool setPermittedTasks ( const matrix_science::ms_security_tasks val )

Sets the permitted tasks for the currently logged in user.

This function is called by the administration utility so that it can save a list of tasks in a temporary session. It shouldn't normally be called by other applications.

Parameters:
valis the 'list' of the tasks that can be performed by the user.
Returns:
true if everything is valid and no error occurred, false otherwise

The documentation for this class was generated from the following files:

Copyright © 2022 Matrix Science Ltd.  All Rights Reserved. Generated on Thu Mar 31 2022 01:12:38