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

Interface between WsUser class and local tree. More...

#include <WsFsTreeClient.h>

Inheritance diagram for WsFsTreeClient:
Inheritance graph
Collaboration diagram for WsFsTreeClient:
Collaboration graph

Public Member Functions

 WsFsTreeClient (const std::string &id, const std::string &pass, const std::string &ip)
 constructor More...
 
virtual ~WsFsTreeClient ()
 desctrutor More...
 
int load ()
 loads the user info More...
 
int getPermissions (const std::string &p)
 Load infos of the user. More...
 
const WsNodePropertiesgetProperties (const std::string &p)
 
std::string getProperty (const std::string &section, const std::string &p, const std::string &prop)
 returns the properties of a node More...
 
const std::string & getSurname () const
 return the surname of the person More...
 
const std::string & getFirstName () const
 return the name of the person More...
 
const std::string & getEmail () const
 return the email of the person More...
 
int getLock (const std::string &path)
 
int putLock (const std::string &path)
 
int isLocked (const std::string &path, std::string &uid)
 
NodePtr getAccessRoot (const bool &forceUpdate=false)
 return the root node of the access tree starting from the root More...
 
vector< WsResultItemgetSearchResults (const std::string &terms)
 search for all matching results of terms using WsSearch class More...
 
std::set< string > getAllGroups ()
 
const std::string getRootPath ()
 return the root path of the filesystem tree, example : /var/www/demo_site More...
 
int saveProperties (WsNodeProperties *props, const std::string &path)
 save the properties of the node on disk. The user must have access and edit rights for the node. More...
 
int createNode (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 string &path)
 delete a node. The user must be an Admin on editor to remove the node In case of a WsDirNode, all the contents of the directory and the directory will be deleted More...
 
int renameNode (const string &path, const string &newPath)
 renames a node In case of a WsDirNode, all the contents of the directory and the directory will be moved More...
 
int saveProperty (const std::string &path, const std::string &section, const std::string &attr, const std::string &val)
 sets one property of the node and save it on disk. More...
 
bool isEditor ()
 
bool isAdministrator ()
 
std::vector< std::string > getTemplatesList (const std::string &path)
 

Private Member Functions

int authentify ()
 authenticate the user and load it's params More...
 

Private Attributes

std::set< string > m_groups
 
std::string m_uid
 
std::string m_pass
 
std::string m_ip
 
std::string m_sn
 
std::string m_givenName
 
std::string m_email
 
NodePtr m_menu
 
NodePtr m_accessTree
 
WsGlobalPropertiesm_conf
 
WsFsTreeOperationsm_operation
 

Detailed Description

Interface between WsUser class and local tree.

Used when not using FsDaemon

Definition at line 31 of file WsFsTreeClient.h.

Constructor & Destructor Documentation

WsFsTreeClient::WsFsTreeClient ( const std::string &  id,
const std::string &  pass,
const std::string &  ip 
)

constructor

Parameters
idthe user id

Definition at line 23 of file WsFsTreeClient.cpp.

WsFsTreeClient::~WsFsTreeClient ( )
virtual

desctrutor

Definition at line 30 of file WsFsTreeClient.cpp.

Member Function Documentation

int WsFsTreeClient::authentify ( )
private

authenticate the user and load it's params

Definition at line 76 of file WsFsTreeClient.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int WsFsTreeClient::createNode ( const string &  path,
int  type 
)
virtual

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
paththe relative path starting from root
typea NodeType enum { File, Directory }
Returns
ErrorCode::Success if ok, ErrorCode::NotFound if path is not found, ErrorCode::NoAccess if access denied and ErrorCode::Failure otherwise

Implements WsAbstractFsClient.

Definition at line 137 of file WsFsTreeClient.cpp.

Here is the call graph for this function:

int WsFsTreeClient::deleteNode ( const string &  path)
virtual

