1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
includefile(include/header)
COMMENT(manpage, section, releasedate, archive, short name)
manpage(FBB::User)(3bobcat)(_CurYrs_)(libbobcat-dev__CurVers_)
(/etc/passwd user info)
manpagename(FBB::User)(Provides the tt(/etc/passwd) info of the current user)
manpagesynopsis()
bf(#include <bobcat/user>)nl()
Linking option: tt(-lbobcat)
manpagedescription()
This class retrieves the information of the current user from the
information in tt(/etc/passwd). The class is a simple wrapper class around the
bf(getpwent)(3) function.
includefile(include/namespace)
manpagesection(INHERITS FROM)
-
manpagesection(CONSTRUCTORS)
itemization(
itb(User())
The default constructor determines the current user's data.
This constructor throws an tt(Exception) exception if it did not
properly complete because the current user name could not be found in
tt(/etc/passwd).
itb(User(size_t uid))
The data of the user whose user-id is tt(uid) are determined.
If the data could not be found an tt(Exception) is thrown.
itb(User(std::string const &name))
The data of the user whose user-name is tt(name) are determined.
If the data could not be found an tt(Exception) is thrown.
)
Copy and move constructors (and assignment operators) are available.
manpagesection(MEMBER FUNCTIONS)
itemization(
itb(size_t eGroupid() const)
Returns the user's tt(effective) group-id.
itb(size_t eUserid() const)
Returns the user's tt(effective) user-id.
itb(size_t groupid() const)
Returns the user's group-id.
itb(std::string homedir() const)
Returns the user's home directory (including a trailing tt(/)).
itb(bool inGroup(size_t gid, bool useEffective = true) const)
Returns tt(true) if the current user is a member of group tt(gid),
otherwise tt(false) is returned. The user's effective group id is also
checked if tt(useEffective) is specified as tt(true) (which is
provided as default function argument).
itb(std::string name() const)
Returns the user's user-name.
itb(std::string password() const)
Returns the user's encrypted password. But see also the bf(BUGS) \
section.
itb(std::string realname() const)
Returns the user's real name, as listed in the tt(/etc/passwd)'s \
em(gecos) field.
itb(std::string shell() const)
Returns the user's shell.
itb(size_t userid() const)
Returns the user's user-id.
)
manpagesection(EXAMPLE)
verbinclude(../../user/driver/driver.cc)
manpagefiles()
em(bobcat/user) - defines the class interface
manpageseealso()
bf(bobcat)(7), bf(getpwent)(3)
manpagebugs()
If the user is a member of multiple groups, only the group id listed in
tt(/etc/passwd) is returned by bf(groupid()).
If shadow passwording is used, the string returned by bf(password()) will
probably not contain the encrypted password.
includefile(include/trailer)
|