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

Redirect operations to adequate class. More...

#include <WsFsTreeOperations.h>

Collaboration diagram for WsFsTreeOperations:
Collaboration graph

Public Member Functions

 WsFsTreeOperations ()
 
int getPermissions (const std::set< std::string > &groups, const std::string &p)
 Get the permissions for a path for a set of groups. More...
 
WsNodePropertiesgetProperties (const std::set< std::string > &groups, const std::string &p)
 get properties of a node corresponding to the path More...
 
std::string getProperty (const std::set< std::string > &groups, const std::string &section, const std::string &p, const std::string &prop)
 get a property for a node corresponding to the path More...
 
int getLock (const std::set< std::string > groups, const std::string &uid, const std::string &path)
 tries to acquire the lock for the path. @ return ErrorCode::Locked if the lock cannot be aquired because is detented by someone else. ErrorCode::Failure if an error occured A positive value with the duration in seconds of the lock is returned otherwise. More...
 
int putLock (const std::set< std::string > groups, const std::string &uid, const std::string &path)
 unlocks the file by deleting the .config/locks/filename.lock file Only the owner of the lock can unlock the path. More...
 
int isLocked (const std::set< std::string > groups, const std::string &uid, const std::string &path, std::string &id)
 check is the path is already locked More...
 
WsAccessTreegetAccessTree (const std::set< std::string > &groups)
 Get the access tree starting from rootPath. More...
 
std::vector< WsResultItemgetSearchResults (const std::set< std::string > &groups, const std::string &terms)
 Get the results for searching for "terms". More...
 
const std::string getRootPath ()
 
std::vector< std::string > getTemplatesList (const std::set< std::string > &groups, const std::string &path)
 TODO. 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)
 
int update ()
 Update the WsFileSystemTree. More...
 
const std::string & getFsTreeStamp ()
 Get the stamp of the last WsFileSystemTree. More...
 

Private Attributes

WsFsTreeUpdaterm_updater
 
WsFsTreeConsultationm_consultation
 
WsFsTreeModificationm_modification
 
WsGlobalPropertiesm_conf
 

Detailed Description

Redirect operations to adequate class.

See Also
WsFsTreeConsultation
WsFsTreeModification

Definition at line 28 of file WsFsTreeOperations.h.

Constructor & Destructor Documentation

WsFsTreeOperations::WsFsTreeOperations ( )

Definition at line 18 of file WsFsTreeOperations.cpp.

Here is the call graph for this function:

Member Function Documentation

int WsFsTreeOperations::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 109 of file WsFsTreeOperations.cpp.

Here is the caller graph for this function:

int WsFsTreeOperations::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 114 of file WsFsTreeOperations.cpp.

Here is the caller graph for this function:

WsAccessTree * WsFsTreeOperations::getAccessTree ( const std::set< std::string > &  groups)

Get the access tree starting from rootPath.

Parameters
groupsthe groups of the user to test access
rootPaththe starting path of the access tree, default is "/" and will return the access tree starting from the root
Returns
a WsMenuTree containing the nodes of the access tree. if an error occured or no access, the root of the WsAccessTree will be NULL

Definition at line 77 of file WsFsTreeOperations.cpp.

Here is the caller graph for this function:

const string & WsFsTreeOperations::getFsTreeStamp ( )

Get the stamp of the last WsFileSystemTree.

Returns
a string containing the stamp

Definition at line 139 of file WsFsTreeOperations.cpp.

Here is the caller graph for this function:

int WsFsTreeOperations::getLock ( const std::set< std::string >  groups,
const std::string &  uid,
const std::string &  path 
)

tries to acquire the lock for the path. @ return ErrorCode::Locked if the lock cannot be aquired because is detented by someone else. ErrorCode::Failure if an error occured A positive value with the duration in seconds of the lock is returned otherwise.

Parameters
groupsthe groups of the user
uidthe uid of the user
paththe path to the node

Definition at line 62 of file WsFsTreeOperations.cpp.

Here is the caller graph for this function:

int WsFsTreeOperations::getPermissions ( const std::set< std::string > &  groups,
const std::string &  p 
)

Get the permissions for a path for a set of groups.

Parameters
groupsthe set of gids to test
pthe path to the node (relative path)
Returns
READ READ_WRITE NO_ACCESS

Definition at line 47 of file WsFsTreeOperations.cpp.

Here is the caller graph for this function:

WsNodeProperties * WsFsTreeOperations::getProperties ( const std::set< std::string > &  groups,
const std::string &  p 
)

