A set of privileges granted to a particular user for a particular study. More...
#include <Role.h>
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. | |
Role & | operator= (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. | |
Role & | setRoleLocation (const std::string &loc) |
Set the role location. | |
std::string | getRoleLocation () const |
Return the role location. | |
Role & | setUserIdentifier (const std::string &userIdentifier) |
Set the user identifier. | |
std::string | getUserIdentifier () const |
Return the user identifier. | |
Role & | setUserName (const std::string &name) |
Set the user name. | |
std::string | getUserName () const |
Return the user name. | |
Role & | setStudyIdentifier (const std::string &studyIdentifier) |
Set the study identifier. | |
std::string | getStudyIdentifier () const |
Return the study identifier. | |
Role & | setStudyName (const std::string &name) |
Set the study name. | |
std::string | getStudyName () const |
Return the study name. | |
Role & | addPrivilege (Privilege privilege) |
Add a privilege. | |
Role & | removePrivilege (Privilege privilege) |
Remove a privilege. | |
Role & | addAllPrivileges () |
Add all privileges. | |
Role & | removeAllPrivileges () |
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 |
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:
Definition at line 42 of file Role.h.
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.
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 | ) |
Role::~Role | ( | ) | [virtual] |
Role & Role::addAllPrivileges | ( | ) |
Add all privileges.
All privileges are granted.
Role
. Definition at line 153 of file Role.cpp.
References privilegeSet.
Add a privilege.
Grant a specific privilege.
privilege | is the privilege to grant. |
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.
privilege | is the privilege to check for. |
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.
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.
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.
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.
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.
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 |
Assignment operator - assign one Role
to another.
rhs | the righthand side of the assignment. |
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.
rhs | the righthand side of the equality. |
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.
Role
. Definition at line 160 of file Role.cpp.
References privilegeSet.
Remove a privilege.
A specific privilege is removed.
privilege | is the privilege to remove. |
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.
loc | the location to assign to this role. May be null. |
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.
studyIdentifier | the study identifier to assign to this role. |
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.
name | the name to assign to the study of this role. May be null. |
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.
userIdentifier | the user identifier to assign to this role. |
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.
name | the user name to assign to this role. May be null. |
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
.
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
.
showAll | specifies if internal data members should be shown. |
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().
std::bitset<Privilege::NUMBER_OF_PRIVILEGES> Yosokumo::Role::privilegeSet [private] |
Definition at line 52 of file Role.h.
Referenced by addAllPrivileges(), addPrivilege(), getPrivilege(), operator=(), operator==(), removeAllPrivileges(), removePrivilege(), and Role().
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().