This class will normally only be used by Mascot Security Administration applications. More...
#include <ms_security_group.hpp>
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. | |
std::string | getStringParam (const std::string name) const |
Return a custom parameter for the group. | |
bool | getStringParam (const std::string name, std::string ¶m) 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. | |
This class will normally only be used by Mascot Security Administration applications.
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 |
|
GROUPID_LAST | Placeholder. |
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.
task | The 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().
userID | The unique ID of the user to be added to the group. |
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
name | Name of the key value. Do not use an name with a leading underscore as these are reserved for system values. |
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.
userID | Must be a valid userID for a user that belongs to the group. |
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.
security | Should be a valid pointer to an ms_security object, by default it is NULL |
voidSortby | Should be a valid ms_security::USERID_SORTBY, by default it is 1 |
std::string getName | ( | ) | const |
Return the name of the group.
Each group will have a unique name, and a unique ID.
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 Using custom parameters
name | Name of the key value. Do not use an name with a leading underscore as these are reserved for system values. |
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.
See also Using custom parameters
name | Name of the key value. Do not use an name with a leading underscore as these are reserved for system values. |
param | Is the value of the parameter associated with the key name. |
bool isUserInGroup | ( | const int | userID | ) | const |
Returns true if the user is a member of the group.
userID | Should be a valid userID. |
bool removePermittedTask | ( | const int | taskID | ) |
Each group has one or more permitted tasks. Use this function to remove one from the list.
taskID | Must be a task ID for a task currently assigned to the group. |
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
name | Name of the key value. Do not use an name with a leading underscore as these are reserved for system values. |
param | The value to be assigned to the key. |
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.
newVal | Is 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.
newVal | The 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.
tasks | a list of tasks to copy from. |