AUTH_AO::AUTH_AO()
: users(NULL),
isRunning(false),
- onAddUserNotifier(*this),
- onDelUserNotifier(*this),
logger(STG::PluginLogger::get("auth_ao"))
{
}
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); });
if (!isRunning)
return 0;
-users->DelNotifierUserAdd(&onAddUserNotifier);
-users->DelNotifierUserDel(&onDelUserNotifier);
+m_onAddUserConn.disconnect();
+m_onDelUserConn.disconnect();
auto it = userList.begin();
while (it != userList.end())
template <typename varParamType>
void CHG_BEFORE_NOTIFIER<varParamType>::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);
}
template <typename varParamType>
void CHG_AFTER_NOTIFIER<varParamType>::notify(const varParamType &, const varParamType &)
{
-//EVENT_LOOP_SINGLETON::GetInstance().Enqueue(auth, &AUTH_AO::UpdateUserAuthorization, user);
auth.UpdateUserAuthorization(user);
}
//-----------------------------------------------------------------------------