Platform independent representation of system user.
More...
#include <arc/User.h>
|
| User () |
| Construct user from current process owner. More...
|
|
| User (const std::string &name, const std::string &group="") |
| Construct user from username and optional group name. More...
|
|
| User (int uid, int gid=-1) |
| Construct user from uid and optional gid. More...
|
|
| operator bool () const |
| Returns true if this is a valid user. More...
|
|
bool | operator! () const |
| Returns true is this is not a valid user. More...
|
|
const std::string & | Name (void) const |
| Returns the name of this user. More...
|
|
const std::string & | Home (void) const |
| Returns the path to the user's home directory. More...
|
|
int | get_uid (void) const |
| Returns the user's uid. More...
|
|
int | get_gid (void) const |
| Returns the user's gid. More...
|
|
bool | operator== (const std::string &n) |
| Returns true if this User's name is the same as n. More...
|
|
int | check_file_access (const std::string &path, int flags) const |
| Check if this User has the rights specified by flags on the given path. More...
|
|
bool | SwitchUser () const |
| Change the owner of the current process. More...
|
|
Platform independent representation of system user.
Construct user from current process owner.
Arc::User::User |
( |
const std::string & |
name, |
|
|
const std::string & |
group = "" |
|
) |
| |
Construct user from username and optional group name.
If group is not specified it is determined automatically.
Arc::User::User |
( |
int |
uid, |
|
|
int |
gid = -1 |
|
) |
| |
Construct user from uid and optional gid.
If gid is not specified it is determined automatically.
int Arc::User::check_file_access |
( |
const std::string & |
path, |
|
|
int |
flags |
|
) |
| const |
Check if this User has the rights specified by flags on the given path.
- Returns
- 0 if User has the rights
int Arc::User::get_gid |
( |
void |
| ) |
const |
|
inline |
int Arc::User::get_uid |
( |
void |
| ) |
const |
|
inline |
const std::string& Arc::User::Home |
( |
void |
| ) |
const |
|
inline |
Returns the path to the user's home directory.
const std::string& Arc::User::Name |
( |
void |
| ) |
const |
|
inline |
Returns the name of this user.
Arc::User::operator bool |
( |
| ) |
const |
|
inline |
Returns true if this is a valid user.
bool Arc::User::operator! |
( |
void |
| ) |
const |
|
inline |
Returns true is this is not a valid user.
- Python interface deviation
- Method is unavailable in Python interface
- Java interface deviation
- Method is unavailable in Java interface
bool Arc::User::operator== |
( |
const std::string & |
n | ) |
|
|
inline |
Returns true if this User's name is the same as n.
bool Arc::User::SwitchUser |
( |
| ) |
const |
Change the owner of the current process.
Internally this method calls setuid() and setgid() with this User's values. It can be used in the initializer of Arc::Run to switch the owner of a child process just after fork(). To temporarily change the owner of a thread in a multi-threaded environment UserSwitch should be used instead.
- Returns
- true if switch succeeded.
The documentation for this class was generated from the following file: