X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/b48c66514f3b7040f5f1c62a05f0489f2ebd7741..dbd170cc6a6787325b3bd00391f2727041ea4ad9:/projects/stargazer/plugins/store/files/file_store.h diff --git a/projects/stargazer/plugins/store/files/file_store.h b/projects/stargazer/plugins/store/files/file_store.h index cd81dcda..2fe41326 100644 --- a/projects/stargazer/plugins/store/files/file_store.h +++ b/projects/stargazer/plugins/store/files/file_store.h @@ -37,40 +37,42 @@ #include "stg/store.h" #include "stg/conffiles.h" #include "stg/user_traff.h" +#include "stg/logger.h" -//----------------------------------------------------------------------------- -extern "C" STORE * GetStore(); //----------------------------------------------------------------------------- class FILES_STORE_SETTINGS { public: FILES_STORE_SETTINGS(); - virtual ~FILES_STORE_SETTINGS(); - virtual int ParseSettings(const MODULE_SETTINGS & s); - virtual const std::string & GetStrError() const; + int ParseSettings(const MODULE_SETTINGS & s); + const std::string & GetStrError() const; - std::string GetWorkDir() const; - std::string GetUsersDir() const; - std::string GetAdminsDir() const; - std::string GetTariffsDir() const; + std::string GetWorkDir() const { return workDir; } + std::string GetUsersDir() const { return usersDir; } + std::string GetAdminsDir() const { return adminsDir; } + std::string GetTariffsDir() const { return tariffsDir; } + std::string GetServicesDir() const { return servicesDir; } - mode_t GetStatMode() const; + mode_t GetStatMode() const { return statMode; } mode_t GetStatModeDir() const; - uid_t GetStatUID() const; - gid_t GetStatGID() const; + uid_t GetStatUID() const { return statUID; } + gid_t GetStatGID() const { return statGID; } - mode_t GetConfMode() const; + mode_t GetConfMode() const { return confMode; } mode_t GetConfModeDir() const; - uid_t GetConfUID() const; - gid_t GetConfGID() const; + uid_t GetConfUID() const { return confUID; } + gid_t GetConfGID() const { return confGID; } - mode_t GetLogMode() const; - uid_t GetLogUID() const; - gid_t GetLogGID() const; + mode_t GetLogMode() const { return userLogMode; } + uid_t GetLogUID() const { return userLogUID; } + gid_t GetLogGID() const { return userLogGID; } - bool GetRemoveBak() const; - bool GetReadBak() const; + bool GetRemoveBak() const { return removeBak; } + bool GetReadBak() const { return readBak; } private: + FILES_STORE_SETTINGS(const FILES_STORE_SETTINGS & rvalue); + FILES_STORE_SETTINGS & operator=(const FILES_STORE_SETTINGS & rvalue); + const MODULE_SETTINGS * settings; int User2UID(const char * user, uid_t * uid); @@ -87,6 +89,7 @@ private: std::string usersDir; std::string adminsDir; std::string tariffsDir; + std::string servicesDir; mode_t statMode; uid_t statUID; @@ -107,8 +110,8 @@ private: class FILES_STORE: public STORE { public: FILES_STORE(); - virtual ~FILES_STORE(); - virtual const std::string & GetStrError() const; + virtual ~FILES_STORE() {} + virtual const std::string & GetStrError() const { return errorStr; } //User virtual int GetUsersList(std::vector * usersList) const; @@ -174,17 +177,20 @@ public: virtual int DelCorp(const std::string &) const { return 0; } // Services - virtual int GetServicesList(std::vector *) const { return 0; } - virtual int SaveService(const SERVICE_CONF &) const { return 0; } - virtual int RestoreService(SERVICE_CONF *, const std::string &) const { return 0; } - virtual int AddService(const std::string &) const { return 0; } - virtual int DelService(const std::string &) const { return 0; } + virtual int GetServicesList(std::vector *) const; + virtual int SaveService(const SERVICE_CONF &) const; + virtual int RestoreService(SERVICE_CONF *, const std::string &) const; + virtual int AddService(const std::string &) const; + virtual int DelService(const std::string &) const; - virtual void SetSettings(const MODULE_SETTINGS & s); + virtual void SetSettings(const MODULE_SETTINGS & s) { settings = s; } virtual int ParseSettings(); - virtual const std::string & GetVersion() const; + virtual const std::string & GetVersion() const { return version; } private: + FILES_STORE(const FILES_STORE & rvalue); + FILES_STORE & operator=(const FILES_STORE & rvalue); + virtual int RestoreUserStat(USER_STAT * stat, const std::string & login, const std::string & fileName) const; virtual int RestoreUserConf(USER_CONF * conf, const std::string & login, const std::string & fileName) const; @@ -193,11 +199,13 @@ private: int RemoveDir(const char * path) const; int Touch(const std::string & path) const; - mutable string errorStr; + mutable std::string errorStr; std::string version; FILES_STORE_SETTINGS storeSettings; MODULE_SETTINGS settings; mutable pthread_mutex_t mutex; + + PLUGIN_LOGGER logger; }; //-----------------------------------------------------------------------------