Description
An os_user
represents a user. Most entities, such as processes, files, and IPC mechanisms
are owned by a user. An os_user object can be
constructed from either a numeric user ID or a symbolic user name. Once
constructed, an os_user accesses information
about a user, such as the user's name.
Interface
Constructor
os_user(
const char* name , enum Encoding enc = Ascii )
Constructs
a user that represents the user with name name . Default enc is Ascii. Valid value for enc can be Ascii or Utf8.
Throws: os_security_toolkit_error
Constructor
os_user(
const string& name , enum Encoding enc = Ascii )
Constructs
a user that represents the user with name name . Default enc is Ascii. Valid value for enc can be Ascii or Utf8.
Throws: os_security_toolkit_error
Constructor
os_user(
const os_uid_t& user )
Constructs
a user with user ID user (default OS_UNDEFINED_USER
).
Throws: os_security_toolkit_error
Constructor
os_user(
const os_user& user )
Constructs
a user that is a copy of user .
<
bool
operator<( const os_user& user )
const
Returns
true if this user's ID is less than user
's.
=
os_user&
operator=( const os_user& user )
Assigns
this user from user .
=
os_user&
operator=( os_uid_t user )
Assigns
this user from user .
==
bool
operator==( const os_user& user )
const
Returns
true if this user's ID is the same as user
's.
(os_uid_t)
operator
os_uid_t() const
Returns
this user's ID.
defined
bool
defined() const
Returns
true if this user's ID is not OS_UNDEFINED_USER
.
domain
string
domain( enum Encoding enc = Ascii ) const
Returns this user's
domain name. Default enc is Ascii. Valid value for enc can be Ascii or Utf8.
gid
os_gid_t
gid() const
Returns
the ID of this user's primary group. If this information cannot be obtained
from the user database, returns OS_UNDEFINED_GROUP
.
name
string
name( enum Encoding enc = Ascii ) const
Returns
this user's name. If this information cannot be obtained from the user
database, returns an empty string. Default enc is Ascii. Valid value for enc can be Ascii or Utf8.
print
void
print( ostream& stream ) const
Prints
this user's name and user ID to stream .
uid
void
uid( const os_uid_t& user )
Sets
this user's ID to user .
uid
os_uid_t
uid() const
Returns
this user's ID.