Yosokumo::Role Class Reference

A set of privileges granted to a particular user for a particular study. More...

#include <Role.h>

List of all members.

Public Member Functions

 Role ()
 Initializes a newly created Role object with default attributes.
 Role (const std::string &userIdentifier, const std::string &studyIdentifier)
 Initializes a newly created Role object with attributes specified by the input parameters.
 Role (const Role &rhs)
 Copy constructor - initializes a newly created Role object with a copy of another Role object.
virtual ~Role ()
 Destructor - destroy a Role object.
Roleoperator= (const Role &rhs)
 Assignment operator - assign one Role to another.
bool operator== (const Role &rhs) const
 Equality operator - compare two Roles for equality.
bool operator!= (const Role &rhs) const
 Inequality operator - compare two Roles for inequality.
RolesetRoleLocation (const std::string &loc)
 Set the role location.
std::string getRoleLocation () const
 Return the role location.
RolesetUserIdentifier (const std::string &userIdentifier)
 Set the user identifier.
std::string getUserIdentifier () const
 Return the user identifier.
RolesetUserName (const std::string &name)
 Set the user name.
std::string getUserName () const
 Return the user name.
RolesetStudyIdentifier (const std::string &studyIdentifier)
 Set the study identifier.
std::string getStudyIdentifier () const
 Return the study identifier.
RolesetStudyName (const std::string &name)
 Set the study name.
std::string getStudyName () const
 Return the study name.
RoleaddPrivilege (Privilege privilege)
 Add a privilege.
RoleremovePrivilege (Privilege privilege)
 Remove a privilege.
RoleaddAllPrivileges ()
 Add all privileges.
RoleremoveAllPrivileges ()
 Remove all privileges.
bool getPrivilege (Privilege privilege) const
 Get a specific privilege.
std::string toString () const
 Return a string representation of this Role.
std::string toStringInternal (bool showAll) const
 Return a string representation of this Role.

Private Attributes

std::string userIdentifier
std::string userName
std::string studyIdentifier
std::string studyName
std::string roleLocation
std::bitset
< Privilege::NUMBER_OF_PRIVILEGES > 
privilegeSet

Detailed Description

A set of privileges granted to a particular user for a particular study.

One of the privileges granted to a study creator is the authority to create new roles on the study for other enrolled users. In this way, the study creator can allow others to load data, get predictions, view study statistics, or even themselves grant privileges on the study to other users. Roles may be severely limited or provide full access and may be changed or revoked at any time.

When an enrolled user creates a study, he is authorized automatically to perform any action on that study. More precisely, when a study is created, the service simultaneously creates a role for the creator on the newly created study in which all privileges are set to true.

A single user may have a role on many studies; conversely, many users may have a role on a single study. The list of studies on which a particular user has a role is called the catalog for that user. The list of users that have a role on a particular study is called the roster for that study.

A Role has these attributes:

Author:
Roger House
Version:
0.9

Definition at line 42 of file Role.h.


Constructor & Destructor Documentation

Role::Role (  ) 

Initializes a newly created Role object with default attributes.

Definition at line 11 of file Role.cpp.

References privilegeSet.

Role::Role ( const std::string &  userIdentifier,
const std::string &  studyIdentifier 
)

Initializes a newly created Role object with attributes specified by the input parameters.

Parameters:
userIdentifier the user who has the role.
studyIdentifier the study on which the user has the role.

Definition at line 21 of file Role.cpp.

References privilegeSet.

Role::Role ( const Role rhs  ) 

Copy constructor - initializes a newly created Role object with a copy of another Role object.

Parameters:
rhs the Role to make a copy of.

Definition at line 33 of file Role.cpp.

References operator=().

Role::~Role (  )  [virtual]

Destructor - destroy a Role object.

Definition at line 38 of file Role.cpp.


Member Function Documentation

Role & Role::addAllPrivileges (  ) 

Add all privileges.

All privileges are granted.

Returns:
this Role.

Definition at line 153 of file Role.cpp.

References privilegeSet.

Role & Role::addPrivilege ( Privilege  privilege  ) 

Add a privilege.

Grant a specific privilege.

Parameters:
privilege is the privilege to grant.
Returns:
this Role.

Definition at line 139 of file Role.cpp.

References Yosokumo::Privilege::getNumber(), and privilegeSet.

Referenced by Yosokumo::YosokumoProtobuf::makeRoleFromProtobufRole().

bool Role::getPrivilege ( Privilege  privilege  )  const

Get a specific privilege.

Parameters:
privilege is the privilege to check for.
Returns:
true if privilege is granted, false otherwise.

Definition at line 167 of file Role.cpp.

References Yosokumo::Privilege::getNumber(), and privilegeSet.

Referenced by Yosokumo::YosokumoProtobuf::makeProtobufRoleFromRole(), and toStringInternal().

std::string Role::getRoleLocation (  )  const

Return the role location.

Returns:
the location of this role. May be null.

Definition at line 87 of file Role.cpp.

References roleLocation.

Referenced by Yosokumo::YosokumoProtobuf::makeProtobufRoleFromRole(), and toStringInternal().

std::string Role::getStudyIdentifier (  )  const

Return the study identifier.

Returns:
the study identifier of this role. May be null.

Definition at line 120 of file Role.cpp.

References studyIdentifier.

Referenced by Yosokumo::YosokumoProtobuf::makeProtobufRoleFromRole(), and toStringInternal().

std::string Role::getStudyName (  )  const

Return the study name.

Returns:
the name of the study of this role. May be null.

Definition at line 131 of file Role.cpp.

References studyName.

Referenced by Yosokumo::YosokumoProtobuf::makeProtobufRoleFromRole(), and toStringInternal().

