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
WsFsTreeConsultation Class Reference

Encapsulates consultation of tree (no modification) More...

#include <WsFsTreeConsultation.h>

Collaboration diagram for WsFsTreeConsultation:
Collaboration graph

Public Member Functions

 WsFsTreeConsultation (WsFsTreeUpdater *updater)
 Constructor. More...
 
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...
 
const std::string & getFsTreeStamp ()
 Get the stamp of the last WsFileSystemTree. More...
 

Private Member Functions

long getTimeMs ()
 

Private Attributes

WsFsTreeUpdaterm_updater
 
WsGlobalPropertiesm_conf
 
boost::mutex m_lockEditMutex
 

Detailed Description

Encapsulates consultation of tree (no modification)

Definition at line 27 of file WsFsTreeConsultation.h.

Constructor & Destructor Documentation

WsFsTreeConsultation::WsFsTreeConsultation ( WsFsTreeUpdater updater)

Constructor.

Parameters
updaterthe WsFsTreeUpdater instance

Definition at line 21 of file WsFsTreeConsultation.cpp.

Here is the call graph for this function:

Member Function Documentation

WsAccessTree * WsFsTreeConsultation::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 275 of file WsFsTreeConsultation.cpp.

Here is the call graph for this function:

const string & WsFsTreeConsultation::getFsTreeStamp ( )

Get the stamp of the last WsFileSystemTree.

Returns
a string containing the stamp

Definition at line 314 of file WsFsTreeConsultation.cpp.

Here is the call graph for this function:

int WsFsTreeConsultation::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 89 of file WsFsTreeConsultation.cpp.

Here is the call graph for this function:

int WsFsTreeConsultation::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 27 of file WsFsTreeConsultation.cpp.

Here is the call graph for this function:

WsNodeProperties * WsFsTreeConsultation::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 63 of file WsFsTreeConsultation.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

std::string WsFsTreeConsultation::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 81 of file WsFsTreeConsultation.cpp.

Here is the call graph for this function:

const std::string WsFsTreeConsultation::getRootPath ( )

Definition at line 305 of file WsFsTreeConsultation.cpp.

Here is the call graph for this function:

std::vector< WsResultItem > WsFsTreeConsultation::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 296 of file WsFsTreeConsultation.cpp.

Here is the call graph for this function:

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

TODO.

Parameters
groups
path
Returns

Definition at line 310 of file WsFsTreeConsultation.cpp.

long WsFsTreeConsultation::getTimeMs ( )
private

Definition at line 268 of file WsFsTreeConsultation.cpp.

Here is the caller graph for this function:

int WsFsTreeConsultation::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 209 of file WsFsTreeConsultation.cpp.

Here is the call graph for this function:

int WsFsTreeConsultation::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 150 of file WsFsTreeConsultation.cpp.

Here is the call graph for this function:

Member Data Documentation

WsGlobalProperties* WsFsTreeConsultation::m_conf
private

Definition at line 92 of file WsFsTreeConsultation.h.

boost::mutex WsFsTreeConsultation::m_lockEditMutex
private

Definition at line 93 of file WsFsTreeConsultation.h.

WsFsTreeUpdater* WsFsTreeConsultation::m_updater
private

Definition at line 91 of file WsFsTreeConsultation.h.


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