Matrix Science header
Public Types | Public Member Functions

ms_group Class Reference
[Mascot security and authentication module]

This class will normally only be used by Mascot Security Administration applications. More...

#include <ms_security_group.hpp>

Collaboration diagram for ms_group:
Collaboration graph
[legend]

List of all members.

Public Types

enum  systemids {
  GROUPID_GUESTS = 0x0001,
  GROUPID_ADMINISTRATORS = 0x0002,
  GROUPID_POWERUSERS = 0x0003,
  GROUPID_DAEMONS = 0x0004,
  GROUPID_INTEGRA_SYSTEM = 0x0005,
  GROUPID_LAST = 0x0006
}
 

Definitions for predefined groups.

More...

Public Member Functions

 ms_group ()
 Create a new ms_group.
 ms_group (const int groupID, const std::string groupName)
 Create a new ms_group.
void addPermittedTask (const matrix_science::ms_security_task &task)
 Each group has one or more permitted tasks. Use this function to add to the list.
bool addUser (const int userID)
 Each group has one or more users. Use this function to add a user.
bool clearParam (const std::string name)
 Remove an additional user parameter associated with the group.
bool deleteUser (const int userID)
 Each group has one or more users. Use this function to delete a user.
std::vector< int > getAllUserIDs (const void *const security=NULL, const int voidSortby=1) const
 Return a list of user ids in the group.
int getID () const
 Return the unique group ID.
std::string getName () const
 Return the name of the group.
matrix_science::ms_security_tasks getPermittedTasks () const
 Return the list of permitted tasks.
bool getStringParam (const std::string name, std::string &param) const
 Return a custom parameter for the group.
std::string getStringParam (const std::string name) const
 Return a custom parameter for the group.
bool isUserInGroup (const int userID) const
 Returns true if the user is a member of the group.
bool removePermittedTask (const int taskID)
 Each group has one or more permitted tasks. Use this function to remove one from the list.
bool saveStringParam (const std::string name, const std::string param)
 Save an additional 'string' parameter for the group.
void setID (int newVal)
 Set the unique group ID.
void setName (const std::string newVal)
 Set the name of the group.
void setPermittedTasks (matrix_science::ms_security_tasks &tasks)
 Sets the list of permitted tasks.

Detailed Description

This class will normally only be used by Mascot Security Administration applications.


Member Enumeration Documentation

enum systemids

Definitions for predefined groups.

See Using enumerated values and static const ints in Perl, Java, Python and C#.

Enumerator:
GROUPID_GUESTS 

The guests group. By default, the matrix_science::ms_user::USERID_GUEST user belongs to this group.

GROUPID_ADMINISTRATORS 

The Administrators group. By default, the matrix_science::ms_user::USERID_ADMINISTRATOR user belongs to this group.

GROUPID_POWERUSERS 

An example group for users who need access to almost everything.

GROUPID_DAEMONS 

Mascot Daemon needs to be set up with a user to run searches. By default, the matrix_science::ms_user::USERID_DAEMON user belongs to this group.

GROUPID_INTEGRA_SYSTEM 
Deprecated:
The Mascot Integra system group, only member is normally USERID_INTEGRA_SYSTEM. Users will never be able to log in as this user - it is only used from the Integra server.
GROUPID_LAST 

Placeholder.


Member Function Documentation

void addPermittedTask ( const matrix_science::ms_security_task task )

Each group has one or more permitted tasks. Use this function to add to the list.

The function ms_security::updateGroup() should be called after this function to save the change permanently.

Parameters:
taskThe new task, which should be obtained by calling ms_security::getTasks(), to get a list of all possible tasks, and then calling ms_security::tasks::getTask() or ms_security::tasks::getTaskFromID() to get the particular task. If additional parameters are required for the task, (e.g. for maximum number of MS-MS spectra), then this data should be added using one of the addXXXParam functions (e.g. ms_security_task::addLongParam()) before calling this function.
bool addUser ( const int  userID )

Each group has one or more users. Use this function to add a user.

Add the user to this group. Since a user ID remains constant, but the user name can be altered, it is the userID that is associated with the group rather than the name. After adding a user to a group call ms_security::updateGroup().

Parameters:
userIDThe unique ID of the user to be added to the group.
Returns:
true if the userID is at least zero and if insertion succeeds, false otherwise
bool clearParam ( const std::string  name )

Remove an additional user parameter associated with the group.

Additional custom data for a group are saved in a <mss:custom_parameters> section in the group.xml file.

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

To make the changes permanent, use ms_security::updateGroup().

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.
bool deleteUser ( const int  userID )

Each group has one or more users. Use this function to delete a user.

The function ms_security::updateGroup() should be called after this function to save the change permanently.

Parameters:
userIDMust be a valid userID for a user that belongs to the group.
Returns:
True if the user is found, and can be deleted.
std::vector< int > getAllUserIDs ( const void *const   security = NULL,
const int  voidSortby = 1 
) const

Return a list of user ids in the group.

To get information about each of the userIDs returned, call ms_security::getUserFromID() to return a matrix_science::ms_user object.

Parameters:
securityShould be a valid pointer to an ms_security object, by default it is NULL
voidSortbyShould be a valid ms_security::USERID_SORTBY, by default it is 1
Returns:
A vector of userIDs. See Using STL vector classes vectori, vectord and VectorString in Perl, Java, Python and C#.
std::string getName (  ) const

Return the name of the group.

Each group will have a unique name, and a unique ID.

Returns:
The name of this group.
std::string getStringParam ( const std::string  name ) const

Return a custom parameter for the group.

Additional custom data for a group are saved in a <mss:custom_parameters> section in the group.xml 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.
bool getStringParam ( const std::string  name,
std::string &  param 
) const

Return a custom parameter for the group.

Additional custom data for a group are saved in a <mss:custom_parameters> section in the group.xml 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.
bool isUserInGroup ( const int  userID ) const

Returns true if the user is a member of the group.

Parameters:
userIDShould be a valid userID.
Returns:
True if the user is found.
bool removePermittedTask ( const int  taskID )

Each group has one or more permitted tasks. Use this function to remove one from the list.

Parameters:
taskIDMust be a task ID for a task currently assigned to the group.
Returns:
True if the task was removed.
bool saveStringParam ( const std::string  name,
const std::string  param 
)

Save an additional 'string' parameter for the group.

Additional custom data for a group are saved in a <mss:custom_parameters> section in the group.xml file.

The value can be retrieved using getStringParam().

To make the changes permanent, use ms_security::updateGroup().

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.
void setID ( int  newVal )

Set the unique group ID.

The function ms_security::updateGroup() should be called after this function to save the change permanently.

Parameters:
newValIs the new ID for the group. This function does not normally need to be called by an application. New groups should be added by calling ms_security::addNewGroup().
void setName ( const std::string  newVal )

Set the name of the group.

Each group will have a unique name, and a unique ID.

The function ms_security::updateGroup() should be called after this function to save the change permanently.

Parameters:
newValThe new name of this group.
void setPermittedTasks ( matrix_science::ms_security_tasks tasks )

Sets the list of permitted tasks.

The function ms_security::updateGroup() should be called after this function to save the change permanently.

Parameters:
tasksa list of tasks to copy from.

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:32