std::string Role::getUserIdentifier (  )  const

Return the user identifier.

Returns:
the user identifier of this role. May be null.

Definition at line 98 of file Role.cpp.

References userIdentifier.

Referenced by Yosokumo::Roster::addRole(), Yosokumo::YosokumoProtobuf::makeProtobufRoleFromRole(), Yosokumo::Roster::operator==(), Yosokumo::Roster::toStringInternal(), and toStringInternal().

std::string Role::getUserName (  )  const

Return the user name.

Returns:
the name of the user of this role. May be null.

Definition at line 109 of file Role.cpp.

References userName.

Referenced by Yosokumo::YosokumoProtobuf::makeProtobufRoleFromRole(), Yosokumo::Roster::toStringInternal(), and toStringInternal().

bool Role::operator!= ( const Role rhs  )  const

Inequality operator - compare two Roles for inequality.

Parameters:
rhs the righthand side of the inequality.
Returns:
true if and only if this Roles and the righthand side Roles are not identically equal.

Definition at line 73 of file Role.cpp.

Role & Role::operator= ( const Role rhs  ) 

Assignment operator - assign one Role to another.

Parameters:
rhs the righthand side of the assignment.
Returns:
a reference to this Role.

Definition at line 41 of file Role.cpp.

References privilegeSet, roleLocation, studyIdentifier, studyName, userIdentifier, and userName.

Referenced by Role().

bool Role::operator== ( const Role rhs  )  const

Equality operator - compare two Roles for equality.

Parameters:
rhs the righthand side of the equality.
Returns:
true if and only if this Roles and the righthand side Roles are identically equal.

Definition at line 60 of file Role.cpp.

References privilegeSet, roleLocation, studyIdentifier, studyName, userIdentifier, and userName.

Role & Role::removeAllPrivileges (  ) 

Remove all privileges.

Returns:
this Role.

Definition at line 160 of file Role.cpp.

References privilegeSet.

Role & Role::removePrivilege ( Privilege  privilege  ) 

Remove a privilege.

A specific privilege is removed.

Parameters:
privilege is the privilege to remove.
Returns:
this Role.

Definition at line 146 of file Role.cpp.

References Yosokumo::Privilege::getNumber(), and privilegeSet.

Role & Role::setRoleLocation ( const std::string &  loc  ) 

Set the role location.

Parameters:
loc the location to assign to this role. May be null.
Returns:
this Role.

Definition at line 81 of file Role.cpp.

References roleLocation.

Referenced by Yosokumo::YosokumoProtobuf::makeRoleFromProtobufRole().

Role & Role::setStudyIdentifier ( const std::string &  studyIdentifier  ) 

Set the study identifier.

Parameters:
studyIdentifier the study identifier to assign to this role.
Returns:
this Role.

Definition at line 114 of file Role.cpp.

Referenced by Yosokumo::YosokumoProtobuf::makeRoleFromProtobufRole().

Role & Role::setStudyName ( const std::string &  name  ) 

Set the study name.

Parameters:
name the name to assign to the study of this role. May be null.
Returns:
this Role.

Definition at line 125 of file Role.cpp.

References studyName.

Referenced by Yosokumo::YosokumoProtobuf::makeRoleFromProtobufRole().

Role & Role::setUserIdentifier ( const std::string &  userIdentifier  ) 

Set the user identifier.

Parameters:
userIdentifier the user identifier to assign to this role.
Returns:
this Role.

Definition at line 92 of file Role.cpp.

Referenced by Yosokumo::YosokumoProtobuf::makeRoleFromProtobufRole().

Role & Role::setUserName ( const std::string &  name  ) 

Set the user name.

Parameters:
name the user name to assign to this role. May be null.
Returns:
this Role.

Definition at line 103 of file Role.cpp.

References userName.

Referenced by Yosokumo::YosokumoProtobuf::makeRoleFromProtobufRole().

std::string Role::toString (  )  const

Return a string representation of this Role.

Returns:
the string representation of this Role.

Definition at line 175 of file Role.cpp.

References toStringInternal().

std::string Role::toStringInternal ( bool  showAll  )  const

Return a string representation of this Role.

Parameters:
showAll specifies if internal data members should be shown.
Returns:
the string representation of this Role.

Definition at line 180 of file Role.cpp.

References Yosokumo::Privilege::getName(), getPrivilege(), getRoleLocation(), getStudyIdentifier(), getStudyName(), getUserIdentifier(), getUserName(), Yosokumo::Privilege::NUMBER_OF_PRIVILEGES, and Yosokumo::Privilege::valueOf().

Referenced by toString().


Member Data Documentation

std::bitset<Privilege::NUMBER_OF_PRIVILEGES> Yosokumo::Role::privilegeSet [private]
std::string Yosokumo::Role::roleLocation [private]

Definition at line 50 of file Role.h.

Referenced by getRoleLocation(), operator=(), operator==(), and setRoleLocation().

std::string Yosokumo::Role::studyIdentifier [private]

Definition at line 47 of file Role.h.

Referenced by getStudyIdentifier(), operator=(), and operator==().

std::string Yosokumo::Role::studyName [private]

Definition at line 48 of file Role.h.

Referenced by getStudyName(), operator=(), operator==(), and setStudyName().

std::string Yosokumo::Role::userIdentifier [private]

Definition at line 44 of file Role.h.

Referenced by getUserIdentifier(), operator=(), and operator==().

std::string Yosokumo::Role::userName [private]

Definition at line 45 of file Role.h.

Referenced by getUserName(), operator=(), operator==(), and setUserName().


The documentation for this class was generated from the following files:
Generated on Mon May 13 09:19:12 2013 for C++ Yosokumo API by  doxygen 1.6.3