pion::server::UserManager Class Reference

#include <UserManager.hpp>

Inherits pion::platform::ConfigManager, and pion::net::PionUserManager.

List of all members.


Detailed Description

UserManager : Manages a collection of platform Users

Definition at line 41 of file UserManager.hpp.

Public Member Functions

 UserManager ()
 construct a new UserManager Instance
virtual ~UserManager ()
 virtual destructor
virtual void openConfigFile (void)
 opens an existing User config file and loads the data it contains
virtual void writeConfigXML (std::ostream &out) const
bool writeConfigXML (std::ostream &out, const std::string &user_id) const
bool writePermissionsXML (std::ostream &out, const std::string &user_id) const
std::string addUser (const std::string &user_id, xmlNodePtr config_ptr)
void setUserConfig (const std::string &user_id, xmlNodePtr config_ptr)
virtual bool removeUser (const std::string &user_id)
bool creationAllowed (const pion::net::PionUserPtr &user_from_request, const pion::platform::ConfigManager &config_manager, const xmlNodePtr &config_ptr) const
bool updateAllowed (const pion::net::PionUserPtr &user_from_request, const pion::platform::ConfigManager &config_manager, const std::string &id, const xmlNodePtr &config_ptr) const
bool removalAllowed (const pion::net::PionUserPtr &user_from_request, const pion::platform::ConfigManager &config_manager, const std::string &id) const
bool accessAllowed (const pion::net::PionUserPtr &user_from_request, const pion::platform::ConfigManager &config_manager, const std::string &plugin_id) const
bool accessAllowed (const pion::net::PionUserPtr &user_from_request, const PlatformService &service, const std::string &id="") const

Static Public Member Functions

static xmlNodePtr createUserConfig (std::string &user_id, const char *buf, std::size_t len)

Classes

class  AddUserConfigException
 exception thrown if there is an error adding a User to the config file More...
class  DuplicateUserException
 exception thrown if a request is made to add a User when a User with the same ID has already been added More...
class  EmptyUserIdException
 exception thrown if a user_id parameter is found to be empty More...
class  MissingOpenSSLException
 exception thrown if Pion is built without support for OpenSSL More...
class  MissingUserIdInConfigFileException
 exception thrown if the config file contains a User with an empty or missing identifier More...
class  NoPasswordException
 exception thrown if a request is made to add or update a User with a configuration with an empty or missing password More...
class  UpdateUserConfigException
 exception thrown if there is an error updating a User in the config file More...
class  UserNotFoundException
 exception thrown if a User cannot be found More...
class  UserUpdateFailedException
 exception thrown if a User update failed More...


Member Function Documentation

bool pion::server::UserManager::accessAllowed ( const pion::net::PionUserPtr user_from_request,
const PlatformService service,
const std::string &  id = "" 
) const

determines whether a User has permission to use a PlatformService

Parameters:
user_from_request pointer to an existing User element node, as extracted from a request
service the PlatformService
id optional unique identifier specifying a subset of the PlatformService
Returns:
true if the User has permission

Definition at line 493 of file UserManager.cpp.

References pion::server::PlatformService::accessAllowed(), and pion::server::PlatformService::getPermissionType().

bool pion::server::UserManager::accessAllowed ( const pion::net::PionUserPtr user_from_request,
const pion::platform::ConfigManager config_manager,
const std::string &  plugin_id 
) const

determines whether a User has permission to use a plugin

Parameters:
user_from_request pointer to an existing User element node, as extracted from a request
config_manager the plugin manager corresponding to the plugin
plugin_id unique identifier associated with an existing plugin
Returns:
true if the User has permission

Definition at line 473 of file UserManager.cpp.

References pion::platform::ConfigManager::accessAllowed(), and pion::platform::ConfigManager::getPermissionType().

std::string pion::server::UserManager::addUser ( const std::string &  user_id,
xmlNodePtr  config_ptr 
)

adds a new managed User

Parameters:
user_id unique identifier associated with the User
config_ptr pointer to a list of XML nodes containing User configuration parameters
Returns:
std::string the new User's unique identifier

Definition at line 203 of file UserManager.cpp.

References pion::platform::ConfigManager::getConfigFile(), pion::platform::ConfigManager::ID_ATTRIBUTE_NAME, pion::platform::ConfigManager::m_config_node_ptr, pion::platform::ConfigManager::saveConfigFile(), and setUserConfig().

xmlNodePtr pion::server::UserManager::createUserConfig ( std::string &  user_id,
const char *  buf,
std::size_t  len 
) [static]

uses a memory buffer to generate XML configuration data for a User

Parameters:
user_id will get the unique identifier associated with the User
buf pointer to a memory buffer containing configuration data
len number of bytes available in the memory buffer
Returns:
xmlNodePtr XML configuration list for the User

Definition at line 370 of file UserManager.cpp.