delete a node. The user must be an Admin on editor to remove the node In case of a WsDirNode, all the contents of the directory and the directory will be deleted

Parameters
paththe path to the node
Returns
ErrorCode::Success if ok, ErrorCode::NotFound if path is not found, ErrorCode::NoAccess if access denied and ErrorCode::Failure otherwise

Implements WsAbstractFsClient.

Definition at line 142 of file WsFsTreeClient.cpp.

Here is the call graph for this function:

NodePtr WsFsTreeClient::getAccessRoot ( const bool &  forceUpdate = false)
virtual

return the root node of the access tree starting from the root

Returns
NULL if the path is incorrect or if the user does not have access rights to it otherwise a NodePtr to the rootNode is returned

Implements WsAbstractFsClient.

Definition at line 106 of file WsFsTreeClient.cpp.

Here is the call graph for this function:

set< string > WsFsTreeClient::getAllGroups ( )
virtual

Implements WsAbstractFsClient.

Definition at line 116 of file WsFsTreeClient.cpp.

Here is the call graph for this function:

const string & WsFsTreeClient::getEmail ( ) const
virtual

return the email of the person

Returns
the email or an empty string if not found

Implements WsAbstractFsClient.

Definition at line 71 of file WsFsTreeClient.cpp.

const string & WsFsTreeClient::getFirstName ( ) const
virtual

return the name of the person

Returns
the name or an empty string if not found

Implements WsAbstractFsClient.

Definition at line 66 of file WsFsTreeClient.cpp.

int WsFsTreeClient::getLock ( const std::string &  path)
virtual

Implements WsAbstractFsClient.

Definition at line 91 of file WsFsTreeClient.cpp.

Here is the call graph for this function:

int WsFsTreeClient::getPermissions ( const std::string &  p)
virtual

Load infos of the user.

Loads the name, surname, email, groups ..

Returns
ErrorCode::Success if load is completed successfully, ErrorCode::Failure otherwise

Implements WsAbstractFsClient.

Definition at line 46 of file WsFsTreeClient.cpp.

Here is the call graph for this function:

const WsNodeProperties * WsFsTreeClient::getProperties ( const std::string &  p)
virtual

Implements WsAbstractFsClient.

Definition at line 51 of file WsFsTreeClient.cpp.

Here is the call graph for this function:

string WsFsTreeClient::getProperty ( const std::string &  section,
const std::string &  p,
const std::string &  prop 
)
virtual

returns the properties of a node

Parameters
pthe path to the node
Returns
a NodePtr containing a WsAbstractNode

Implements WsAbstractFsClient.

Definition at line 56 of file WsFsTreeClient.cpp.

Here is the call graph for this function:

const string WsFsTreeClient::getRootPath ( )
virtual

return the root path of the filesystem tree, example : /var/www/demo_site

Implements WsAbstractFsClient.

Definition at line 122 of file WsFsTreeClient.cpp.

Here is the call graph for this function:

vector< WsResultItem > WsFsTreeClient::getSearchResults ( const std::string &  terms)
virtual

search for all matching results of terms using WsSearch class

Parameters
termsthe terms to match results where found or if an error occured during the process.
Returns
a vector containing the results as WsResultItem or an empty vector if no results found

Implements WsAbstractFsClient.

Definition at line 111 of file WsFsTreeClient.cpp.

Here is the call graph for this function:

const string & WsFsTreeClient::getSurname ( ) const
virtual

return the surname of the person

Returns
the surname or an empty string if not found

Implements WsAbstractFsClient.

Definition at line 61 of file WsFsTreeClient.cpp.

vector< string > WsFsTreeClient::getTemplatesList ( const std::string &  path)
virtual

Implements WsAbstractFsClient.

Definition at line 162 of file WsFsTreeClient.cpp.

bool WsFsTreeClient::isAdministrator ( )
virtual

Returns
true if the actual user is an admin

Implements WsAbstractFsClient.

