Class which represents a system user.
More...
#include <User.hpp>
Class which represents a system user.
◆ User() [1/3]
rstudio::launcher_plugins::system::User::User |
( |
bool |
in_isEmpty = false | ) |
|
|
explicit |
Constructor.
Creates a user object which is either empty or represents all users.
- Parameters
-
in_isEmpty | True to create an empty user; False to create a user which represents all users. Default: false. |
◆ User() [2/3]
rstudio::launcher_plugins::system::User::User |
( |
const User & |
in_other | ) |
|
Copy constructor.
- Parameters
-
in_other | The user to copy. |
◆ User() [3/3]
rstudio::launcher_plugins::system::User::User |
( |
User && |
in_other | ) |
|
|
defaultnoexcept |
Move constructor.
- Parameters
-
in_other | The user to move into this User. |
◆ exists()
bool rstudio::launcher_plugins::system::User::exists |
( |
| ) |
const |
Checks whether the user represented by this object exists.
If this is an empty user, or is a user object which represents all users, this method will return false as it does not represent a user which exists on the system.
- Returns
- True if this user exists; false otherwise.
◆ getCurrentUser()
static Error rstudio::launcher_plugins::system::User::getCurrentUser |
( |
User & |
out_currentUser | ) |
|
|
static |
Gets the current user.
- Parameters
-
out_currentUser | The user this process is currently executing on behalf of. This object will be the empty user if this function returns an error. |
- Returns
- Success if the user could be retrieved; Error otherwise.
◆ getGroupId()
GidType rstudio::launcher_plugins::system::User::getGroupId |
( |
| ) |
const |
Gets the ID of this user's primary group.
- Returns
- The ID of this user's primary group.
◆ getHomePath()
const FilePath& rstudio::launcher_plugins::system::User::getHomePath |
( |
| ) |
const |
Gets the user home path, if it exists.
- Returns
- The user's home path, if it exists; empty path otherwise.
◆ getRealName()
const std::string& rstudio::launcher_plugins::system::User::getRealName |
( |
| ) |
const |
Returns the user's real name ("John Doe", not "jdoe")
- Returns
- The real name of this user. Not available on all systems and configurations; an empty string is returned if the value is not known.
◆ getShell()
const std::string& rstudio::launcher_plugins::system::User::getShell |
( |
| ) |
const |
Returns the login shell of this user.
- Returns
- The login shell of this user.
◆ getUserFromIdentifier() [1/2]
static Error rstudio::launcher_plugins::system::User::getUserFromIdentifier |
( |
const std::string & |
in_username, |
|
|
User & |
out_user |
|
) |
| |
|
static |
Gets a user from its username.
- Parameters
-
in_username | The name of the user to create. |
out_user | The created user. |
- Returns
- Success if the user could be retrieved; Error otherwise.
◆ getUserFromIdentifier() [2/2]
static Error rstudio::launcher_plugins::system::User::getUserFromIdentifier |
( |
UidType |
in_userId, |
|
|
User & |
out_user |
|
) |
| |
|
static |
Gets a user from its user ID.
- Parameters
-
in_userId | The ID of the user to create. |
out_user | The created user. |
- Returns
- Success if the user could be retrieved; Error otherwise.
◆ getUserHomePath()
static FilePath rstudio::launcher_plugins::system::User::getUserHomePath |
( |
const std::string & |
in_envOverride = std::string() | ) |
|
|
static |
Gets the user home path, as set in the environment.
- Parameters
-
in_envOverride | If set, overrides the name of the environment variable to use as the user's home path. Multiple overrides may be specified by delimiting them with '|' in order of precedence. |
- Returns
- The user home path, as set in the environment.
◆ getUserId()
UidType rstudio::launcher_plugins::system::User::getUserId |
( |
| ) |
const |
Gets the ID of this user.
- Returns
- The ID of this user.
◆ getUsername()
const std::string& rstudio::launcher_plugins::system::User::getUsername |
( |
| ) |
const |
Returns the name of this user.
- Returns
- The name of this user ("*" for all users).
◆ isAllUsers()
bool rstudio::launcher_plugins::system::User::isAllUsers |
( |
| ) |
const |
Returns whether this object represents all users or not. See the default constructor for more details.
- Returns
- True if this object represents all users; false otherwise.
◆ isEmpty()
bool rstudio::launcher_plugins::system::User::isEmpty |
( |
| ) |
const |
Checks whether this user is empty or not.
- Returns
- True if this is user is empty; False otherwise.
◆ operator!=()
bool rstudio::launcher_plugins::system::User::operator!= |
( |
const User & |
in_other | ) |
const |
Inequality operator.
- Parameters
-
in_other | The user to compare with this user. |
- Returns
- False if this user and in_other have the same user ID; true otherwise.
◆ operator=() [1/2]
User& rstudio::launcher_plugins::system::User::operator= |
( |
const User & |
in_other | ) |
|
Overloaded assignment operator.
- Parameters
-
in_other | The user to copy to this one. |
- Returns
- This user.
◆ operator=() [2/2]
User& rstudio::launcher_plugins::system::User::operator= |
( |
User && |
in_other | ) |
|
|
defaultnoexcept |
Overloaded move operator.
- Parameters
-
in_other | The user to move to this one. |
- Returns
- This user.
◆ operator==()
bool rstudio::launcher_plugins::system::User::operator== |
( |
const User & |
in_other | ) |
const |
Equality operator.
- Parameters
-
in_other | The user to compare with this user. |
- Returns
- True if this user and in_other have the same user ID; false otherwise.
The documentation for this class was generated from the following file:
- /var/lib/jenkins/workspace/IDE/launcher-plugin-sdk/master/sdk/include/system/User.hpp