References pion::platform::ConfigManager::findConfigNodeByName(), pion::platform::ConfigManager::getNodeId(), and pion::platform::ConfigManager::ROOT_ELEMENT_NAME.

bool pion::server::UserManager::creationAllowed ( const pion::net::PionUserPtr user_from_request,
const pion::platform::ConfigManager config_manager,
const xmlNodePtr &  config_ptr 
) const

determines whether a User has permission to create a new configuration node

Parameters:
user_from_request pointer to an existing User element node, as extracted from a request
config_manager the plugin manager corresponding to the type of the configuration
config_ptr pointer to the new configuration; if null, returns true only if the User has permission for any configuration handled by the config manager
Returns:
true if the User has permission

Definition at line 412 of file UserManager.cpp.

References pion::platform::ConfigManager::creationAllowed(), and pion::platform::ConfigManager::getPermissionType().

bool pion::server::UserManager::removalAllowed ( const pion::net::PionUserPtr user_from_request,
const pion::platform::ConfigManager config_manager,
const std::string &  id 
) const

determines whether a User has permission to remove a configuration node or set of configuration nodes

Parameters:
user_from_request pointer to an existing User element node, as extracted from a request
config_manager the plugin manager corresponding to the type of the configuration
id unique identifier associated with an existing configuration node or set of configuration nodes
Returns:
true if the User has permission

Definition at line 453 of file UserManager.cpp.

References pion::platform::ConfigManager::getPermissionType(), and pion::platform::ConfigManager::removalAllowed().

bool pion::server::UserManager::removeUser ( const std::string &  user_id  )  [virtual]

removes a managed User

Parameters:
user_id unique identifier associated with the User (username)

Reimplemented from pion::net::PionUserManager.

Definition at line 311 of file UserManager.cpp.

References pion::platform::ConfigManager::removePluginConfig(), and pion::platform::ConfigManager::saveConfigFile().

void pion::server::UserManager::setUserConfig ( const std::string &  user_id,
xmlNodePtr  config_ptr 
)

sets (updates) configuration parameters for a managed User

Parameters:
user_id unique identifier associated with the User
config_ptr pointer to a list of XML nodes containing User configuration parameters

Definition at line 280 of file UserManager.cpp.

References pion::platform::ConfigManager::findConfigNodeByAttr(), pion::platform::ConfigManager::getConfigFile(), pion::platform::ConfigManager::ID_ATTRIBUTE_NAME, pion::platform::ConfigManager::m_config_node_ptr, and pion::platform::ConfigManager::saveConfigFile().

Referenced by addUser().

bool pion::server::UserManager::updateAllowed ( const pion::net::PionUserPtr user_from_request,
const pion::platform::ConfigManager config_manager,
const std::string &  id,
const xmlNodePtr &  config_ptr 
) const

determines whether a User has permission to update a configuration node

Parameters:
user_from_request pointer to an existing User element node, as extracted from a request
config_manager the plugin manager corresponding to the type of the configuration
id unique identifier associated with an existing configuration node
config_ptr pointer to the new configuration; if null, returns true only if the User has permission for any configuration handled by the config manager
Returns:
true if the User has permission

Definition at line 432 of file UserManager.cpp.

References pion::platform::ConfigManager::getPermissionType(), and pion::platform::ConfigManager::updateAllowed().

bool pion::server::UserManager::writeConfigXML ( std::ostream &  out,
const std::string &  user_id 
) const

writes the configuration data for a particular User (as XML)

Parameters:
out the ostream to write the configuration tree into
user_id unique identifier associated with the User

Definition at line 182 of file UserManager.cpp.

References pion::platform::ConfigManager::findConfigNodeByAttr(), pion::platform::ConfigManager::ID_ATTRIBUTE_NAME, and pion::platform::ConfigManager::m_config_node_ptr.

void pion::server::UserManager::writeConfigXML ( std::ostream &  out  )  const [virtual]

writes the entire configuration tree to an output stream (as XML)

Parameters:
out the ostream to write the configuration tree into

Reimplemented from pion::platform::ConfigManager.

Definition at line 176 of file UserManager.cpp.

References pion::platform::ConfigManager::m_config_node_ptr.

bool pion::server::UserManager::writePermissionsXML ( std::ostream &  out,
const std::string &  user_id 
) const

writes the Permission configuration data for a particular User (as XML)

Parameters:
out the ostream to write the configuration tree into
user_id unique identifier associated with the User

Definition at line 249 of file UserManager.cpp.

References pion::platform::ConfigManager::findConfigNodeByAttr(), pion::platform::ConfigManager::ID_ATTRIBUTE_NAME, and pion::platform::ConfigManager::m_config_node_ptr.


The documentation for this class was generated from the following files:
Generated on Wed Apr 13 16:38:37 2011 for pion-platform by  doxygen 1.4.7