Wittyshare  0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
WsFsTreeModification Class Reference

Encapsulates modification operations on tree. More...

#include <WsFsTreeModification.h>

Collaboration diagram for WsFsTreeModification:
Collaboration graph

Public Member Functions

 WsFsTreeModification (WsFsTreeUpdater *updater)
 Constructor. More...
 
int saveProperties (const std::set< std::string > &groups, const std::string &json, const std::string &path)
 save the properties of the node. The user must have access and edit rights for the node. More...
 
int saveProperty (const std::set< std::string > &groups, const std::string &path, const std::string &section, const std::string &attr, const std::string &val)
 save a property of the node. The user must have access and edit rights for the node. More...
 
int createNode (const std::set< std::string > &groups, const std::string &uid, const string &path, int type)
 create a directory or File. If the node is a WsDirNode than it will be only accessible to the Admin and the editor who created the node More...
 
int deleteNode (const std::set< std::string > &groups, const std::string &uid, const string &path)
 delete a node. The user must be an Admin on editor to remove the node More...
 
int renameNode (const std::set< std::string > &groups, const std::string &uid, const string &path, const string &newPath)
 renames a node More...
 
bool isAdministrator (const std::set< std::string > &groups)
 
bool isEditor (const std::set< std::string > &groups)
 

Private Member Functions

bool canEdit (NodePtr node, std::set< std::string > groups)
 return true if the user can edit false otherwise More...
 

Private Attributes

WsFsTreeUpdaterm_updater
 
WsGlobalPropertiesm_conf
 

Detailed Description

Encapsulates modification operations on tree.

Definition at line 25 of file WsFsTreeModification.h.

Constructor & Destructor Documentation

WsFsTreeModification::WsFsTreeModification ( WsFsTreeUpdater updater)

Constructor.

Parameters
updatera WsFsTreeUpdater instance

Definition at line 22 of file WsFsTreeModification.cpp.

Here is the call graph for this function:

Member Function Documentation

bool WsFsTreeModification::canEdit ( NodePtr  node,
std::set< std::string >  groups 
)
private

return true if the user can edit false otherwise

Returns
true if the user can edit false otherwise
Parameters
nodeThe node to test edit
groupsthe user's groups

Definition at line 279 of file WsFsTreeModification.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int WsFsTreeModification::createNode ( const std::set< std::string > &  groups,
const std::string &  uid,
const string &  path,
int  type 
)

create a directory or File. If the node is a WsDirNode than it will be only accessible to the Admin and the editor who created the node

Parameters
groupsthe groups of the user to test access to parent dir
uiduid of user
pathpath to the new node
typetype of node 0 for file 1 for directory
Returns
SUCCESS or FAILURE if no access, node already existing or failure

Definition at line 66 of file WsFsTreeModification.cpp.

Here is the call graph for this function:

int WsFsTreeModification::deleteNode ( const std::set< std::string > &  groups,
const std::string &  uid,
const string &  path 
)

delete a node. The user must be an Admin on editor to remove the node

Parameters
groupsthe groups of the user
uidthe uid of the user
paththe path to the node
Returns
SUCCESS or FAILURE if no access, invalid path

Definition at line 142 of file WsFsTreeModification.cpp.

Here is the call graph for this function:

bool WsFsTreeModification::isAdministrator ( const std::set< std::string > &  groups)

Returns
true if the actual user is an Administrator
Parameters
groupsthe groups of the user

Definition at line 274 of file WsFsTreeModification.cpp.

Here is the call graph for this function:

bool WsFsTreeModification::isEditor ( const std::set< std::string > &  groups)

Returns
true if actual user is an editor
Parameters
groupsthe groups of the user

Definition at line 269 of file WsFsTreeModification.cpp.

Here is the call graph for this function:

int WsFsTreeModification::renameNode ( const std::set< std::string > &  groups,
const std::string &  uid,
const string &  path,
const string &  newPath 
)

renames a node

Parameters
groupsthe groups of the user
uidthe uid of the user
paththe path to the node
newPaththe new path
Returns
SUCCESS or FAILURE if no access, invalid path, invalid new path

Definition at line 191 of file WsFsTreeModification.cpp.

Here is the call graph for this function:

int WsFsTreeModification::saveProperties ( const std::set< std::string > &  groups,
const std::string &  json,
const std::string &  path 
)

save the properties of the node. The user must have access and edit rights for the node.

Parameters
groupsthe groups of the user to test access
jsona string containing the Json file contents
paththe path to the node
Returns
SUCCESS or FAILURE if no access, non exitent path, invalid Json

Definition at line 28 of file WsFsTreeModification.cpp.

Here is the call graph for this function:

int WsFsTreeModification::saveProperty ( const std::set< std::string > &  groups,
const std::string &  path,
const std::string &  section,
const std::string &  attr,
const std::string &  val 
)

save a property of the node. The user must have access and edit rights for the node.

Parameters
groupsthe groups of the user to test access
paththe path to the node
sectionthe section of the property in the Json file
attrthe key of the property
valthe value to set
Returns
SUCCESS or FAILURE if no access, path not found

Definition at line 47 of file WsFsTreeModification.cpp.

Here is the call graph for this function:

Member Data Documentation

WsGlobalProperties* WsFsTreeModification::m_conf
private

Definition at line 81 of file WsFsTreeModification.h.

WsFsTreeUpdater* WsFsTreeModification::m_updater
private

Definition at line 80 of file WsFsTreeModification.h.


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