X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/bc6cac0e474dfe2feb4983aef98f99e23a98ffc4..ee1709cd231588fe672d0bd2546ef69ee87ff88c:/projects/stargazer/plugins/authorization/ao/ao.cpp diff --git a/projects/stargazer/plugins/authorization/ao/ao.cpp b/projects/stargazer/plugins/authorization/ao/ao.cpp index 78e1c955..d0be8dd5 100644 --- a/projects/stargazer/plugins/authorization/ao/ao.cpp +++ b/projects/stargazer/plugins/authorization/ao/ao.cpp @@ -48,8 +48,6 @@ return "Always Online authorizator v.1.0"; AUTH_AO::AUTH_AO() : users(NULL), isRunning(false), - onAddUserNotifier(*this), - onDelUserNotifier(*this), logger(STG::PluginLogger::get("auth_ao")) { } @@ -59,8 +57,8 @@ int AUTH_AO::Start() printfd(__FILE__, "AUTH_AO::Start()\n"); GetUsers(); -users->AddNotifierUserAdd(&onAddUserNotifier); -users->AddNotifierUserDel(&onDelUserNotifier); +m_onAddUserConn = users->onUserAdd([this](auto user){ AddUser(user); }); +m_onDelUserConn = users->onUserDel([this](auto user){ DelUser(user); }); std::for_each(userList.begin(), userList.end(), [this](auto user){ UpdateUserAuthorization(user); }); @@ -75,8 +73,8 @@ printfd(__FILE__, "AUTH_AO::Stop()\n"); if (!isRunning) return 0; -users->DelNotifierUserAdd(&onAddUserNotifier); -users->DelNotifierUserDel(&onDelUserNotifier); +m_onAddUserConn.disconnect(); +m_onDelUserConn.disconnect(); auto it = userList.begin(); while (it != userList.end()) @@ -213,7 +211,6 @@ return -1; template void CHG_BEFORE_NOTIFIER::notify(const varParamType &, const varParamType &) { -//EVENT_LOOP_SINGLETON::GetInstance().Enqueue(auth, &AUTH_AO::Unauthorize, user); if (user->IsAuthorizedBy(&auth)) auth.users->Unauthorize(user->GetLogin(), &auth); } @@ -221,7 +218,6 @@ if (user->IsAuthorizedBy(&auth)) template void CHG_AFTER_NOTIFIER::notify(const varParamType &, const varParamType &) { -//EVENT_LOOP_SINGLETON::GetInstance().Enqueue(auth, &AUTH_AO::UpdateUserAuthorization, user); auth.UpdateUserAuthorization(user); } //-----------------------------------------------------------------------------