Rudiments
|
#include <userentry.h>
Inherits object.
Public Member Functions | |
userentry () | |
~userentry () | |
bool | open (const char *username) |
bool | open (uid_t userid) |
const char * | getName () |
const char * | getPassword () |
uid_t | getUserId () |
const char * | getSidString () |
const void * | getSid () |
uint64_t | getSidSize () |
gid_t | getPrimaryGroupId () |
const char * | getRealName () |
const char * | getHomeDirectory () |
const char * | getShell () |
const char * | getEncryptedPassword () |
long | getLastChangeDate () |
int32_t | getDaysBeforeChangeAllowed () |
int32_t | getDaysBeforeChangeRequired () |
int32_t | getDaysBeforeExpirationWarning () |
int32_t | getDaysOfInactivityAllowed () |
int32_t | getExpirationDate () |
int32_t | getFlag () |
Public Member Functions inherited from object | |
virtual | ~object () |
Static Public Member Functions | |
static char * | getName (uid_t userid) |
static uid_t | getUserId (const char *username) |
static char * | getSidString (const char *username) |
static bool | supportsFormalSid () |
static bool | getNeedsMutex () |
static void | setMutex (threadmutex *mtx) |
The userentry class provides methods for retrieving information about users.
userentry::userentry | ( | ) |
Creates an instance of the userentry class.
userentry::~userentry | ( | ) |
Deletes this instance of the userentry class.
int32_t userentry::getDaysBeforeChangeAllowed | ( | ) |
Returns the number of days before the password for the user may be changed.
int32_t userentry::getDaysBeforeChangeRequired | ( | ) |
Returns the number of days before the password for the user is required to be changed.
int32_t userentry::getDaysBeforeExpirationWarning | ( | ) |
Returns the number of days before a warning that the password for the user will expire should be displayed.
int32_t userentry::getDaysOfInactivityAllowed | ( | ) |
Returns the number of days of inactivity that are allowed for the user before the password will expire.
int32_t userentry::getExpirationDate | ( | ) |
Returns the expiration date of the user. The date is returned as the number of seconds since 1970.
int32_t userentry::getFlag | ( | ) |
Returns the system-specific set of flags for the user.
long userentry::getLastChangeDate | ( | ) |
Returns the last time that the password for the user was changed. The time is given as the number of seconds since 1970.
Convenience method. Returns the name of the user specified by "userid".
Note that the return value is allocated internally and returned. The calling program must free the buffer.
Returns NULL if an error occurred or if "userid" is invalid.
Returns true if this class needs a mutex to operate safely in a threaded environment and false otherwise.
gid_t userentry::getPrimaryGroupId | ( | ) |
Returns the primary group id of this user.
Returns a binary representation of the SID (security id) of this user.
Note: On platforms (like non-Windows platforms) where the supportsFormalSid method returns false, the value returned is just a string representation of the number returned by getUserId().
uint64_t userentry::getSidSize | ( | ) |
Returns the size of the binary representation of the SID (security id) of this user, returned by getSid().
Returns a string representation of the SID (security id) of this user.
Note: On platforms (like non-Windows platforms) where the supportsFormalSid method returns false, the value returned is just a string representation of the number returned by getUserId().
Convenience method. Returns a string representation of the SID (security id) of the user specified by "username". See non-static version of this method for more information.
Note that the return value is allocated internally and returned. The calling program must free the buffer.
Returns NULL if an error occurred or if "username" is invalid.
uid_t userentry::getUserId | ( | ) |
Returns the id of this user.
Note: On platforms (like Windows) where the supportsFormalSid method returns true, users don't hav simple numeric ids. On those platforms, the value returned by this method is simply an index into an internal structure that methods of other rudiments classes know how to access and ultimately translate to a user. It should not be passed in to functions or methods of other libraries that don't ultimately use rudiments methods.
Convenience method. Returns the id of the user specified by "username". See non-static version of this method for more information.
Returns -1 if an error occurred or if "username" is invalid.
Opens a user entry by name. Returns true on success and false on failure.
bool userentry::open | ( | uid_t | userid | ) |
Opens a user entry by user id. Returns true on success and false on failure.
|
static |
Allows you to supply a mutex is the class needs it (see getNeedsMutex()). If your application is not multithreaded, then there is no need to supply a mutex.