49 std::string m_username;
50 std::string m_homedir;
52 std::vector<id_t> m_gid_list;
54 static bool set_groups(
const std::vector<id_t>& list)
noexcept;
55 static bool set_effective_gid(
id_t group_id)
noexcept;
56 static bool set_effective_uid(
id_t user_id)
noexcept;
58 static bool get_groups(std::vector<id_t>& list)
noexcept;
59 static bool get_env_uid(
id_t& res_uid,
const bool try_sudo)
noexcept;
60 static bool get_env_username(std::string&
username,
const bool try_sudo)
noexcept;
65 static bool get_creds(
const std::string& username_lookup,
id_t& res_uid,
id_t& res_gid, std::string&
username, std::string&
homedir, std::string&
shell)
noexcept;
77 bool isValid() const noexcept {
return m_valid; }
78 id_t uid() const noexcept {
return m_uid; }
79 id_t gid() const noexcept {
return m_gid; }
80 const std::string&
username() const noexcept {
return m_username; }
81 const std::string&
homedir() const noexcept {
return m_homedir; }
82 const std::string&
shell() const noexcept {
return m_shell; }
83 const std::vector<id_t>&
groups() const noexcept {
return m_gid_list; }
86 std::string s =
"UserInfo['";
89 .append(
", home '").append(
homedir()).append(
"', shell '").append(
shell())
User account information of the underlying OS.
const std::string & homedir() const noexcept
id_t gid() const noexcept
id_t uid() const noexcept
const std::string & shell() const noexcept
const std::string & username() const noexcept
bool isValid() const noexcept
UserInfo() noexcept
Create instance of the user executing this application.
const std::vector< id_t > & groups() const noexcept
std::string toString() const noexcept
std::string to_string(const endian_t v) noexcept
Return std::string representation of the given endian.
std::string to_string(const alphabet &v) noexcept
Author: Sven Gothel sgothel@jausoft.com Copyright (c) 2024 Gothel Software e.K.