Wittyshare
0.2
|
Properties of a WsNode. More...
#include <WsNodeProperties.h>
Public Types | |
enum | Type { File, Dir } |
Public Member Functions | |
WsNodeProperties (boost::filesystem::path nodePath, Type t) | |
Constructor. More... | |
WsNodeProperties (std::string jsonInput) | |
Constructor. Will create the property class from the Json input. More... | |
~WsNodeProperties () | |
std::string | get (const std::string §ion, const std::string &id, const std::string &def) |
std::set< std::string > | getGroups () |
Returns the groups that have access to the node If no groups are found in the file, an empty set is returned. More... | |
bool | isAllowed (std::set< std::string > gids) |
Compare the gids with the node groups. If the user has access, true is returned, otherwise false is returned. More... | |
Json::Value | getRoot () |
Return the root of the Json tree. More... | |
void | setRoot (Json::Value root) |
set the root of the Json tree More... | |
void | setRoot (const std::string &jsonInput) |
set the root of the Json tree More... | |
void | set (const std::string §ion, const std::string &key, const std::string &value) |
Changes or sets the propety with key 'key' to value 'value' If the property already exist, it will be overriden This method does not however, update the config file. More... | |
void | setGroups (std::set< std::string > grps) |
Sets the groups of the node to grps. All groups will be overriden. This method does not however, update the config file. More... | |
int | createPropertiesDirectories () |
Creates the directories for the properties. More... | |
int | save () |
save the properties to the disk The path of the file is set in m_nodePath and is set when building this object More... | |
Protected Member Functions | |
std::string | getPath () |
Get path of the node which the configuration belongs to. More... | |
int | parse (const std::string &path) |
parse the Json config file More... | |
Protected Attributes | |
Json::Value | m_root |
bool | m_parsed |
Private Attributes | |
boost::filesystem::path | m_nodePath |
Type | m_type |
boost::mutex | m_mutex |
Properties of a WsNode.
Definition at line 28 of file WsNodeProperties.h.
Enumerator | |
---|---|
File | |
Dir |
Definition at line 31 of file WsNodeProperties.h.
WsNodeProperties::WsNodeProperties | ( | boost::filesystem::path | nodePath, |
Type | t | ||
) |
Constructor.
path | the path to the node |
t | the Type |
Definition at line 27 of file WsNodeProperties.cpp.
WsNodeProperties::WsNodeProperties | ( | std::string | jsonInput | ) |
Constructor. Will create the property class from the Json input.
jsonInput | the json input text |
WsNodeProperties::~WsNodeProperties | ( | ) |
Definition at line 41 of file WsNodeProperties.cpp.
int WsNodeProperties::createPropertiesDirectories | ( | ) |
Creates the directories for the properties.
Definition at line 197 of file WsNodeProperties.cpp.
|
virtual |
Implements WsAbstractProperties.
Definition at line 45 of file WsNodeProperties.cpp.
std::set< string > WsNodeProperties::getGroups | ( | ) |
Returns the groups that have access to the node If no groups are found in the file, an empty set is returned.
Definition at line 62 of file WsNodeProperties.cpp.
|
protected |
Get path of the node which the configuration belongs to.
Definition at line 231 of file WsNodeProperties.cpp.
Value WsNodeProperties::getRoot | ( | ) |
Return the root of the Json tree.
Definition at line 133 of file WsNodeProperties.cpp.
bool WsNodeProperties::isAllowed | ( | std::set< std::string > | gids | ) |
Compare the gids with the node groups. If the user has access, true is returned, otherwise false is returned.
gids | a vector containing the gid |
Definition at line 82 of file WsNodeProperties.cpp.
|
protectedinherited |
parse the Json config file
path | the path to the configuration file |
Definition at line 28 of file WsAbstractProperties.cpp.
int WsNodeProperties::save | ( | ) |
save the properties to the disk The path of the file is set in m_nodePath and is set when building this object
Definition at line 217 of file WsNodeProperties.cpp.
void WsNodeProperties::set | ( | const std::string & | section, |
const std::string & | key, | ||
const std::string & | value | ||
) |
Changes or sets the propety with key 'key' to value 'value' If the property already exist, it will be overriden This method does not however, update the config file.
Definition at line 164 of file WsNodeProperties.cpp.
void WsNodeProperties::setGroups | ( | std::set< std::string > | grps | ) |
Sets the groups of the node to grps. All groups will be overriden. This method does not however, update the config file.
Definition at line 179 of file WsNodeProperties.cpp.
void WsNodeProperties::setRoot | ( | Json::Value | root | ) |
set the root of the Json tree
root | the root as Value object |
Definition at line 146 of file WsNodeProperties.cpp.
void WsNodeProperties::setRoot | ( | const std::string & | jsonInput | ) |
set the root of the Json tree
jsonInput | the Json as string |
Definition at line 152 of file WsNodeProperties.cpp.
|
private |
Definition at line 126 of file WsNodeProperties.h.
|
private |
Definition at line 124 of file WsNodeProperties.h.
|
protectedinherited |
True or false whether the configuration file has already be parsed or no This flag is changed by the WsAbstractProperties::parse method
Definition at line 66 of file WsAbstractProperties.h.
|
protectedinherited |
Root of the Json tree where. This is where the contents of Json parsed file is stored
Definition at line 60 of file WsAbstractProperties.h.
|
private |
Definition at line 125 of file WsNodeProperties.h.