PionNetworkLibrary
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
pion::user_manager Class Reference

#include <user.hpp>

Inheritance diagram for pion::user_manager:
Collaboration diagram for pion::user_manager:

Public Member Functions

 user_manager (void)
 construct a new user_manager object More...
 
virtual ~user_manager ()
 virtual destructor More...
 
bool empty (void) const
 returns true if no users are defined More...
 
virtual bool add_user (const std::string &username, const std::string &password)
 
virtual bool update_user (const std::string &username, const std::string &password)
 
virtual bool remove_user (const std::string &username)
 
virtual user_ptr get_user (const std::string &username)
 
virtual user_ptr get_user (const std::string &username, const std::string &password)
 

Protected Types

typedef std::map< std::string,
user_ptr
user_map_t
 data type for a map of usernames to user objects More...
 

Protected Attributes

boost::mutex m_mutex
 mutex used to protect access to the user list More...
 
user_map_t m_users
 user records container More...
 

Detailed Description

user_manager base class for user container/manager

Member Typedef Documentation

typedef std::map<std::string, user_ptr> pion::user_manager::user_map_t
protected

data type for a map of usernames to user objects

Constructor & Destructor Documentation

pion::user_manager::user_manager ( void  )
inline

construct a new user_manager object

virtual pion::user_manager::~user_manager ( )
inlinevirtual

virtual destructor

Member Function Documentation

virtual bool pion::user_manager::add_user ( const std::string &  username,
const std::string &  password 
)
inlinevirtual

used to add a new user with plaintext password

Parameters
usernamename or identifier of the user to add
passwordplaintext password of the user to add
Returns
false if user with such a name already exists

References m_mutex, and m_users.

bool pion::user_manager::empty ( void  ) const
inline

returns true if no users are defined

References m_mutex, and m_users.

virtual user_ptr pion::user_manager::get_user ( const std::string &  username)
inlinevirtual

Used to locate user object by username

References m_mutex, and m_users.

virtual user_ptr pion::user_manager::get_user ( const std::string &  username,
const std::string &  password 
)
inlinevirtual

Used to locate user object by username and password

References m_mutex, and m_users.

virtual bool pion::user_manager::remove_user ( const std::string &  username)
inlinevirtual

used to remove given user

Returns
false if no user with such username

References m_mutex, and m_users.

virtual bool pion::user_manager::update_user ( const std::string &  username,
const std::string &  password 
)
inlinevirtual

update password for given user

Parameters
usernamename or identifier of the user to update
passwordplaintext password of the user to update
Returns
false if user with such a name doesn't exist

References m_mutex, and m_users.

Member Data Documentation

boost::mutex pion::user_manager::m_mutex
mutableprotected

mutex used to protect access to the user list

Referenced by add_user(), empty(), get_user(), remove_user(), and update_user().

user_map_t pion::user_manager::m_users
protected

user records container

Referenced by add_user(), empty(), get_user(), remove_user(), and update_user().


The documentation for this class was generated from the following file: