|
ARC SDK
|
Platform independent representation of system user. More...
#include <arc/User.h>
Public Member Functions | |
| User () | |
| Construct user from current process owner. | |
| 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. | |
| bool | operator! () const |
| Returns true is this is not a valid user. | |
| const std::string & | Name (void) const |
| Returns the name of this user. | |
| const std::string & | Home (void) const |
| Returns the path to the user's home directory. | |
| int | get_uid (void) const |
| Returns the user's uid. | |
| int | get_gid (void) const |
| Returns the user's gid. | |
| bool | operator== (const std::string &n) |
| Returns true if this User's name is the same as n. | |
| 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.
| 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 |
| 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.
1.8.3.1