The Pedigree Project
0.1
|
#include <UserManager.h>
Public Member Functions | |
void | initialise () |
User * | getUser (size_t id) |
User * | getUser (String name) |
Group * | getGroup (size_t id) |
Group * | getGroup (String name) |
Static Public Member Functions | |
static UserManager & | instance () |
Private Member Functions | |
UserManager () | |
UserManager (const UserManager &) | |
UserManager & | operator= (const UserManager &) |
void | initialiseUsers () |
void | initialiseGroups () |
void | addUser (size_t uid, String username, String fullName, String group, String home, String shell, String password) |
void | addGroup (size_t gid, String name) |
Private Attributes | |
Tree< size_t, User * > | m_Users |
Tree< size_t, Group * > | m_Groups |
Static Private Attributes | |
static UserManager | m_Instance |
The user manager - this allows lookups of users and groups, and also parses the initial file "root:/config/users".
Definition at line 30 of file UserManager.h.
|
private |
Singleton class - default constructor hidden.
Definition at line 35 of file UserManager.cc.
References ERROR, Config::Result::errorMessage(), Config::Result::getNum(), Config::Result::getStr(), Config::query(), Config::Result::rows(), and Config::Result::succeeded().
Group * UserManager::getGroup | ( | size_t | id | ) |
Look up a group by ID.
Definition at line 105 of file UserManager.cc.
References Tree< K, E >::lookup(), and m_Groups.
Referenced by getGroup(), and WaitCleanup::terminated().
Look up a group by name.
Definition at line 110 of file UserManager.cc.
References Tree< K, E >::begin(), Tree< K, E >::end(), getGroup(), Group::getName(), getUser(), Tree< K, E >::insert(), Group::join(), m_Groups, m_Users, NOTICE, and WARNING.
User * UserManager::getUser | ( | size_t | id | ) |
Look up a user by ID.
Definition at line 88 of file UserManager.cc.
References Tree< K, E >::lookup(), and m_Users.
Referenced by getGroup(), initialise(), and WaitCleanup::terminated().
Look up a user by name.
Definition at line 93 of file UserManager.cc.
References Tree< K, E >::begin(), Tree< K, E >::end(), User::getUsername(), and m_Users.
void UserManager::initialise | ( | ) |
Reads in the file "root:/config/users".
Definition at line 170 of file UserManager.cc.
References FATAL, User::getDefaultGroup(), getUser(), Processor::information(), initialise(), instance(), Process::setGroup(), and Process::setUser().
Referenced by initialise().
|
inlinestatic |
Get the singleton instance.
Definition at line 34 of file UserManager.h.
Referenced by initialise(), and WaitCleanup::terminated().
Dictionary of groups, indexed by ID.
Definition at line 69 of file UserManager.h.
Referenced by getGroup().
Dictionary of users, indexed by ID.
Definition at line 67 of file UserManager.h.
Referenced by getGroup(), and getUser().