#include <ArServerUserInfo.h>
The file format for this class is set up to be easy to make a new version of and yet read all the old versions.
For all of the versions everything after ; or # is ignored. The version information is then the first line of non comments.
The first version is described as such: The version string is 'UserInfoVersion1'. Then there are lines that follow for each user which are 'user userName password groups'. The passwords are plain text in the file, though they aren't sent that way over the network (look at ArServerBase docs for details). To display the groups available use ArServerBase::logCommandGroups().
There is an example user info file in ArNetworking/examples/serverDemo.userInfo
Public Member Functions | |
| ArServerUserInfo (const char *baseDirectory=NULL) | |
| Constructor. | |
| bool | doNotUse (void) const |
| std::set< std::string, ArStrCaseCmpOp > | getUsersGroups (const char *user) const |
| Gets the groups a user is in (returns empty set if no user). | |
| void | logUsers (void) const |
| Logs the users and groups. | |
| bool | matchUserPassword (const char *user, unsigned char password[16], const char *passwordKey, const char *serverKey, bool logFailureVerbosely=false) const |
| Matchs a user and password, false if user or password is wrong. | |
| bool | readFile (const char *fileName) |
| Loads the file, returns false if it wasn't there. | |
| void | setBaseDirectory (const char *baseDirectory) |
| Sets the base directory. | |
| ~ArServerUserInfo () | |
| Destructor. | |
Protected Member Functions | |
| void | logDigest (unsigned char digest[16]) const |
| void | removeHandlers (void) |
| bool | v1DoNotUseCallback (ArArgumentBuilder *arg) |
| bool | v1HeaderCallback (ArArgumentBuilder *arg) |
| bool | v1UserCallback (ArArgumentBuilder *arg) |
Protected Attributes | |
| std::string | myBaseDirectory |
| ArMutex | myDataMutex |
| bool | myDoNotUse |
| bool | myGotHeader |
| std::map< std::string, std::set< std::string, ArStrCaseCmpOp > *, ArStrCaseCmpOp > | myGroups |
| bool | myLogFailureVerbosely |
| ArFileParser | myParser |
| std::map< std::string, std::string, ArStrCaseCmpOp > | myPasswords |
| ArRetFunctor1C< bool, ArServerUserInfo, ArArgumentBuilder * > | myV1DoNotUseCB |
| ArRetFunctor1C< bool, ArServerUserInfo, ArArgumentBuilder * > | myV1HeaderCB |
| ArRetFunctor1C< bool, ArServerUserInfo, ArArgumentBuilder * > | myV1UserCB |
| ArServerUserInfo::ArServerUserInfo | ( | const char * | baseDirectory = NULL |
) |
Constructor.
| ArServerUserInfo::~ArServerUserInfo | ( | ) |
Destructor.
| bool ArServerUserInfo::doNotUse | ( | void | ) | const |
| std::set< std::string, ArStrCaseCmpOp > ArServerUserInfo::getUsersGroups | ( | const char * | user | ) | const |
Gets the groups a user is in (returns empty set if no user).
| void ArServerUserInfo::logDigest | ( | unsigned char | digest[16] | ) | const [protected] |
| void ArServerUserInfo::logUsers | ( | void | ) | const |
Logs the users and groups.
| bool ArServerUserInfo::matchUserPassword | ( | const char * | user, | |
| unsigned char | password[16], | |||
| const char * | passwordKey, | |||
| const char * | serverKey, | |||
| bool | logFailureVerbosely = false | |||
| ) | const |
Matchs a user and password, false if user or password is wrong.
| bool ArServerUserInfo::readFile | ( | const char * | fileName | ) |
Loads the file, returns false if it wasn't there.
| void ArServerUserInfo::removeHandlers | ( | void | ) | [protected] |
| void ArServerUserInfo::setBaseDirectory | ( | const char * | baseDirectory | ) |
Sets the base directory.
| bool ArServerUserInfo::v1DoNotUseCallback | ( | ArArgumentBuilder * | arg | ) | [protected] |
| bool ArServerUserInfo::v1HeaderCallback | ( | ArArgumentBuilder * | arg | ) | [protected] |
| bool ArServerUserInfo::v1UserCallback | ( | ArArgumentBuilder * | arg | ) | [protected] |
std::string ArServerUserInfo::myBaseDirectory [protected] |
ArMutex ArServerUserInfo::myDataMutex [protected] |
bool ArServerUserInfo::myDoNotUse [protected] |
bool ArServerUserInfo::myGotHeader [protected] |
std::map<std::string, std::set<std::string, ArStrCaseCmpOp> *, ArStrCaseCmpOp> ArServerUserInfo::myGroups [protected] |
bool ArServerUserInfo::myLogFailureVerbosely [protected] |
ArFileParser ArServerUserInfo::myParser [protected] |
std::map<std::string, std::string, ArStrCaseCmpOp> ArServerUserInfo::myPasswords [protected] |
ArRetFunctor1C<bool, ArServerUserInfo, ArArgumentBuilder *> ArServerUserInfo::myV1DoNotUseCB [protected] |
ArRetFunctor1C<bool, ArServerUserInfo, ArArgumentBuilder *> ArServerUserInfo::myV1HeaderCB [protected] |
ArRetFunctor1C<bool, ArServerUserInfo, ArArgumentBuilder *> ArServerUserInfo::myV1UserCB [protected] |
1.4.7