Wittyshare
0.2
|
Redirect operations to adequate class. More...
#include <WsFsTreeOperations.h>
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... | |
WsNodeProperties * | getProperties (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 §ion, 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... | |
WsAccessTree * | getAccessTree (const std::set< std::string > &groups) |
Get the access tree starting from rootPath. More... | |
std::vector< WsResultItem > | getSearchResults (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 §ion, 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 | |
WsFsTreeUpdater * | m_updater |
WsFsTreeConsultation * | m_consultation |
WsFsTreeModification * | m_modification |
WsGlobalProperties * | m_conf |
Redirect operations to adequate class.
Definition at line 28 of file WsFsTreeOperations.h.
WsFsTreeOperations::WsFsTreeOperations | ( | ) |
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
groups | the groups of the user to test access to parent dir |
uid | uid of user |
path | path to the new node |
type | type of node 0 for file 1 for directory |
Definition at line 109 of file WsFsTreeOperations.cpp.
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
groups | the groups of the user |
uid | the uid of the user |
path | the path to the node |
Definition at line 114 of file WsFsTreeOperations.cpp.
WsAccessTree * WsFsTreeOperations::getAccessTree | ( | const std::set< std::string > & | groups | ) |
Get the access tree starting from rootPath.
groups | the groups of the user to test access |
rootPath | the starting path of the access tree, default is "/" and will return the access tree starting from the root |
Definition at line 77 of file WsFsTreeOperations.cpp.
const string & WsFsTreeOperations::getFsTreeStamp | ( | ) |
Get the stamp of the last WsFileSystemTree.
Definition at line 139 of file WsFsTreeOperations.cpp.
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.
groups | the groups of the user |
uid | the uid of the user |
path | the path to the node |
Definition at line 62 of file WsFsTreeOperations.cpp.
int WsFsTreeOperations::getPermissions | ( | const std::set< std::string > & | groups, |
const std::string & | p | ||
) |
Get the permissions for a path for a set of groups.
groups | the set of gids to test |
p | the path to the node (relative path) |
Definition at line 47 of file WsFsTreeOperations.cpp.
WsNodeProperties * WsFsTreeOperations::getProperties | ( | const std::set< std::string > & | groups, |
const std::string & | p | ||
) |
get properties of a node corresponding to the path
groups | the groups to see if access is granted to the node |
p | the path to the node (relative path) |
Definition at line 52 of file WsFsTreeOperations.cpp.
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
groups | the groups to see if access is granted to the path |
section | the section of the property in the Json tree |
prop | the key of the property to retrieve |
p | the path to the node (relative path) |
Definition at line 57 of file WsFsTreeOperations.cpp.
const std::string WsFsTreeOperations::getRootPath | ( | ) |
std::vector< WsResultItem > WsFsTreeOperations::getSearchResults | ( | const std::set< std::string > & | groups, |
const std::string & | terms | ||
) |
Get the results for searching for "terms".
groups | groups of the user to test access |
terms | the terms of the search |
Definition at line 83 of file WsFsTreeOperations.cpp.
std::vector< std::string > WsFsTreeOperations::getTemplatesList | ( | const std::set< std::string > & | groups, |
const std::string & | path | ||
) |
bool WsFsTreeOperations::isAdministrator | ( | const std::set< std::string > & | groups | ) |
groups | the groups of the user |
Definition at line 124 of file WsFsTreeOperations.cpp.
bool WsFsTreeOperations::isEditor | ( | const std::set< std::string > & | groups | ) |
groups | the groups of the user |
Definition at line 129 of file WsFsTreeOperations.cpp.
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
groups | the groups of the user |
uid | the uid of the user |
path | the path to the node |
id | an empty string |
Definition at line 72 of file WsFsTreeOperations.cpp.
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.
groups | the groups of the user |
uid | the uid of the user |
path | the path to the node |
Definition at line 67 of file WsFsTreeOperations.cpp.
int WsFsTreeOperations::renameNode | ( | const std::set< std::string > & | groups, |
const std::string & | uid, | ||
const string & | path, | ||
const string & | newPath | ||
) |
renames a node
groups | the groups of the user |
uid | the uid of the user |
path | the path to the node |
newPath | the new path |
Definition at line 119 of file WsFsTreeOperations.cpp.
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.
groups | the groups of the user to test access |
json | a string containing the Json file contents |
path | the path to the node |
Definition at line 99 of file WsFsTreeOperations.cpp.
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.
groups | the groups of the user to test access |
path | the path to the node |
section | the section of the property in the Json file |
attr | the key of the property |
val | the value to set |
Definition at line 104 of file WsFsTreeOperations.cpp.
int WsFsTreeOperations::update | ( | ) |
Update the WsFileSystemTree.
Definition at line 134 of file WsFsTreeOperations.cpp.
|
private |
Definition at line 225 of file WsFsTreeOperations.h.
|
private |
Definition at line 223 of file WsFsTreeOperations.h.
|
private |
Definition at line 224 of file WsFsTreeOperations.h.
|
private |
Definition at line 222 of file WsFsTreeOperations.h.