X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/e9ae1f101b5418c0ba2e6c9d86b23c12f0140982..148f79dce19457e24754501db6844bc363c6f3fb:/include/stg/user_property.h diff --git a/include/stg/user_property.h b/include/stg/user_property.h index 9ce57c37..5965a7a6 100644 --- a/include/stg/user_property.h +++ b/include/stg/user_property.h @@ -22,8 +22,6 @@ #include // access -extern volatile time_t stgTime; - namespace STG { //----------------------------------------------------------------------------- @@ -186,7 +184,7 @@ template inline UserProperty::UserProperty(T& val) : value(val), - modificationTime(stgTime), + modificationTime(time(NULL)), beforeNotifiers(), afterNotifiers() { @@ -196,7 +194,7 @@ template inline void UserProperty::ModifyTime() noexcept { - modificationTime = stgTime; + modificationTime = time(NULL); } //----------------------------------------------------------------------------- template @@ -212,7 +210,7 @@ void UserProperty::Set(const T& rvalue) (*ni++)->Notify(oldVal, rvalue); value = rvalue; - modificationTime = stgTime; + modificationTime = time(NULL); ni = afterNotifiers.begin(); while (ni != afterNotifiers.end()) @@ -288,12 +286,12 @@ bool UserPropertyLogged::Set(const T& val, const Store& store, const std::string& msg) { - const auto priv = admin.GetPriv(); + const auto& priv = admin.priv(); - if ((priv->userConf && !isStat) || - (priv->userStat && isStat) || - (priv->userPasswd && isPassword) || - (priv->userCash && name == "cash")) + if ((priv.userConf && !isStat) || + (priv.userStat && isStat) || + (priv.userPasswd && isPassword) || + (priv.userCash && name == "cash")) { std::stringstream oldVal; std::stringstream newVal; @@ -326,7 +324,7 @@ void UserPropertyLogged::WriteAccessDenied(const std::string& login, const std::string& parameter) { stgLogger("%s Change user \'%s.\' Parameter \'%s\'. Access denied.", - admin.GetLogStr().c_str(), login.c_str(), parameter.c_str()); + admin.logStr().c_str(), login.c_str(), parameter.c_str()); } //------------------------------------------------------------------------- template @@ -340,7 +338,7 @@ void UserPropertyLogged::WriteSuccessChange(const std::string& login, const Store& store) { stgLogger("%s User \'%s\': \'%s\' parameter changed from \'%s\' to \'%s\'. %s", - admin.GetLogStr().c_str(), + admin.logStr().c_str(), login.c_str(), parameter.c_str(), oldValue.c_str(), @@ -350,7 +348,7 @@ void UserPropertyLogged::WriteSuccessChange(const std::string& login, for (size_t i = 0; i < settings.GetFilterParamsLog().size(); ++i) if (settings.GetFilterParamsLog()[i] == "*" || strcasecmp(settings.GetFilterParamsLog()[i].c_str(), parameter.c_str()) == 0) { - store.WriteUserChgLog(login, admin.GetLogin(), admin.GetIP(), parameter, oldValue, newValue, msg); + store.WriteUserChgLog(login, admin.login(), admin.IP(), parameter, oldValue, newValue, msg); return; } } @@ -366,7 +364,7 @@ void UserPropertyLogged::OnChange(const std::string& login, if (access(filePath.c_str(), X_OK) == 0) { - const auto execString = "\"" + filePath + "\" \"" + login + "\" \"" + paramName + "\" \"" + oldValue + "\" \"" + newValue + "\" \"" + admin.GetLogin() + "\" \"" + admin.GetIPStr() + "\""; + const auto execString = "\"" + filePath + "\" \"" + login + "\" \"" + paramName + "\" \"" + oldValue + "\" \"" + newValue + "\" \"" + admin.login() + "\" \"" + admin.IPStr() + "\""; ScriptExec(execString.c_str()); } else