Definition at line 157 of file WsFsTreeClient.cpp.

Here is the call graph for this function:

bool WsFsTreeClient::isEditor ( )
virtual

Returns
true if actual user is an editor

Implements WsAbstractFsClient.

Definition at line 152 of file WsFsTreeClient.cpp.

Here is the call graph for this function:

int WsFsTreeClient::isLocked ( const std::string &  path,
std::string &  uid 
)
virtual

Implements WsAbstractFsClient.

Definition at line 101 of file WsFsTreeClient.cpp.

Here is the call graph for this function:

int WsFsTreeClient::load ( )
virtual

loads the user info

Implements WsAbstractFsClient.

Definition at line 35 of file WsFsTreeClient.cpp.

Here is the call graph for this function:

int WsFsTreeClient::putLock ( const std::string &  path)
virtual

Implements WsAbstractFsClient.

Definition at line 96 of file WsFsTreeClient.cpp.

Here is the call graph for this function:

int WsFsTreeClient::renameNode ( const string &  path,
const string &  newPath 
)
virtual

renames a node In case of a WsDirNode, all the contents of the directory and the directory will be moved

Parameters
paththe path to the node from the root
newPathnew path from the root
Returns
ErrorCode::Success if ok, ErrorCode::NotFound if path is not found, ErrorCode::NoAccess if access denied and ErrorCode::Failure otherwise

Implements WsAbstractFsClient.

Definition at line 147 of file WsFsTreeClient.cpp.

Here is the call graph for this function:

int WsFsTreeClient::saveProperties ( WsNodeProperties props,
const std::string &  path 
)
virtual

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

Parameters
propsthe properties to save
paththe path to the node (relative path)
Returns
ErrorCode::Success if ok, ErrorCode::NotFound if path is not found, ErrorCode::NoAccess if access denied and ErrorCode::Failure otherwise

Implements WsAbstractFsClient.

Definition at line 127 of file WsFsTreeClient.cpp.

Here is the call graph for this function:

int WsFsTreeClient::saveProperty ( const std::string &  path,
const std::string &  section,
const std::string &  attr,
const std::string &  val 
)
virtual

sets one property of the node and save it on disk.

Parameters
paththe path to the node (relative path)
sectionthe section of the property
attrthe key of the property
valthe value to set
Returns
ErrorCode::Success if ok, ErrorCode::NotFound if path is not found, ErrorCode::NoAccess if access denied and ErrorCode::Failure otherwise

Implements WsAbstractFsClient.

Definition at line 132 of file WsFsTreeClient.cpp.

Here is the call graph for this function:

Member Data Documentation

NodePtr WsFsTreeClient::m_accessTree
private

Definition at line 180 of file WsFsTreeClient.h.

WsGlobalProperties* WsFsTreeClient::m_conf
private

Definition at line 181 of file WsFsTreeClient.h.

std::string WsFsTreeClient::m_email
private

Definition at line 178 of file WsFsTreeClient.h.

std::string WsFsTreeClient::m_givenName
private

Definition at line 177 of file WsFsTreeClient.h.

std::set<string> WsFsTreeClient::m_groups
private

Contains the groups of the user

Definition at line 163 of file WsFsTreeClient.h.

std::string WsFsTreeClient::m_ip
private

password of the user

Definition at line 175 of file WsFsTreeClient.h.

NodePtr WsFsTreeClient::m_menu
private

Definition at line 179 of file WsFsTreeClient.h.

WsFsTreeOperations* WsFsTreeClient::m_operation
private

Definition at line 182 of file WsFsTreeClient.h.

std::string WsFsTreeClient::m_pass
private

pass of the user

Definition at line 171 of file WsFsTreeClient.h.

std::string WsFsTreeClient::m_sn
private

Definition at line 176 of file WsFsTreeClient.h.

std::string WsFsTreeClient::m_uid
private

uid of the user

Definition at line 167 of file WsFsTreeClient.h.


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