get properties of a node corresponding to the path

Parameters
groupsthe groups to see if access is granted to the node
pthe path to the node (relative path)
Returns
a WsNodeProperties correcponding to the properties of the node or a NULL object if access is not granted or path not found

Definition at line 52 of file WsFsTreeOperations.cpp.

Here is the caller graph for this function:

std::string WsFsTreeOperations::getProperty ( const std::set< std::string > &  groups,
const std::string &  section,
const std::string &  p,
const std::string &  prop 
)

get a property for a node corresponding to the path

Parameters
groupsthe groups to see if access is granted to the path
sectionthe section of the property in the Json tree
propthe key of the property to retrieve
pthe path to the node (relative path)
Returns
a string containing the property of a empty string if access is denied or path non existent

Definition at line 57 of file WsFsTreeOperations.cpp.

Here is the caller graph for this function:

const std::string WsFsTreeOperations::getRootPath ( )

Definition at line 89 of file WsFsTreeOperations.cpp.

Here is the caller graph for this function:

std::vector< WsResultItem > WsFsTreeOperations::getSearchResults ( const std::set< std::string > &  groups,
const std::string &  terms 
)

Get the results for searching for "terms".

Parameters
groupsgroups of the user to test access
termsthe terms of the search
Returns
a vector of WsResultItem. Each WsResultItem is a node with a small description. If no results, an empty vector is returned

Definition at line 83 of file WsFsTreeOperations.cpp.

Here is the caller graph for this function:

std::vector< std::string > WsFsTreeOperations::getTemplatesList ( const std::set< std::string > &  groups,
const std::string &  path 
)

TODO.

Parameters
groups
path
Returns

Definition at line 94 of file WsFsTreeOperations.cpp.

bool WsFsTreeOperations::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 124 of file WsFsTreeOperations.cpp.

Here is the caller graph for this function:

bool WsFsTreeOperations::isEditor ( const std::set< std::string > &  groups)
Returns
true if actual user is an editor
Parameters
groupsthe groups of the user

Definition at line 129 of file WsFsTreeOperations.cpp.

Here is the caller graph for this function:

int WsFsTreeOperations::isLocked ( const std::set< std::string >  groups,
const std::string &  uid,
const std::string &  path,
std::string &  id 
)

check is the path is already locked

Returns
1 if the path is unlocked
ErrorCode::Locked if the file is locked and the uid of the user who locked it will be stored in uid return ErrorCode::Failure if an error occured
Parameters
groupsthe groups of the user
uidthe uid of the user
paththe path to the node
idan empty string

Definition at line 72 of file WsFsTreeOperations.cpp.

Here is the caller graph for this function:

int WsFsTreeOperations::putLock ( const std::set< std::string >  groups,
const std::string &  uid,
const std::string &  path 
)

unlocks the file by deleting the .config/locks/filename.lock file Only the owner of the lock can unlock the path.

Returns
ErrorCode::Success if the lock has been successfully released ErrorCode::Success if no lock are currently hold on the path ErrorCode::Locked if the lock is owned by someone else ErrorCode::Failure if an error occured
Parameters
groupsthe groups of the user
uidthe uid of the user
paththe path to the node

Definition at line 67 of file WsFsTreeOperations.cpp.

Here is the caller graph for this function:

int WsFsTreeOperations::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 119 of file WsFsTreeOperations.cpp.

Here is the caller graph for this function:

int WsFsTreeOperations::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 99 of file WsFsTreeOperations.cpp.

Here is the caller graph for this function:

int WsFsTreeOperations::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 104 of file WsFsTreeOperations.cpp.

Here is the caller graph for this function:

int WsFsTreeOperations::update ( )

Update the WsFileSystemTree.

Returns
SUCCESS or FAILURE if update failed

Definition at line 134 of file WsFsTreeOperations.cpp.

Here is the caller graph for this function:

Member Data Documentation

WsGlobalProperties* WsFsTreeOperations::m_conf
private

Definition at line 225 of file WsFsTreeOperations.h.

WsFsTreeConsultation* WsFsTreeOperations::m_consultation
private

Definition at line 223 of file WsFsTreeOperations.h.

WsFsTreeModification* WsFsTreeOperations::m_modification
private

Definition at line 224 of file WsFsTreeOperations.h.

WsFsTreeUpdater* WsFsTreeOperations::m_updater
private

Definition at line 222 of file WsFsTreeOperations.h.


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