7 WsUser::WsUser(
const string& strUid,
const string& pass,
const string& ip)
16 LOG(
DEBUG) <<
"WsUser::~WsUser() : Deleting WsUser Object";
29 if (
m_conf->
get(
"global",
"daemon",
"false") ==
"true") {
31 LOG(
INFO) <<
"WsUser::load() : Using FsDaemon" << endl;
37 LOG(
DEBUG) <<
"WsUser::load() : Using local FsTree" << endl;
42 LOG(
DEBUG) <<
"WsUser::load() : Getting PropertiesConfig::Daemon property OK";
91 string WsUser::getProperty(
const string& path,
const string& section,
const string& attr,
const string& def)
95 if ( ret.size() > 0 )
return ret;
143 return m_conf->
get(
"global",
"home_page",
"");
170 myfile.open (p.c_str());
171 if(myfile.is_open()){
196 string newPath = path;
197 boost::algorithm::replace_all(newPath,
"//",
"/");
int isLocked(const std::string &path, std::string &uid)
check is the path is already locked
boost::shared_ptr< WsAbstractNode > NodePtr
std::string cleanPath(const std::string &path)
int getPermissions(const std::string &p)
return the permissions on specific node
virtual std::vector< WsResultItem > getSearchResults(const std::string &terms)=0
search for all matching results of terms using WsSearch class
int saveProperty(const std::string &path, const std::string §ion, const std::string &attr, const std::string &val)
sets one property of the node and save it on disk.
std::string getProperty(const std::string &path, const std::string §ion, const string &attr, const std::string &def)
returns one property of a node If the property does not exist, a empty string is returned.
virtual bool isEditor()=0
virtual const WsNodeProperties * getProperties(const std::string &p)=0
return the permissions on specific node
virtual NodePtr getAccessRoot(const bool &forceUpdate=false)=0
return the root node of the access tree starting from the root
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...
WsAbstractFsClient * m_client
this will be an instance of WsFsTreeClient if not using daemon or WsFsDaemonClient if using daemon ...
int putLock(const std::string &path)
releases the lock for the path.
std::vector< WsResultItem > getSearchResults(const std::string &terms)
search for all matching results of terms using WsSearch class
virtual int putLock(const std::string &path)=0
releases the lock for the path.
std::vector< std::string > getTemplatesList(const std::string &path)
return all the templates contained in a directory and parents If two templates have the same name...
virtual std::string getProperty(const std::string §ion, const std::string &p, const std::string &prop)=0
returns the properties of a node
int writeFile(const std::string path, const std::string &text)
writes the text to the file
WsUser(const std::string &strUid, const std::string &pass="", const std::string &ip="")
Constructor.
virtual int isLocked(const std::string &path, std::string &uid)=0
check is the path is already locked
const std::string getHomePage()
return the home page
virtual int getLock(const std::string &path)=0
tries to acquire the lock for the path. @ return ErrorCode::Locked if the lock cannot be aquired beca...
std::set< std::string > getAllGroups()
int load()
Load infos of the user.
virtual int renameNode(const string &path, const string &newPath)=0
renames a node In case of a WsDirNode, all the contents of the directory and the directory will be mo...
const std::string & getEmail() const
return the email of the person
virtual int saveProperties(WsNodeProperties *props, const std::string &path)=0
save the properties of the node on disk. The user must have access and edit rights for the node...
virtual int saveProperty(const std::string &path, const std::string §ion, const std::string &attr, const std::string &val)=0
sets one property of the node and save it on disk.
const std::string & getFirstName() const
return the name of the person
virtual std::set< string > getAllGroups()=0
virtual int createNode(const string &path, int type)=0
create a directory or File. If the node is a WsDirNode than it will be only accessible to the Admin a...
std::string get(const std::string §ion, const std::string &id, const std::string &def)
const std::string getRootPath()
return the root path of the filesystem tree, example : /var/www/demo_site
const std::string & getSurname() const
return the surname of the person
Interface between the User class and the fsdaemon.
virtual int load()=0
loads the user info
int createNode(const string &path, NodeType type)
create a directory or File. If the node is a WsDirNode than it will be only accessible to the Admin a...
const WsNodeProperties * getProperties(const std::string &p)
returns the properties of a node
virtual bool isAdministrator()=0
static WsGlobalProperties * instance()
virtual std::vector< std::string > getTemplatesList(const std::string &path)=0
virtual int getPermissions(const std::string &p)=0
Load infos of the user.
virtual const std::string getRootPath()=0
return the root path of the filesystem tree, example : /var/www/demo_site
virtual const std::string & getSurname() const =0
return the surname of the person
NodePtr getAccessRoot()
return the root node of the access tree starting from the root
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 mo...
Interface between WsUser class and local tree.
const std::string & getUid() const
virtual const std::string & getFirstName() const =0
return the name of the person
int getLock(const std::string &path)
tries to acquire the lock for the path. @ return ErrorCode::Locked if the lock cannot be aquired beca...
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...
WsGlobalProperties * m_conf
virtual const std::string & getEmail() const =0
return the email of the person
virtual int deleteNode(const string &path)=0
delete a node. The user must be an Admin on editor to remove the node In case of a WsDirNode...